dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | #!/usr/bin/env bash |
| 2 | # Opens/closes the Waybar flyout panels. Called by the Waybar buttons. |
| 3 | # toggle.sh [control-center|notifications] toggle that panel (default: control-center) |
| 4 | # toggle.sh close close whichever panel is open |
| 5 | # Only one panel is open at a time. Errors are shown as a notification and written to |
| 6 | # $XDG_RUNTIME_DIR/control-center.log |
| 7 | |
| 8 | PANEL="" |
| 9 | |
| 10 | # Force a monitor by number (0, 1, ...). Leave empty to open on the monitor you clicked on. |
| 11 | MONITOR="" |
| 12 | |
| 13 | DIR="" |
| 14 | EWW=(eww --config "") |
| 15 | LOG="/control-center.log" |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | || |
| 23 | |
| 24 | case "" in |
| 25 | control-center|notifications|close) ;; |
| 26 | *) ;; |
| 27 | esac |
| 28 | |
| 29 | ACTIVE= |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | # Clicking the button of the panel that is open (or asking to close) just closes it; |
| 42 | # clicking the other button swaps panels. |
| 43 | if [ || ; then |
| 44 | |
| 45 | |
| 46 | fi |
| 47 | |
| 48 | |
| 49 | # The focused monitor is the one the bar button was clicked on. Hyprland numbers monitors |
| 50 | # (HDMI-A-2 = 1) but Eww uses GTK's own numbering, so translate by matching screen positions. |
| 51 | # If that isn't possible we fall back to Hyprland's number, and finally to monitor 1. |
| 52 | if [ && ; then |
| 53 | MONITOR= |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | fi |
| 74 | MONITOR="" |
| 75 | |
| 76 | if [; then |
| 77 | # Fill the list before the panel appears; Eww then keeps it fresh while it is open. |
| 78 | |
| 79 | fi |
| 80 | |
| 81 | out= |
| 82 | || { |
| 83 | |
| 84 | |
| 85 | } |