blob: f2e1a599d35c87706d4ade0772833d2d8d69f80b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/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 "$internal_active" ]]; then
if [[ -n "$external_active" ]]; then
swaymsg output "$EXTERNAL" disable
else
swaymsg output "$EXTERNAL" enable
fi
fi
|