Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnome with Mutter WM Detection #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions archey3
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def module_register(name):
return cls
return decorator

def mutter_check():
"""Some heuristics for detecting Mutter as WM."""
return os.environ.get('XDG_SESSION_TYPE') == 'wayland' and\
os.environ.get('XDG_SESSION_DESKTOP') == 'gnome'

DE_DICT = collections.OrderedDict([
('cinnamon', 'Cinnamon'),
('gnome-session', 'GNOME'),
Expand Down Expand Up @@ -109,6 +114,7 @@ WM_DICT = collections.OrderedDict([
(re.compile('kwin(_x11|_wayland)?'), 'KWin'),
('metacity', 'Metacity'),
('musca', 'Musca'),
(mutter_check, 'Mutter'),
('openbox', 'Openbox'),
('pekwm', 'PekWM'),
('ratpoison', 'ratpoison'),
Expand Down Expand Up @@ -464,12 +470,17 @@ class wmDisplay(display):
def render(self):
if self.state.config.get('wm', 'manual', fallback=False):
return "WM", self.state.config.get('wm', 'manual')
wm = ''
for key in WM_DICT.keys():

for key, val in WM_DICT.items():
if self.process_exists(key):
wm = key
break
return "WM", WM_DICT[wm]
return "WM", val

# 2to3 callable()
if isinstance(key, collections.Callable):
if key():
return "WM", val

return "WM", WM_DICT['']

@module_register("de")
class deDisplay(display):
Expand Down