diff options
Diffstat (limited to 'dotfiles/hyprland/.local/bin')
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/focus-restore | 9 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/pinentry-fuzzel | 2 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/screenshot | 23 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/set-theme | 18 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/start-hyprland | 11 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/toggle-scratchpad | 11 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-disk | 7 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-layout | 16 | ||||
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-netspeed | 2 |
9 files changed, 85 insertions, 14 deletions
diff --git a/dotfiles/hyprland/.local/bin/focus-restore b/dotfiles/hyprland/.local/bin/focus-restore new file mode 100755 index 0000000..7f87390 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/focus-restore @@ -0,0 +1,9 @@ +#!/bin/sh +# Restore unfocused windows from workspace 10 without disrupting master position. +# Records the focused window, brings all back, then swaps it back to master. + +FOCUSED=$(hyprctl activewindow -j | jq -r '.address') +hyprctl dispatch plugin:xtd:bringallfrom 10 +sleep 0.1 +hyprctl dispatch focuswindow "address:$FOCUSED" +hyprctl dispatch layoutmsg swapwithmaster master diff --git a/dotfiles/hyprland/.local/bin/pinentry-fuzzel b/dotfiles/hyprland/.local/bin/pinentry-fuzzel index 4cbe6b7..5c64968 100755 --- a/dotfiles/hyprland/.local/bin/pinentry-fuzzel +++ b/dotfiles/hyprland/.local/bin/pinentry-fuzzel @@ -83,7 +83,7 @@ while read cmd rest; do else LABEL="reenter: " fi - PASS=$(fuzzel --prompt "$LABEL" --width 25 --lines 0 --cache /dev/null --password --dmenu) + PASS=$(fuzzel --prompt "$LABEL" --width 35 --lines 0 --cache /dev/null --password --dmenu --border-color=d47c59ff) if [ -z "$PASS" ]; then # User cancelled - return error to GPG rm -f "$LASTFILE" diff --git a/dotfiles/hyprland/.local/bin/screenshot b/dotfiles/hyprland/.local/bin/screenshot new file mode 100755 index 0000000..45925c6 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/screenshot @@ -0,0 +1,23 @@ +#!/bin/sh +# Screenshot tool with fuzzel menu +# Usage: screenshot [region|fullscreen] + +DIR="$HOME/pictures/screenshots" +mkdir -p "$DIR" +FILE="$DIR/$(date +%Y-%m-%d_%H%M%S).png" + +# Capture +case "${1:-region}" in + region) grim -g "$(slurp)" "$FILE" || exit 1 ;; + fullscreen) grim "$FILE" || exit 1 ;; +esac + +# Menu +CHOICE=$(printf ' Copy Path\n Copy Image\n Annotate' | \ + fuzzel --dmenu --prompt "Screenshot: " --width 20 --lines 3) + +case "$CHOICE" in + *"Copy Path"*) echo -n "$FILE" | wl-copy --type text/plain ;; + *"Copy Image"*) wl-copy --type image/png < "$FILE" ;; + *"Annotate"*) satty --filename "$FILE" --output-filename "$FILE" --copy-command wl-copy ;; +esac diff --git a/dotfiles/hyprland/.local/bin/set-theme b/dotfiles/hyprland/.local/bin/set-theme index e95b27b..9bbcbd4 100755 --- a/dotfiles/hyprland/.local/bin/set-theme +++ b/dotfiles/hyprland/.local/bin/set-theme @@ -56,8 +56,13 @@ apply_theme() { # hy3 tab bar (monocle mode) hyprctl keyword plugin:hy3:tabs:col.active "rgba(474544ff)" hyprctl keyword plugin:hy3:tabs:col.active.text "rgba(969385ff)" - hyprctl keyword plugin:hy3:tabs:col.inactive "rgba(d0cbc0ff)" - hyprctl keyword plugin:hy3:tabs:col.inactive.text "rgba(d0cbc0ff)" + hyprctl keyword plugin:hy3:tabs:col.active.border "rgba(d7af5fff)" + hyprctl keyword plugin:hy3:tabs:col.focused "rgba(474544ff)" + hyprctl keyword plugin:hy3:tabs:col.focused.text "rgba(969385ff)" + hyprctl keyword plugin:hy3:tabs:col.focused.border "rgba(d7af5fff)" + hyprctl keyword plugin:hy3:tabs:col.inactive "rgba(2a2725ff)" + hyprctl keyword plugin:hy3:tabs:col.inactive.text "rgba(6c6a60ff)" + hyprctl keyword plugin:hy3:tabs:col.inactive.border "rgba(2a2725ff)" hyprctl keyword plugin:hy3:tabs:col.urgent "rgba(d47c59ff)" hyprctl keyword plugin:hy3:tabs:col.locked "rgba(8a9496ff)" ;; @@ -68,8 +73,13 @@ apply_theme() { # hy3 tab bar (monocle mode) hyprctl keyword plugin:hy3:tabs:col.active "rgba(444444ff)" hyprctl keyword plugin:hy3:tabs:col.active.text "rgba(bbbbbbff)" - hyprctl keyword plugin:hy3:tabs:col.inactive "rgba(c5c8c6ff)" - hyprctl keyword plugin:hy3:tabs:col.inactive.text "rgba(c5c8c6ff)" + hyprctl keyword plugin:hy3:tabs:col.active.border "rgba(daa520ff)" + hyprctl keyword plugin:hy3:tabs:col.focused "rgba(444444ff)" + hyprctl keyword plugin:hy3:tabs:col.focused.text "rgba(bbbbbbff)" + hyprctl keyword plugin:hy3:tabs:col.focused.border "rgba(daa520ff)" + hyprctl keyword plugin:hy3:tabs:col.inactive "rgba(333333ff)" + hyprctl keyword plugin:hy3:tabs:col.inactive.text "rgba(888888ff)" + hyprctl keyword plugin:hy3:tabs:col.inactive.border "rgba(333333ff)" hyprctl keyword plugin:hy3:tabs:col.urgent "rgba(cc6666ff)" hyprctl keyword plugin:hy3:tabs:col.locked "rgba(8abeb7ff)" ;; diff --git a/dotfiles/hyprland/.local/bin/start-hyprland b/dotfiles/hyprland/.local/bin/start-hyprland new file mode 100755 index 0000000..a5d191d --- /dev/null +++ b/dotfiles/hyprland/.local/bin/start-hyprland @@ -0,0 +1,11 @@ +#!/bin/sh +# Wrapper to launch Hyprland with persistent logging +# Shadows /usr/bin/start-hyprland when ~/.local/bin is in PATH + +LOG_DIR="$HOME/.local/var/log" +TIMESTAMP=$(date +%Y-%m-%d-%H%M%S) +LOG_FILE="$LOG_DIR/hyprland-$TIMESTAMP.log" + +mkdir -p "$LOG_DIR" + +exec /usr/bin/start-hyprland "$@" > "$LOG_FILE" 2>&1 diff --git a/dotfiles/hyprland/.local/bin/toggle-scratchpad b/dotfiles/hyprland/.local/bin/toggle-scratchpad index bb10ef7..b3da6b4 100755 --- a/dotfiles/hyprland/.local/bin/toggle-scratchpad +++ b/dotfiles/hyprland/.local/bin/toggle-scratchpad @@ -9,6 +9,17 @@ if [ -z "$NAME" ]; then exit 1 fi +# Auto-detect current Hyprland socket if env var is stale +if ! hyprctl version >/dev/null 2>&1; then + # Find the most recent Hyprland instance with a socket + for dir in /run/user/"$(id -u)"/hypr/*/; do + if [ -S "${dir}.socket.sock" ]; then + export HYPRLAND_INSTANCE_SIGNATURE="$(basename "$dir")" + break + fi + done +fi + STATEFILE="/tmp/scratchpad-$NAME-open" NOW=$(date +%s) diff --git a/dotfiles/hyprland/.local/bin/waybar-disk b/dotfiles/hyprland/.local/bin/waybar-disk new file mode 100755 index 0000000..6050653 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/waybar-disk @@ -0,0 +1,7 @@ +#!/bin/sh +# Waybar disk usage module with warning/critical states +PCT=$(df --output=pcent / | tail -1 | tr -d ' %') +CLASS="" +[ "$PCT" -ge 80 ] && CLASS="warning" +[ "$PCT" -ge 90 ] && CLASS="critical" +printf '{"text": "%s%%", "class": "%s", "tooltip": "Root: %s%% used"}\n' "$PCT" "$CLASS" "$PCT" diff --git a/dotfiles/hyprland/.local/bin/waybar-layout b/dotfiles/hyprland/.local/bin/waybar-layout index 6c45877..62470aa 100755 --- a/dotfiles/hyprland/.local/bin/waybar-layout +++ b/dotfiles/hyprland/.local/bin/waybar-layout @@ -3,17 +3,17 @@ # Shows current layout with nerd font icons # Layouts: master -> tab group (monocle) -> scrolling -> floating -# Get current layout -LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str') - -# Check if workspace has allfloat enabled -ALLFLOAT=$(hyprctl activeworkspace -j | jq -r '.hasfullscreenwindow') +# Check if hyprctl is reachable +if ! hyprctl version >/dev/null 2>&1; then + echo '{"text": "<span size='"'"'large'"'"'></span>", "tooltip": "Hyprland not connected"}' + exit 0 +fi -# Check if active window is floating -FLOATING=$(hyprctl activewindow -j 2>/dev/null | jq -r '.floating // false') +# Get current layout (redirect stderr to suppress connection errors) +LAYOUT=$(hyprctl getoption general:layout -j 2>/dev/null | jq -r '.str // "unknown"') # Check workspace rules for allfloat -WSRULES=$(hyprctl activeworkspace -j | jq -r '.rules // []') +WSRULES=$(hyprctl activeworkspace -j 2>/dev/null | jq -r '.rules // []') # Determine icon and tooltip if [ "$LAYOUT" = "master" ] && echo "$WSRULES" | grep -q "allfloat"; then diff --git a/dotfiles/hyprland/.local/bin/waybar-netspeed b/dotfiles/hyprland/.local/bin/waybar-netspeed index 97e8e5e..a6296b0 100755 --- a/dotfiles/hyprland/.local/bin/waybar-netspeed +++ b/dotfiles/hyprland/.local/bin/waybar-netspeed @@ -6,7 +6,7 @@ INTERFACE=$(ip route | awk '/default/ {print $5; exit}') if [ -z "$INTERFACE" ]; then - echo '{"text": " Disconnected", "tooltip": "No network connection", "class": "disconnected"}' + echo '{"text": " Offline", "tooltip": "No network connection", "class": "disconnected"}' exit 0 fi |
