Merge pull request #216 from denisiko/gnome-environment-check

libnotifyplugin: Extend check for is_gnome
This commit is contained in:
Patrick Ulbrich
2020-11-07 16:54:13 +01:00
committed by GitHub

View File

@@ -64,8 +64,7 @@ class LibNotifyPlugin(Plugin):
# initialize Notification
if not self._initialized:
Notify.init("Mailnag")
self._is_gnome = 'GDMSESSION' in os.environ and \
(os.environ['GDMSESSION'] == 'gnome')
self._is_gnome = self._is_gnome_environment(('GDMSESSION', 'XDG_CURRENT_DESKTOP'))
self._initialized = True
def mails_added_hook(new_mails, all_mails):
@@ -376,6 +375,13 @@ class LibNotifyPlugin(Plugin):
return new_mails + [m for m in all_mails if m not in new_mails]
def _is_gnome_environment(self, env_vars):
for var in env_vars:
if os.environ.get(var, '').lower().endswith('gnome'):
return True
return False
def get_default_mail_reader():
mail_reader = None
app_info = Gio.AppInfo.get_default_for_type ("x-scheme-handler/mailto", False)