[modules/arandr] handle case of "no layouts exist
To ensure that arandr works also if no layouts are available, add some (very simplistic) exception handling. see #844
This commit is contained in:
parent
1089792bc6
commit
8bde6378d4
1 changed files with 13 additions and 10 deletions
|
@ -136,6 +136,7 @@ class Module(core.module.Module):
|
||||||
def _get_layouts():
|
def _get_layouts():
|
||||||
"""Loads and parses the arandr screen layout scripts."""
|
"""Loads and parses the arandr screen layout scripts."""
|
||||||
layouts = {}
|
layouts = {}
|
||||||
|
try:
|
||||||
for filename in os.listdir(__screenlayout_dir__):
|
for filename in os.listdir(__screenlayout_dir__):
|
||||||
if fnmatch.fnmatch(filename, '*.sh'):
|
if fnmatch.fnmatch(filename, '*.sh'):
|
||||||
fullpath = os.path.join(__screenlayout_dir__, filename)
|
fullpath = os.path.join(__screenlayout_dir__, filename)
|
||||||
|
@ -146,6 +147,8 @@ class Module(core.module.Module):
|
||||||
continue
|
continue
|
||||||
displays_in_file = Module._parse_layout(line)
|
displays_in_file = Module._parse_layout(line)
|
||||||
layouts[filename] = displays_in_file
|
layouts[filename] = displays_in_file
|
||||||
|
except Exception as e:
|
||||||
|
log.error(str(e))
|
||||||
return layouts
|
return layouts
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue