1
0
Fork 0
mirror of https://github.com/kbumsik/VirtScreen.git synced 2025-03-09 15:40:18 +00:00

Added os.environ.get calls to prevent the assumption that the environment variables are set, which causes a KeyError.

This commit is contained in:
Luke Anderson 2018-11-04 01:44:40 +01:00
parent f62fa66f51
commit 4a3a8e8e16
2 changed files with 2 additions and 2 deletions

View file

@ -79,7 +79,7 @@ def main() -> None:
def check_env(msg: Callable[[str], None]) -> None: def check_env(msg: Callable[[str], None]) -> None:
"""Check enveironments before start""" """Check enveironments before start"""
if os.environ['XDG_SESSION_TYPE'].lower() == 'wayland': if os.environ.get('XDG_SESSION_TYPE', '').lower() == 'wayland':
msg("Currently Wayland is not supported") msg("Currently Wayland is not supported")
sys.exit(1) sys.exit(1)
if not HOME_PATH: if not HOME_PATH:

View file

@ -85,7 +85,7 @@ class Backend(QObject):
else: else:
value["available"] = False value["available"] = False
# Default Display settings app for a Desktop Environment # Default Display settings app for a Desktop Environment
desktop_environ = os.environ['XDG_CURRENT_DESKTOP'].lower() desktop_environ = os.environ.get('XDG_CURRENT_DESKTOP', '').lower()
for key, value in data['displaySettingApps'].items(): for key, value in data['displaySettingApps'].items():
for de in value['XDG_CURRENT_DESKTOP']: for de in value['XDG_CURRENT_DESKTOP']:
if de in desktop_environ: if de in desktop_environ: