blob: 706dcf12ff2ace16699a62a9b033a6b2dee7d612 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/zsh
INTERNAL="eDP-1"
EXTERNAL="HDMI-A-1"
outputs=$(swaymsg -t get_outputs -r)
internal_active=$(echo "$outputs" | jq -r --arg o "$INTERNAL" '.[] | select(.name==$o and .active==true) | .name')
external_active=$(echo "$outputs" | jq -r --arg o "$EXTERNAL" '.[] | select(.name==$o and .active==true) | .name')
if [[ -n "$external_active" ]]; then
if [[ -n "$internal_active" ]]; then
swaymsg output "$INTERNAL" disable
else
swaymsg output "$INTERNAL" enable
fi
fi
|