From 79202e1f205fb532027d98b67222f014daa98171 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 14 Feb 2026 16:18:55 -0500 Subject: [PATCH] feat(waybar): clicking --- config/fuzzel/fuzzel.ini | 2 +- home/modules/ui.nix | 45 +++++++++++++++++++++++++++++++++------- scripts/ctl | 24 +++++++++++++++++---- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/config/fuzzel/fuzzel.ini b/config/fuzzel/fuzzel.ini index 3a6385f..52678bc 100644 --- a/config/fuzzel/fuzzel.ini +++ b/config/fuzzel/fuzzel.ini @@ -2,7 +2,7 @@ include=~/.config/fuzzel/themes/theme.ini [main] font=SF Pro Display:size=12,Symbols Nerd Font:size=12 -prompt="> " +prompt=" " width=50 lines=10 horizontal-pad=24 diff --git a/home/modules/ui.nix b/home/modules/ui.nix index 0eb8e92..5a005ee 100644 --- a/home/modules/ui.nix +++ b/home/modules/ui.nix @@ -85,6 +85,7 @@ in "network" "battery" "clock" + "custom/power" ]; "hyprland/workspaces" = { @@ -99,6 +100,7 @@ in format-en = "en"; format-en-colemak = "cmk"; tooltip-format = "{long}"; + on-click = "ctl keyboard toggle"; }; privacy = { @@ -110,6 +112,7 @@ in icon-size = 16; spacing = 8; tooltip = true; + show-passive-items = true; }; "hyprland/window" = { @@ -130,6 +133,9 @@ in }; signal = 1; tooltip-format = "{desc}"; + on-click = "pamixer -t"; + on-scroll-up = "pamixer -i 5"; + on-scroll-down = "pamixer -d 5"; }; network = { @@ -140,6 +146,7 @@ in interval = 10; tooltip-format-wifi = "{signalStrength}% · {ipaddr}"; tooltip-format-ethernet = "{ipaddr}/{cidr}"; + on-click = "ctl audio out"; }; battery = { @@ -181,6 +188,13 @@ in interval = 1; tooltip-format = "{:%A, %d %B %Y\nTimezone: %Z}"; }; + + "custom/power" = { + format = "⏻"; + tooltip = true; + tooltip-format = "power menu"; + on-click = "ctl power"; + }; }; style = '' @@ -195,6 +209,7 @@ in } #workspaces button { + font-family: "SF Pro Display", sans-serif; padding: 0 10px; min-width: 24px; background: transparent; @@ -212,7 +227,8 @@ in #pulseaudio, #network, #battery, - #clock { + #clock, + #custom-power { padding: 0 10px; } @@ -230,29 +246,42 @@ in enable = true; settings = { global = { - font = "SF Pro Display 15"; - frame_color = c.fgAlt; + font = "SF Pro Display 13"; + width = "(0, 400)"; + height = "(0, 120)"; + origin = "top-right"; + offset = "16x16"; + padding = 16; + horizontal_padding = 20; + frame_width = 1; + frame_color = c.border; separator_color = "frame"; + separator_height = 1; + gap_size = 8; + corner_radius = 0; background = c.bg; foreground = c.fg; + alignment = "left"; + ellipsize = "end"; + icon_position = "left"; + max_icon_size = 32; + format = "%s\\n%b"; }; urgency_low = { background = c.bg; - foreground = c.blue; - frame_color = c.blue; + foreground = c.fg; + frame_color = c.border; }; urgency_normal = { background = c.bg; foreground = c.fg; + frame_color = c.border; }; urgency_critical = { background = c.bg; foreground = c.red; frame_color = c.red; }; - experimental = { - per_monitor_dpi = true; - }; }; }; xdg.configFile."waybar/themes/midnight.css".text = mkWaybarTheme config.palettes.midnight; diff --git a/scripts/ctl b/scripts/ctl index 46926fc..2ca221e 100755 --- a/scripts/ctl +++ b/scripts/ctl @@ -16,7 +16,7 @@ screenshot) file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png" if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then require grim slurp wl-copy - grim -g "$(slurp)" "$file" && wl-copy < "$file" + grim -g "$(slurp)" "$file" && wl-copy <"$file" else require maim xclip maim -s "$file" && xclip -selection clipboard -t image/png -i "$file" & @@ -33,13 +33,13 @@ ocr) region="$(slurp)" [ -n "$region" ] || exit 0 grim -g "$region" "$file" && - tesseract -l eng "$file" - 2>/dev/null | wl-copy + tesseract -l eng "$file" - 2>/dev/null | wl-copy ) /dev/null 2>&1 & else require maim xclip ( maim -s "$file" && - tesseract -l eng "$file" - 2>/dev/null | xclip -selection clipboard -in + tesseract -l eng "$file" - 2>/dev/null | xclip -selection clipboard -in ) /dev/null 2>&1 & fi ;; @@ -100,8 +100,24 @@ audio) ;; esac ;; +power) + require fuzzel + lock="󰌾 Lock" + suspend="󰒲 Suspend" + logout="󰍃 Logout" + reboot="󰜉 Reboot" + shutdown="󰐥 Shutdown" + chosen="$(printf '%s\n' "$lock" "$suspend" "$logout" "$reboot" "$shutdown" | fuzzel --dmenu --hide-prompt --lines=5 --width=20 --no-icons)" + case "$chosen" in + "$lock") hyprlock ;; + "$suspend") systemctl suspend ;; + "$logout") hyprctl dispatch exit ;; + "$reboot") systemctl reboot ;; + "$shutdown") systemctl poweroff ;; + esac + ;; *) - echo "Usage: ctl {screenshot|ocr|keyboard|audio}" >&2 + echo "Usage: ctl {screenshot|ocr|keyboard|audio|power}" >&2 exit 1 ;; esac