File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ local M = {}
1010
1111--- @return " wayland" | " x11" | nil
1212local function get_linux_session_type ()
13- local xdg_session_type = vim .env .XDG_SESSION_TYPE :lower ()
13+ local xdg_session_type = vim .env .XDG_SESSION_TYPE
14+ if not xdg_session_type then
15+ return
16+ end
17+ xdg_session_type = xdg_session_type :lower ()
1418 if xdg_session_type :find (" x11" ) then
1519 return " x11"
1620 elseif xdg_session_type :find (" wayland" ) then
2327--- @return boolean
2428local function is_linux_desktop_gnome ()
2529 local cur_desktop = vim .env .XDG_CURRENT_DESKTOP
26- local idx = vim .env .XDG_SESSION_DESKTOP :lower ():find (" gnome" ) or cur_desktop :lower ():find (" gnome" )
30+ local session_desktop = vim .env .XDG_SESSION_DESKTOP
31+ local idx = session_desktop and session_desktop :lower ():find (" gnome" )
32+ or cur_desktop and cur_desktop :lower ():find (" gnome" )
2733 return idx ~= nil or cur_desktop == " X-Cinnamon" or cur_desktop == " XFCE"
2834end
2935
You can’t perform that action at this time.
0 commit comments