From c687c232b8204bf4452f4b46fb395c54a13fa4f9 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sat, 29 Oct 2022 02:14:20 +0300 Subject: [PATCH] Handle xdg.Exceptions.ParsingError in desktop_xdg plugin (fixes: #2089) --- src/plugins/desktop_xdg.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/desktop_xdg.py b/src/plugins/desktop_xdg.py index 7e1c3586..b666cc3a 100644 --- a/src/plugins/desktop_xdg.py +++ b/src/plugins/desktop_xdg.py @@ -2,24 +2,23 @@ import os -from xdg import BaseDirectory, Menu +from xdg import BaseDirectory, Menu, Exceptions class DesktopXDG(object): """pyxdg Freedesktop desktop implementation""" def __init__(self): - menu_entry = Menu.parse().getMenu('Office').getMenuEntry( - 'pybitmessage.desktop') - self.desktop = menu_entry.DesktopEntry if menu_entry else None + try: + self.desktop = Menu.parse().getMenu('Office').getMenuEntry( + 'pybitmessage.desktop').DesktopEntry + except Exceptions.ParsingError: + raise TypeError # TypeError disables startonlogon appimage = os.getenv('APPIMAGE') if appimage: self.desktop.set('Exec', appimage) def adjust_startonlogon(self, autostart=False): """Configure autostart according to settings""" - if not self.desktop: - return - autostart_path = os.path.join( BaseDirectory.xdg_config_home, 'autostart', 'pybitmessage.desktop') if autostart: