diff options
| author | EnricoGuccii <partyka.003@proton.me> | 2026-05-03 02:10:07 +0200 |
|---|---|---|
| committer | EnricoGuccii <partyka.003@proton.me> | 2026-05-03 02:10:07 +0200 |
| commit | 5ad0cc56f3dbc5a14484cb5547472349bb99a889 (patch) | |
| tree | c151ae36b454b8f9b54a79243e91a755239f00c3 /scripts/toggle_external_monitor.sh | |
| parent | 70f575a4f8d8adfd0d3abecc6554bdb628166ebd (diff) | |
add: scripts
Diffstat (limited to 'scripts/toggle_external_monitor.sh')
| -rwxr-xr-x | scripts/toggle_external_monitor.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/toggle_external_monitor.sh b/scripts/toggle_external_monitor.sh new file mode 100755 index 0000000..f2e1a59 --- /dev/null +++ b/scripts/toggle_external_monitor.sh @@ -0,0 +1,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 + + |