diff options
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/ChangeLayout.sh | 10 | ||||
| -rwxr-xr-x | config/hypr/scripts/GameMode.sh | 1 | ||||
| -rwxr-xr-x | config/hypr/scripts/KeybindsLayoutInit.sh | 40 | ||||
| -rwxr-xr-x | config/hypr/scripts/OverviewToggle.sh | 10 | ||||
| -rwxr-xr-x | config/hypr/scripts/Refresh.sh | 33 |
5 files changed, 36 insertions, 58 deletions
diff --git a/config/hypr/scripts/ChangeLayout.sh b/config/hypr/scripts/ChangeLayout.sh index 78428188..e2436b79 100755 --- a/config/hypr/scripts/ChangeLayout.sh +++ b/config/hypr/scripts/ChangeLayout.sh @@ -9,20 +9,14 @@ LAYOUT=$(hyprctl -j getoption general:layout | jq '.str' | sed 's/"//g') case $LAYOUT in "master") hyprctl keyword general:layout dwindle - hyprctl keyword unbind SUPER,J - hyprctl keyword unbind SUPER,K - hyprctl keyword bind SUPER,J,cyclenext - hyprctl keyword bind SUPER,K,cyclenext,prev + # SUPER+J/K are global and managed by KeybindsLayoutInit.sh; only manage SUPER+O here hyprctl keyword bind SUPER,O,togglesplit notify-send -e -u low -i "$notif" " Dwindle Layout" ;; "dwindle") hyprctl keyword general:layout master - hyprctl keyword unbind SUPER,J - hyprctl keyword unbind SUPER,K + # Drop togglesplit binding on SUPER+O when switching back to master hyprctl keyword unbind SUPER,O - hyprctl keyword bind SUPER,J,layoutmsg,cyclenext - hyprctl keyword bind SUPER,K,layoutmsg,cycleprev notify-send -e -u low -i "$notif" " Master Layout" ;; *) ;; diff --git a/config/hypr/scripts/GameMode.sh b/config/hypr/scripts/GameMode.sh index ec1e541e..59cf7372 100755 --- a/config/hypr/scripts/GameMode.sh +++ b/config/hypr/scripts/GameMode.sh @@ -20,6 +20,7 @@ if [ "$HYPRGAMEMODE" = 1 ] ; then hyprctl keyword "windowrule opacity 1 override 1 override 1 override, ^(.*)$" swww kill notify-send -e -u low -i "$notif" " Gamemode:" " enabled" + sleep 0.1 exit else swww-daemon --format xrgb && swww img "$HOME/.config/rofi/.current_wallpaper" & diff --git a/config/hypr/scripts/KeybindsLayoutInit.sh b/config/hypr/scripts/KeybindsLayoutInit.sh index fd34f90e..0a53eaaf 100755 --- a/config/hypr/scripts/KeybindsLayoutInit.sh +++ b/config/hypr/scripts/KeybindsLayoutInit.sh @@ -1,38 +1,14 @@ #!/usr/bin/env bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## -# Initialize J/K keybinds to match the current default layout at startup +# Initialize J/K keybinds so they always cycle windows globally (no layout-specific behavior) +# This avoids double-actions when layouts change. set -euo pipefail -# Determine current layout (master|dwindle); be robust to null at startup -LAYOUT=$(hyprctl -j getoption general:layout | jq -r '.str // empty' 2>/dev/null || true) -if [ -z "${LAYOUT:-}" ]; then - # Fallback: parse non-JSON output (e.g., "str: dwindle") - LAYOUT=$(hyprctl getoption general:layout 2>/dev/null | awk -F'str:' 'NF>1 {gsub(/^ +| +$/,"",$2); print $2}') -fi -[ -z "${LAYOUT:-}" ] && exit 0 +# Always reset and bind SUPER+J/K the same way on startup +hyprctl keyword unbind SUPER,J || true +hyprctl keyword unbind SUPER,K || true -case "$LAYOUT" in - master) - # Ensure master layout-style binds - hyprctl keyword unbind SUPER,J - hyprctl keyword unbind SUPER,K - hyprctl keyword unbind SUPER,O - hyprctl keyword bind SUPER,J,layoutmsg,cyclenext - hyprctl keyword bind SUPER,K,layoutmsg,cycleprev - ;; - dwindle) - # Ensure dwindle layout-style binds - hyprctl keyword unbind SUPER,J - hyprctl keyword unbind SUPER,K - hyprctl keyword unbind SUPER,O - hyprctl keyword bind SUPER,J,cyclenext - hyprctl keyword bind SUPER,K,cyclenext,prev - # ensure SUPER+O togglesplit is available on dwindle - hyprctl keyword bind SUPER,O,togglesplit - ;; - *) - # Do nothing for unexpected values - : - ;; - esac +# Cycle windows globally: J = next, K = previous +hyprctl keyword bind SUPER,J,cyclenext +hyprctl keyword bind SUPER,K,cyclenext,prev diff --git a/config/hypr/scripts/OverviewToggle.sh b/config/hypr/scripts/OverviewToggle.sh index 21c2da34..2737234c 100755 --- a/config/hypr/scripts/OverviewToggle.sh +++ b/config/hypr/scripts/OverviewToggle.sh @@ -5,11 +5,15 @@ set -euo pipefail # 1) Try Quickshell via Hyprland global dispatch (works if QS is running and listening) -if hyprctl dispatch global quickshell:overviewToggle >/dev/null 2>&1; then - exit 0 +# Only attempt this if a Quickshell process is running; otherwise Hyprland will +# still return success for the dispatch and we'll never fall back to AGS. +if pgrep -x quickshell >/dev/null 2>&1; then + if hyprctl dispatch global quickshell:overviewToggle >/dev/null 2>&1; then + exit 0 + fi fi -# If QS isn't running, try starting it and retry once +# If QS isn't running, but the CLI exists, try starting it and retry once if command -v qs >/dev/null 2>&1; then qs >/dev/null 2>&1 & sleep 0.6 diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 2e772aa9..76757aa4 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -7,23 +7,25 @@ UserScripts=$HOME/.config/hypr/UserScripts # Define file_exists function file_exists() { - if [ -e "$1" ]; then - return 0 # File exists - else - return 1 # File does not exist - fi + if [ -e "$1" ]; then + return 0 # File exists + else + return 1 # File does not exist + fi } # Kill already running processes _ps=(waybar rofi swaync ags) for _prs in "${_ps[@]}"; do - if pidof "${_prs}" >/dev/null; then - pkill "${_prs}" - fi + if pidof "${_prs}" >/dev/null; then + pkill "${_prs}" + fi done # added since wallust sometimes not applying -killall -SIGUSR2 waybar +killall -SIGUSR2 waybar +# Added sleep for GameMode causing multiple waybar +sleep 0.1 # quit ags & relaunch ags #ags -q && ags & @@ -33,23 +35,24 @@ killall -SIGUSR2 waybar # some process to kill for pid in $(pidof waybar rofi swaync ags swaybg); do - kill -SIGUSR1 "$pid" + kill -SIGUSR1 "$pid" + sleep 0.1 done #Restart waybar -sleep 1 +sleep 0.1 waybar & # relaunch swaync -sleep 0.5 -swaync > /dev/null 2>&1 & +sleep 0.3 +swaync >/dev/null 2>&1 & # reload swaync swaync-client --reload-config # Relaunching rainbow borders if the script exists sleep 1 if file_exists "${UserScripts}/RainbowBorders.sh"; then - ${UserScripts}/RainbowBorders.sh & + ${UserScripts}/RainbowBorders.sh & fi -exit 0
\ No newline at end of file +exit 0 |
