summaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/hyprland/.local/bin')
-rwxr-xr-xdotfiles/hyprland/.local/bin/focus-restore9
-rwxr-xr-xdotfiles/hyprland/.local/bin/monitor-dashboard37
-rwxr-xr-xdotfiles/hyprland/.local/bin/start-hyprland11
-rwxr-xr-xdotfiles/hyprland/.local/bin/toggle-scratchpad11
-rwxr-xr-xdotfiles/hyprland/.local/bin/waybar-layout16
5 files changed, 76 insertions, 8 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/monitor-dashboard b/dotfiles/hyprland/.local/bin/monitor-dashboard
new file mode 100755
index 0000000..9236d20
--- /dev/null
+++ b/dotfiles/hyprland/.local/bin/monitor-dashboard
@@ -0,0 +1,37 @@
+#!/bin/sh
+# monitor-dashboard - tmux session with system monitoring tools
+# Each tool gets its own window for full screen real estate
+
+SESSION="monitor"
+
+# Check if system has a battery
+has_battery() {
+ [ -d /sys/class/power_supply/BAT0 ] || [ -d /sys/class/power_supply/BAT1 ]
+}
+
+# Attach to existing session or create new one
+if tmux has-session -t "$SESSION" 2>/dev/null; then
+ exec tmux attach-session -t "$SESSION"
+fi
+
+# Create new session with btop in first window
+tmux new-session -d -s "$SESSION" -n btop btop
+
+# Add windows for other monitoring tools (grouped logically)
+# CPU/GPU
+tmux new-window -t "$SESSION" -n s-tui s-tui
+tmux new-window -t "$SESSION" -n nvtop nvtop
+# Disk
+tmux new-window -t "$SESSION" -n duf "watch --color -n 60 duf"
+# Network
+tmux new-window -t "$SESSION" -n bandwhich "sudo bandwhich"
+tmux new-window -t "$SESSION" -n wavemon wavemon
+# Power (laptop only)
+if has_battery; then
+ tmux new-window -t "$SESSION" -n powertop "sudo powertop"
+fi
+
+# Start on btop window
+tmux select-window -t "$SESSION:btop"
+
+exec tmux attach-session -t "$SESSION"
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-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