diff options
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x[-rw-r--r--] | config/hypr/scripts/Battery.sh | 0 | ||||
| -rw-r--r-- | config/hypr/scripts/ComposeHyprConfigs.sh | 109 | ||||
| -rwxr-xr-x | config/hypr/scripts/Hyprsunset.sh | 22 | ||||
| -rwxr-xr-x | config/hypr/scripts/KeybindsLayoutInit.sh | 38 | ||||
| -rwxr-xr-x | config/hypr/scripts/Kool_Quick_Settings.sh | 4 | ||||
| -rwxr-xr-x | config/hypr/scripts/OverviewToggle.sh | 37 | ||||
| -rwxr-xr-x[-rw-r--r--] | config/hypr/scripts/sddm_wallpaper.sh | 0 |
7 files changed, 94 insertions, 116 deletions
diff --git a/config/hypr/scripts/Battery.sh b/config/hypr/scripts/Battery.sh index 2baed6ca..2baed6ca 100644..100755 --- a/config/hypr/scripts/Battery.sh +++ b/config/hypr/scripts/Battery.sh diff --git a/config/hypr/scripts/ComposeHyprConfigs.sh b/config/hypr/scripts/ComposeHyprConfigs.sh deleted file mode 100644 index 55bc3c5c..00000000 --- a/config/hypr/scripts/ComposeHyprConfigs.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env bash -# Compose merged Hyprland configs for Startup_Apps and WindowRules -set -euo pipefail - -BASE_DIR="$HOME/.config/hypr" -BASE_CFG_DIR="$BASE_DIR/configs" -USER_DIR="$BASE_DIR/UserConfigs" -GEN_DIR="$BASE_DIR/generated" - -mkdir -p "$GEN_DIR" - -log() { printf "[compose] %s\n" "$*"; } - -# Trim leading/trailing whitespace -trim() { sed -E 's/^\s+//;s/\s+$//'; } - -# Normalize spaces in a directive line -normalize() { awk '{$1=$1;print}'; } - -# Build merged Startup_Apps.conf -compose_startup_apps() { - local base_file="$BASE_CFG_DIR/Startup_Apps.conf" - local user_file="$USER_DIR/Startup_Apps.conf" - local disable_file="$USER_DIR/Startup_Apps.disable" - local out_file="$GEN_DIR/Startup_Apps.conf" - - : >"$out_file" - - # Header and variable lines come from base - if [[ -f "$base_file" ]]; then - # Copy all non exec-once lines (comments, blanks, variables, etc.) - grep -Ev '^\s*exec-once\s*=' "$base_file" || true >>"$out_file" - fi - - # Collect exec-once commands (the right side of '=') - declare -A cmds=() - - if [[ -f "$base_file" ]]; then - while IFS= read -r line; do - [[ "$line" =~ ^\s*exec-once\s*= ]] || continue - cmd="${line#*=}" - cmd="$(echo "$cmd" | trim)" - cmds["$cmd"]=1 - done <"$base_file" - fi - - if [[ -f "$user_file" ]]; then - while IFS= read -r line; do - [[ "$line" =~ ^\s*exec-once\s*= ]] || continue - cmd="${line#*=}" - cmd="$(echo "$cmd" | trim)" - cmds["$cmd"]=1 - done <"$user_file" - fi - - # Apply disables (exact match of command string) - if [[ -f "$disable_file" ]]; then - while IFS= read -r d; do - d="$(echo "$d" | trim)" - [[ -z "$d" || "$d" =~ ^# ]] && continue - unset 'cmds[$d]' - done <"$disable_file" - fi - - # Emit combined exec-once (stable sort) - for k in "${!cmds[@]}"; do echo "$k"; done | sort -u | while IFS= read -r cmd; do - [[ -z "$cmd" ]] && continue - printf "exec-once = %s\n" "$cmd" >>"$out_file" - done - - log "Wrote $out_file" -} - -# Build merged WindowRules.conf -compose_window_rules() { - local base_file="$BASE_CFG_DIR/WindowRules.conf" - local user_file="$USER_DIR/WindowRules.conf" - local disable_file="$USER_DIR/WindowRules.disable" - local out_file="$GEN_DIR/WindowRules.conf" - - : >"$out_file" - echo "# Generated merged WindowRules" >>"$out_file" - - declare -A rules=() - add_rules() { - local f="$1" - [[ -f "$f" ]] || return 0 - grep -E '^(windowrule|layerrule)\s*=' "$f" | trim | while IFS= read -r r; do - rules["$r"]=1 - done - } - - add_rules "$base_file" - add_rules "$user_file" - - if [[ -f "$disable_file" ]]; then - while IFS= read -r d; do - d="$(echo "$d" | trim)" - [[ -z "$d" || "$d" =~ ^# ]] && continue - unset 'rules[$d]' - done <"$disable_file" - fi - - for r in "${!rules[@]}"; do echo "$r"; done | sort -u >>"$out_file" - log "Wrote $out_file" -} - -compose_startup_apps -compose_window_rules
\ No newline at end of file diff --git a/config/hypr/scripts/Hyprsunset.sh b/config/hypr/scripts/Hyprsunset.sh index c7c4b395..4a2b52f4 100755 --- a/config/hypr/scripts/Hyprsunset.sh +++ b/config/hypr/scripts/Hyprsunset.sh @@ -8,12 +8,12 @@ set -euo pipefail # - On: sunset icon if available, otherwise a blue sun # # Customize via env vars: -# HYPERSUNSET_TEMP default 4500 (K) -# HYPERSUNSET_ICON_MODE sunset|blue (default: sunset) +# HYPRSUNSET_TEMP default 4500 (K) +# HYPRSUNSET_ICON_MODE sunset|blue (default: sunset) STATE_FILE="$HOME/.cache/.hyprsunset_state" -TARGET_TEMP="${HYPERSUNSET_TEMP:-4500}" -ICON_MODE="${HYPERSUNSET_ICON_MODE:-sunset}" +TARGET_TEMP="${HYPRSUNSET_TEMP:-4500}" +ICON_MODE="${HYPRSUNSET_ICON_MODE:-sunset}" ensure_state() { [[ -f "$STATE_FILE" ]] || echo "off" > "$STATE_FILE" @@ -92,8 +92,20 @@ cmd_status() { printf '{"text":"%s","class":"%s","tooltip":"%s"}\n' "$txt" "$cls" "$tip" } +cmd_init() { + ensure_state + state="$(cat "$STATE_FILE" || echo off)" + + if [[ "$state" == "on" ]]; then + if command -v hyprsunset >/dev/null 2>&1; then + nohup hyprsunset -t "$TARGET_TEMP" >/dev/null 2>&1 & + fi + fi +} + case "${1:-}" in toggle) cmd_toggle ;; status) cmd_status ;; - *) echo "usage: $0 [toggle|status]" >&2; exit 2 ;; + init) cmd_init ;; + *) echo "usage: $0 [toggle|status|init]" >&2; exit 2 ;; esac diff --git a/config/hypr/scripts/KeybindsLayoutInit.sh b/config/hypr/scripts/KeybindsLayoutInit.sh new file mode 100755 index 00000000..fd34f90e --- /dev/null +++ b/config/hypr/scripts/KeybindsLayoutInit.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# Initialize J/K keybinds to match the current default layout at startup + +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 + +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 diff --git a/config/hypr/scripts/Kool_Quick_Settings.sh b/config/hypr/scripts/Kool_Quick_Settings.sh index 79ddc163..16742492 100755 --- a/config/hypr/scripts/Kool_Quick_Settings.sh +++ b/config/hypr/scripts/Kool_Quick_Settings.sh @@ -55,10 +55,10 @@ main() { case "$choice" in "view/edit User Defaults") file="$UserConfigs/01-UserDefaults.conf" ;; "view/edit ENV variables") file="$UserConfigs/ENVariables.conf" ;; - "view/edit Window Rules") file="$UserConfigs/WindowRules.conf" ;; + "view/edit Window Rules") file="$configs/WindowRules.conf" ;; "view/edit User Keybinds") file="$UserConfigs/UserKeybinds.conf" ;; "view/edit User Settings") file="$UserConfigs/UserSettings.conf" ;; - "view/edit Startup Apps") file="$UserConfigs/Startup_Apps.conf" ;; + "view/edit Startup Apps") file="$configs/Startup_Apps.conf" ;; "view/edit Decorations") file="$UserConfigs/UserDecorations.conf" ;; "view/edit Animations") file="$UserConfigs/UserAnimations.conf" ;; "view/edit Laptop Keybinds") file="$UserConfigs/Laptops.conf" ;; diff --git a/config/hypr/scripts/OverviewToggle.sh b/config/hypr/scripts/OverviewToggle.sh new file mode 100755 index 00000000..21c2da34 --- /dev/null +++ b/config/hypr/scripts/OverviewToggle.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ # +# Overview toggle wrapper - tries Quickshell first, falls back to AGS + +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 +fi + +# If QS isn't running, try starting it and retry once +if command -v qs >/dev/null 2>&1; then + qs >/dev/null 2>&1 & + sleep 0.6 + if hyprctl dispatch global quickshell:overviewToggle >/dev/null 2>&1; then + exit 0 + fi +fi + +# 2) Fall back to AGS template +if command -v ags >/dev/null 2>&1; then + pkill rofi || true + if ags -t 'overview' >/dev/null 2>&1; then + exit 0 + fi + # If it failed, try starting AGS daemon then call the template + ags >/dev/null 2>&1 & + sleep 0.6 + if ags -t 'overview' >/dev/null 2>&1; then + exit 0 + fi +fi + +# If we get here, neither worked +notify-send "Overview" "Neither Quickshell nor AGS is available" -u low 2>/dev/null || true +exit 1 diff --git a/config/hypr/scripts/sddm_wallpaper.sh b/config/hypr/scripts/sddm_wallpaper.sh index 9dca2f72..9dca2f72 100644..100755 --- a/config/hypr/scripts/sddm_wallpaper.sh +++ b/config/hypr/scripts/sddm_wallpaper.sh |
