18 lines
495 B
Text
18 lines
495 B
Text
|
|
import json
|
||
|
|
|
||
|
|
status = json.loads($(swaymsg -t get_outputs --raw))
|
||
|
|
|
||
|
|
monitors = [mon["name"] for mon in status]
|
||
|
|
focused = [mon["name"] for mon in status if mon.get("focused", False)][0]
|
||
|
|
disabled = [mon["name"] for mon in status if not mon["active"]]
|
||
|
|
|
||
|
|
if disabled:
|
||
|
|
for mon in disabled:
|
||
|
|
print("enabling " + mon)
|
||
|
|
swaymsg output @(mon) enable
|
||
|
|
else:
|
||
|
|
for mon in monitors:
|
||
|
|
if mon != focused:
|
||
|
|
print("disabling " + mon)
|
||
|
|
swaymsg output @(mon) disable
|