Skip to content

Commit 20921d3

Browse files
authored
feat: add desktop environment and window manager categories with icons (#438)
* feat: add icons for some desktop environments Fix #432 * feat: add icons for some window managers Fix #432 * feat: include DE & WM icons on "Hi" test * feat: update script to generate light colors
1 parent 93ddac6 commit 20921d3

File tree

5 files changed

+309
-24
lines changed

5 files changed

+309
-24
lines changed

lua/nvim-web-devicons.lua

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
local M = {}
22

3-
-- When adding new icons, remember to add an entry to the `filetypes` table, if applicable.
3+
-- NOTE: When adding new icons, remember to add an entry to the `filetypes` table, if applicable.
44
local icons, icons_by_filename, icons_by_file_extension, icons_by_operating_system
5+
local icons_by_desktop_environment, icons_by_window_manager
56

67
local default_icon = {
78
icon = "",
@@ -33,7 +34,17 @@ local function refresh_icons()
3334
icons_by_filename = theme.icons_by_filename
3435
icons_by_file_extension = theme.icons_by_file_extension
3536
icons_by_operating_system = theme.icons_by_operating_system
36-
icons = vim.tbl_extend("keep", {}, icons_by_filename, icons_by_file_extension, icons_by_operating_system)
37+
icons_by_desktop_environment = theme.icons_by_desktop_environment
38+
icons_by_window_manager = theme.icons_by_window_manager
39+
icons = vim.tbl_extend(
40+
"keep",
41+
{},
42+
icons_by_filename,
43+
icons_by_file_extension,
44+
icons_by_operating_system,
45+
icons_by_desktop_environment,
46+
icons_by_window_manager
47+
)
3748
icons = vim.tbl_extend("force", icons, global_opts.override)
3849
icons[1] = default_icon
3950
end
@@ -345,22 +356,28 @@ function M.setup(opts)
345356
local user_filename_icons = user_icons.override_by_filename
346357
local user_file_ext_icons = user_icons.override_by_extension
347358
local user_operating_system_icons = user_icons.override_by_operating_system
359+
local user_desktop_environment_icons = user_icons.override_by_desktop_environment
360+
local user_window_manager_icons = user_icons.override_by_window_manager
348361

349362
icons = vim.tbl_extend(
350363
"force",
351364
icons,
352365
user_icons.override or {},
353366
user_filename_icons or {},
354367
user_file_ext_icons or {},
355-
user_operating_system_icons or {}
368+
user_operating_system_icons or {},
369+
user_desktop_environment_icons or {},
370+
user_window_manager_icons or {}
356371
)
357372
global_opts.override = vim.tbl_extend(
358373
"force",
359374
global_opts.override,
360375
user_icons.override or {},
361376
user_filename_icons or {},
362377
user_file_ext_icons or {},
363-
user_operating_system_icons or {}
378+
user_operating_system_icons or {},
379+
user_desktop_environment_icons or {},
380+
user_window_manager_icons or {}
364381
)
365382

366383
if user_filename_icons then
@@ -372,6 +389,12 @@ function M.setup(opts)
372389
if user_operating_system_icons then
373390
icons_by_operating_system = vim.tbl_extend("force", icons_by_operating_system, user_operating_system_icons)
374391
end
392+
if user_desktop_environment_icons then
393+
icons_by_desktop_environment = vim.tbl_extend("force", icons_by_desktop_environment, user_desktop_environment_icons)
394+
end
395+
if user_window_manager_icons then
396+
icons_by_window_manager = vim.tbl_extend("force", icons_by_window_manager, user_window_manager_icons)
397+
end
375398

376399
icons[1] = default_icon
377400

@@ -390,7 +413,9 @@ function M.setup(opts)
390413
global_opts.override,
391414
icons_by_filename,
392415
icons_by_file_extension,
393-
icons_by_operating_system
416+
icons_by_operating_system,
417+
icons_by_desktop_environment,
418+
icons_by_window_manager
394419
)
395420
end, {
396421
desc = "nvim-web-devicons: highlight test",

lua/nvim-web-devicons/hi-test.lua

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,17 @@ end
104104
---@param icons_by_filename table[] filename "By File Name"
105105
---@param icons_by_file_extension table[] extension "By File Extension"
106106
---@param icons_by_operating_system table[] os "By Operating System"
107-
return function(default_icon, global_override, icons_by_filename, icons_by_file_extension, icons_by_operating_system)
107+
---@param icons_by_desktop_environment table[] os "By Desktop Environment"
108+
---@param icons_by_window_manager table[] os "By Window Manager"
109+
return function(
110+
default_icon,
111+
global_override,
112+
icons_by_filename,
113+
icons_by_file_extension,
114+
icons_by_operating_system,
115+
icons_by_desktop_environment,
116+
icons_by_window_manager
117+
)
108118
-- create a buffer
109119
local bufnr = vim.api.nvim_create_buf(false, true)
110120

@@ -116,7 +126,9 @@ return function(default_icon, global_override, icons_by_filename, icons_by_file_
116126
end
117127
l = render_icons(bufnr, l, icons_by_filename, "By File Name")
118128
l = render_icons(bufnr, l, icons_by_file_extension, "By File Extension")
119-
render_icons(bufnr, l, icons_by_operating_system, "By Operating System")
129+
l = render_icons(bufnr, l, icons_by_operating_system, "By Operating System")
130+
l = render_icons(bufnr, l, icons_by_desktop_environment, "By Desktop Environment")
131+
render_icons(bufnr, l, icons_by_window_manager, "By Window Manager")
120132

121133
-- finalise and focus the buffer
122134
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)

lua/nvim-web-devicons/icons-default.lua

Lines changed: 122 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,12 +2171,6 @@ local icons_by_operating_system = {
21712171
cterm_color = "38",
21722172
name = "Artix",
21732173
},
2174-
["budgie"] = {
2175-
icon = "",
2176-
color = "#5195e3",
2177-
cterm_color = "68",
2178-
name = "Budgie",
2179-
},
21802174
["centos"] = {
21812175
icon = "",
21822176
color = "#a2518d",
@@ -2353,8 +2347,130 @@ local icons_by_operating_system = {
23532347
},
23542348
}
23552349

2350+
local icons_by_desktop_environment = {
2351+
["budgie"] = {
2352+
icon = "",
2353+
color = "#4e5361",
2354+
cterm_color = "240",
2355+
name = "Budgie",
2356+
},
2357+
["cinnamon"] = {
2358+
icon = "",
2359+
color = "#dc682e",
2360+
cterm_color = "166",
2361+
name = "Cinnamon",
2362+
},
2363+
["gnome"] = {
2364+
icon = "",
2365+
color = "#ffffff",
2366+
cterm_color = "231",
2367+
name = "GNOME",
2368+
},
2369+
["lxde"] = {
2370+
icon = "",
2371+
color = "#a4a4a4",
2372+
cterm_color = "248",
2373+
name = "LXDE",
2374+
},
2375+
["lxqt"] = {
2376+
icon = "",
2377+
color = "#0191d2",
2378+
cterm_color = "32",
2379+
name = "LXQt",
2380+
},
2381+
["mate"] = {
2382+
icon = "",
2383+
color = "#9bda5c",
2384+
cterm_color = "113",
2385+
name = "MATE",
2386+
},
2387+
["plasma"] = {
2388+
icon = "",
2389+
color = "#1b89f4",
2390+
cterm_color = "33",
2391+
name = "KDEPlasma",
2392+
},
2393+
["xfce"] = {
2394+
icon = "",
2395+
color = "#00aadf",
2396+
cterm_color = "74",
2397+
name = "Xfce",
2398+
},
2399+
}
2400+
2401+
local icons_by_window_manager = {
2402+
["awesomewm"] = {
2403+
icon = "",
2404+
color = "#535d6c",
2405+
cterm_color = "59",
2406+
name = "awesome",
2407+
},
2408+
["bspwm"] = {
2409+
icon = "",
2410+
color = "#4f4f4f",
2411+
cterm_color = "239",
2412+
name = "BSPWM",
2413+
},
2414+
["dwm"] = {
2415+
icon = "",
2416+
color = "#1177aa",
2417+
cterm_color = "31",
2418+
name = "dwm",
2419+
},
2420+
["enlightenment"] = {
2421+
icon = "",
2422+
color = "#ffffff",
2423+
cterm_color = "231",
2424+
name = "Enlightenment",
2425+
},
2426+
["fluxbox"] = {
2427+
icon = "",
2428+
color = "#555555",
2429+
cterm_color = "240",
2430+
name = "Fluxbox",
2431+
},
2432+
["hyprland"] = {
2433+
icon = "",
2434+
color = "#00aaae",
2435+
cterm_color = "37",
2436+
name = "Hyprland",
2437+
},
2438+
["i3"] = {
2439+
icon = "",
2440+
color = "#e8ebee",
2441+
cterm_color = "255",
2442+
name = "i3",
2443+
},
2444+
["jwm"] = {
2445+
icon = "",
2446+
color = "#0078cd",
2447+
cterm_color = "32",
2448+
name = "JWM",
2449+
},
2450+
["qtile"] = {
2451+
icon = "",
2452+
color = "#ffffff",
2453+
cterm_color = "231",
2454+
name = "Qtile",
2455+
},
2456+
["sway"] = {
2457+
icon = "",
2458+
color = "#68751c",
2459+
cterm_color = "64",
2460+
name = "Sway",
2461+
},
2462+
["xmonad"] = {
2463+
icon = "",
2464+
color = "#fd4d5d",
2465+
cterm_color = "203",
2466+
name = "xmonad",
2467+
},
2468+
}
2469+
23562470
return {
23572471
icons_by_filename = icons_by_filename,
23582472
icons_by_file_extension = icons_by_file_extension,
23592473
icons_by_operating_system = icons_by_operating_system,
2474+
icons_by_desktop_environment = icons_by_desktop_environment,
2475+
icons_by_window_manager = icons_by_window_manager,
23602476
}

0 commit comments

Comments
 (0)