Drop swapactiveworkspaces, add monitors-on menu
Browse files at this commit061438f139af66a768cd38e17f5aa2a977b47fa5Parent: d71498e- fix
- drop swapactiveworkspaces, add monitors-on menu
2 changed files +24 -8
.config/scripts/hyprland/show_desktop.shmodified+12 -6
| @@ -4,9 +4,11 @@ STATE_FILE="/tmp/hypr_show_desktop" | ||
| 4 | 4 | |
| 5 | 5 | if [ -f "$STATE_FILE" ]; then |
| 6 | 6 | 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 | |
| 10 | 12 | rm "$STATE_FILE" |
| 11 | 13 | else |
| 12 | 14 | mon_json=$(hyprctl monitors -j) |
| @@ -22,7 +24,11 @@ WS_FOCUSED=$WS_FOCUSED | ||
| 22 | 24 | WS_OTHER=$WS_OTHER |
| 23 | 25 | EOF |
| 24 | 26 | |
| 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 | |
| 28 | 34 | fi |
.config/scripts/hyprland/toggle_monitors.shmodified+12 -2
| @@ -7,7 +7,7 @@ HDMI_CONFIG="HDMI-A-1, 1920x1080@75, 2560x0, 1, bitdepth, 10" | ||
| 7 | 7 | |
| 8 | 8 | case "${1:-menu}" in |
| 9 | 9 | 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) | |
| 11 | 11 | |
| 12 | 12 | case "$menu" in |
| 13 | 13 | "🖥️ All Monitors Off") |
| @@ -19,7 +19,17 @@ case "${1:-menu}" in | ||
| 19 | 19 | hyprctl dispatch dpms off DP-1 |
| 20 | 20 | ;; |
| 21 | 21 | "🖥️ 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" | |
| 23 | 33 | ;; |
| 24 | 34 | "❌ Cancel") |
| 25 | 35 | ;; |