1
0
Fork 0
mirror of https://github.com/kbumsik/VirtScreen.git synced 2025-02-12 11:21:53 +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 committed by Bumsik Kim
parent f62fa66f51
commit 3e997c596a
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:
"""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")
sys.exit(1)
if not HOME_PATH:

View file

@ -85,7 +85,7 @@ class Backend(QObject):
else:
value["available"] = False
# 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 de in value['XDG_CURRENT_DESKTOP']:
if de in desktop_environ: