Handle xdg.Exceptions.ParsingError in desktop_xdg plugin (fixes: #2089)
This commit is contained in:
parent
1189628ed6
commit
c687c232b8
|
@ -2,24 +2,23 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from xdg import BaseDirectory, Menu
|
from xdg import BaseDirectory, Menu, Exceptions
|
||||||
|
|
||||||
|
|
||||||
class DesktopXDG(object):
|
class DesktopXDG(object):
|
||||||
"""pyxdg Freedesktop desktop implementation"""
|
"""pyxdg Freedesktop desktop implementation"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
menu_entry = Menu.parse().getMenu('Office').getMenuEntry(
|
try:
|
||||||
'pybitmessage.desktop')
|
self.desktop = Menu.parse().getMenu('Office').getMenuEntry(
|
||||||
self.desktop = menu_entry.DesktopEntry if menu_entry else None
|
'pybitmessage.desktop').DesktopEntry
|
||||||
|
except Exceptions.ParsingError:
|
||||||
|
raise TypeError # TypeError disables startonlogon
|
||||||
appimage = os.getenv('APPIMAGE')
|
appimage = os.getenv('APPIMAGE')
|
||||||
if appimage:
|
if appimage:
|
||||||
self.desktop.set('Exec', appimage)
|
self.desktop.set('Exec', appimage)
|
||||||
|
|
||||||
def adjust_startonlogon(self, autostart=False):
|
def adjust_startonlogon(self, autostart=False):
|
||||||
"""Configure autostart according to settings"""
|
"""Configure autostart according to settings"""
|
||||||
if not self.desktop:
|
|
||||||
return
|
|
||||||
|
|
||||||
autostart_path = os.path.join(
|
autostart_path = os.path.join(
|
||||||
BaseDirectory.xdg_config_home, 'autostart', 'pybitmessage.desktop')
|
BaseDirectory.xdg_config_home, 'autostart', 'pybitmessage.desktop')
|
||||||
if autostart:
|
if autostart:
|
||||||
|
|
Reference in New Issue
Block a user