11local 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.
44local icons , icons_by_filename , icons_by_file_extension , icons_by_operating_system
5+ local icons_by_desktop_environment , icons_by_window_manager
56
67local 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
3950end
@@ -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" ,
0 commit comments