forge
Explore
Log in

Don't you dare go Hollow

Drop swapactiveworkspaces, add monitors-on menu

Browse files at this commit

061438f139af66a768cd38e17f5aa2a977b47fa5Ahmet Kaan GümüşParent: d71498e
  • fix
    • drop swapactiveworkspaces, add monitors-on menu
Show full message
fix(hyprland/scripts): drop swapactiveworkspaces, add monitors-on menu

show_desktop.sh: swapactiveworkspaces moved the wrong workspace when the
two monitors were not both occupied. Focus each monitor and switch its
workspace explicitly, and handle the single-monitor case.

toggle_monitors.sh: the menu could only turn outputs off. HDMI-A-1 uses
`keyword monitor disable/enable` rather than dpms, which dpms cannot undo.
.config/scripts/hyprland/show_desktop.shmodified+12 -6
@@ -4,9 +4,11 @@ STATE_FILE="/tmp/hypr_show_desktop"
44
55 if [ -f "$STATE_FILE" ]; then
66 source "$STATE_FILE"
7- hyprctl dispatch workspace "$WS_OTHER"
8- hyprctl dispatch swapactiveworkspaces "$MON1" "$MON2"
9- hyprctl dispatch workspace "$WS_FOCUSED"
7+ if [ -n "$MON2" ]; then
8+ hyprctl --batch "dispatch focusmonitor $MON2; dispatch workspace $WS_OTHER; dispatch focusmonitor $MON1; dispatch workspace $WS_FOCUSED"
9+ else
10+ hyprctl dispatch workspace "$WS_FOCUSED"
11+ fi
1012 rm "$STATE_FILE"
1113 else
1214 mon_json=$(hyprctl monitors -j)
@@ -22,7 +24,11 @@ WS_FOCUSED=$WS_FOCUSED
2224 WS_OTHER=$WS_OTHER
2325 EOF
2426
25- hyprctl dispatch workspace 998
26- hyprctl dispatch swapactiveworkspaces "$MON1" "$MON2"
27- hyprctl dispatch workspace 999
27+ # one empty dummy workspace per monitor; no swapactiveworkspaces —
28+ # swaps rebind workspaces to the wrong monitor and confuse waybar
29+ if [ -n "$MON2" ]; then
30+ hyprctl --batch "dispatch focusmonitor $MON2; dispatch workspace 998; dispatch focusmonitor $MON1; dispatch workspace 999"
31+ else
32+ hyprctl dispatch workspace 999
33+ fi
2834 fi
.config/scripts/hyprland/toggle_monitors.shmodified+12 -2
@@ -7,7 +7,7 @@ HDMI_CONFIG="HDMI-A-1, 1920x1080@75, 2560x0, 1, bitdepth, 10"
77
88 case "${1:-menu}" in
99 menu)
10- menu=$(echo -e "🖥️ All Monitors Off\n🖥️ DP-1 Off\n🖥️ HDMI-A-1 Off\n❌ Cancel" | rofi -dmenu -p "Monitors" -i)
10+ menu=$(echo -e "🖥️ All Monitors Off\n🖥️ DP-1 Off\n🖥️ HDMI-A-1 Off\n💡 All Monitors On\n💡 DP-1 On\n💡 HDMI-A-1 On\n❌ Cancel" | rofi -dmenu -p "Monitors" -i)
1111
1212 case "$menu" in
1313 "🖥️ All Monitors Off")
@@ -19,7 +19,17 @@ case "${1:-menu}" in
1919 hyprctl dispatch dpms off DP-1
2020 ;;
2121 "🖥️ HDMI-A-1 Off")
22- hyprctl dispatch dpms off HDMI-A-1
22+ hyprctl keyword monitor "HDMI-A-1, disable"
23+ ;;
24+ "💡 All Monitors On")
25+ hyprctl dispatch dpms on DP-1
26+ hyprctl keyword monitor "$HDMI_CONFIG"
27+ ;;
28+ "💡 DP-1 On")
29+ hyprctl dispatch dpms on DP-1
30+ ;;
31+ "💡 HDMI-A-1 On")
32+ hyprctl keyword monitor "$HDMI_CONFIG"
2333 ;;
2434 "❌ Cancel")
2535 ;;