From 5ad0cc56f3dbc5a14484cb5547472349bb99a889 Mon Sep 17 00:00:00 2001 From: EnricoGuccii Date: Sun, 3 May 2026 02:10:07 +0200 Subject: add: scripts --- scripts/toggle_internal_monitor.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 scripts/toggle_internal_monitor.sh (limited to 'scripts/toggle_internal_monitor.sh') diff --git a/scripts/toggle_internal_monitor.sh b/scripts/toggle_internal_monitor.sh new file mode 100644 index 0000000..706dcf1 --- /dev/null +++ b/scripts/toggle_internal_monitor.sh @@ -0,0 +1,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 -- cgit v1.2.3