From 3d24339d942446dee504c3d6f2323c1dd32bd89b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 11 Feb 2026 11:39:41 -0600 Subject: feat(hyprland): add pyprland config and toggle-scratchpad to stow Scratchpads set to 50% width (music at 60%). Adds toggle-scratchpad utility for waybar click handling. --- dotfiles/hyprland/.config/hypr/pyprland.toml | 55 ++++++++++++++++++++++++++ dotfiles/hyprland/.local/bin/toggle-scratchpad | 40 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 dotfiles/hyprland/.config/hypr/pyprland.toml create mode 100755 dotfiles/hyprland/.local/bin/toggle-scratchpad (limited to 'dotfiles/hyprland') diff --git a/dotfiles/hyprland/.config/hypr/pyprland.toml b/dotfiles/hyprland/.config/hypr/pyprland.toml new file mode 100644 index 0000000..64f4948 --- /dev/null +++ b/dotfiles/hyprland/.config/hypr/pyprland.toml @@ -0,0 +1,55 @@ +# Pyprland Configuration +# https://hyprland-community.github.io/pyprland/ + +[pyprland] +plugins = [ + "scratchpads", + "magnify", +] + +# ============================================================================ +# Magnify +# ============================================================================ +[magnify] +factor = 2 + +# ============================================================================ +# Scratchpads +# ============================================================================ +# Scratchpads use normal workspaces by default (not special workspaces), +# which prevents newly launched apps from being captured by the scratchpad. + +[scratchpads.term] +command = "foot --app-id foot-term tmux" +class = "foot-term" +size = "50% 60%" +position = "25% 20%" +animation = "fromBottom" + +[scratchpads.term2] +command = "foot --app-id foot-term2 tmux" +class = "foot-term2" +size = "50% 60%" +position = "25% 30%" +animation = "fromBottom" + +[scratchpads.audio] +command = "foot --app-id foot-audio pulsemixer" +class = "foot-audio" +size = "50% 60%" +position = "25% 20%" +animation = "fromBottom" + +[scratchpads.monitor] +command = "foot --app-id foot-monitor monitor-dashboard" +class = "foot-monitor" +size = "50% 60%" +position = "25% 20%" +animation = "fromBottom" + +[scratchpads.music] +command = "foot --app-id foot-music ncmpcpp" +class = "foot-music" +size = "60% 60%" +position = "20% 20%" +animation = "fromBottom" diff --git a/dotfiles/hyprland/.local/bin/toggle-scratchpad b/dotfiles/hyprland/.local/bin/toggle-scratchpad new file mode 100755 index 0000000..b3da6b4 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/toggle-scratchpad @@ -0,0 +1,40 @@ +#!/bin/sh +# Toggle a special workspace from waybar click +# Tracks state to handle focus-loss auto-close issue +# Usage: toggle-scratchpad + +NAME="$1" +if [ -z "$NAME" ]; then + echo "Usage: toggle-scratchpad " + 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) + +# If state file exists and recent, scratchpad was open and just closed by focus loss +# Don't reopen it - user intended to close +if [ -f "$STATEFILE" ]; then + LAST=$(cat "$STATEFILE") + AGE=$((NOW - LAST)) + rm -f "$STATEFILE" + if [ "$AGE" -lt 2 ]; then + # Was just open, user clicked to close - don't reopen + exit 0 + fi +fi + +# Opening the scratchpad - mark timestamp +echo "$NOW" > "$STATEFILE" +hyprctl dispatch togglespecialworkspace "$NAME" -- cgit v1.2.3