Catch error when sway cannot be reached
This commit is contained in:
parent
a5c53506c6
commit
1f728c137d
1 changed files with 12 additions and 8 deletions
20
install.py
20
install.py
|
@ -113,14 +113,18 @@ def main():
|
||||||
# This will only work if this is run on the target host
|
# This will only work if this is run on the target host
|
||||||
# and if sway is running, but that is usually the case...
|
# and if sway is running, but that is usually the case...
|
||||||
if output['match'] != '*':
|
if output['match'] != '*':
|
||||||
get_outputs = subprocess.check_output(
|
try:
|
||||||
['swaymsg', '-t', 'get_outputs', '-p'],
|
get_outputs = subprocess.check_output(
|
||||||
).decode('utf-8')
|
['swaymsg', '-t', 'get_outputs', '-p'],
|
||||||
for line in get_outputs.splitlines():
|
).decode('utf-8')
|
||||||
# Line format: Output <device> '<match identifier>'
|
for line in get_outputs.splitlines():
|
||||||
if line.startswith('Output') and output['match'] in line:
|
# Line format: Output <device> '<match identifier>'
|
||||||
output['device'] = line.split()[1]
|
if line.startswith('Output') and output['match'] in line:
|
||||||
break
|
output['device'] = line.split()[1]
|
||||||
|
break
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
print('Could not contact sway to retrieve output names.')
|
||||||
|
print('Please re-run in sway to finish configuring swaylock.')
|
||||||
|
|
||||||
lookup = mako.lookup.TemplateLookup(
|
lookup = mako.lookup.TemplateLookup(
|
||||||
directories=[
|
directories=[
|
||||||
|
|
Loading…
Add table
Reference in a new issue