From 18d425813f7c54e11a0bfda6c41deec00bc4b930 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 14 Feb 2026 17:48:50 -0500 Subject: [PATCH] feat(waybar): more tooltips --- config/hypr/hyprland.conf | 8 +++---- home/modules/ui.nix | 4 +++- scripts/ctl | 50 ++++++++++++++++++++++++++++----------- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 37a7e59..7af6833 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -46,8 +46,8 @@ animations { } input { - kb_layout = us,us - kb_variant = ,colemak + kb_layout = us,us,us + kb_variant = ,dvorak,colemak follow_mouse = 1 sensitivity = 0 touchpad { @@ -104,8 +104,8 @@ bind = , XF86Tools, submap, scripts submap = scripts bind = , A, exec, ctl audio out -bind = , C, exec, sh -lc 'cliphist list | fuzzel --dmenu --prompt="clip: " | cliphist decode | wl-copy' -bind = , K, exec, ctl keyboard toggle +bind = , C, exec, sh -lc 'cliphist list | fuzzel --dmenu --prompt="clip: " | cliphist decode | wl-copy' +bind = , K, exec, ctl keyboard next bind = , O, exec, ctl ocr bind = , P, exec, hypr pull bind = , S, exec, ctl screenshot diff --git a/home/modules/ui.nix b/home/modules/ui.nix index 4738447..5dd1ab4 100644 --- a/home/modules/ui.nix +++ b/home/modules/ui.nix @@ -100,7 +100,7 @@ in format = "󰌌"; tooltip = true; tooltip-format = "Keyboard Layout: {long}"; - on-click = "ctl keyboard toggle"; + on-click = "ctl keyboard next"; on-click-right = "ctl keyboard pick"; }; @@ -152,6 +152,7 @@ in tooltip-format-ethernet = "{ifname} · {ipaddr}"; tooltip-format-disconnected = "disconnected"; on-click = "rfkill toggle wifi"; + on-click-right = "ctl wifi pick"; }; battery = { @@ -282,6 +283,7 @@ in ctl = { appname = "ctl"; icon_position = "off"; + horizontal_padding = 28; }; }; }; diff --git a/scripts/ctl b/scripts/ctl index ff8ec16..a3ca62e 100755 --- a/scripts/ctl +++ b/scripts/ctl @@ -45,24 +45,20 @@ ocr) ;; keyboard) case "$2" in - toggle) + next) if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ]; then hyprctl switchxkblayout current next elif [ "$XDG_CURRENT_DESKTOP" = "sway" ]; then - if swaymsg -t get_inputs | grep -qi "Colemak"; then - swaymsg input type:keyboard xkb_variant "''" - else - swaymsg input type:keyboard xkb_variant colemak - fi + swaymsg input type:keyboard xkb_switch_layout next fi else current="$(setxkbmap -query | awk '/variant/{print $2}')" - if [ "$current" = "colemak" ]; then - setxkbmap -layout us - else - setxkbmap -layout us -variant colemak - fi + case "$current" in + "") setxkbmap -layout us -variant dvorak ;; + dvorak) setxkbmap -layout us -variant colemak ;; + *) setxkbmap -layout us ;; + esac fi ;; pick) @@ -75,13 +71,13 @@ keyboard) Colemak) variant="colemak" ;; esac if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ]; then - hyprctl keyword input:kb_layout "us,us" + hyprctl keyword input:kb_layout "us,us,us" hyprctl keyword input:kb_variant ",$variant" hyprctl switchxkblayout current 1 fi ;; *) - echo "Usage: ctl keyboard {toggle|pick}" >&2 + echo "Usage: ctl keyboard {next|pick}" >&2 exit 1 ;; esac @@ -159,6 +155,32 @@ volume) fi notify-send -a ctl -t 2500 -r 5556 "$icon $bar" ;; +wifi) + case "$2" in + pick) + require fuzzel + station=$(iwctl device list 2>/dev/null | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | awk '/station/{print $1}') + [ -z "$station" ] && { echo "ctl: no wifi device found" >&2; exit 1; } + iwctl station "$station" scan 2>/dev/null + sleep 1 + networks=$(iwctl station "$station" get-networks 2>/dev/null | \ + sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | \ + awk 'NR>4 && /\S/' | \ + sed 's/^[[:space:]>]*//' | \ + sed 's/[[:space:]]\{3,\}.*//' | \ + sed 's/[[:space:]]*$//' | \ + grep -v '^-') + [ -z "$networks" ] && exit 0 + ssid=$(printf '%s\n' "$networks" | fuzzel --dmenu --prompt="wifi: " --no-icons) + [ -z "$ssid" ] && exit 0 + iwctl station "$station" connect "$ssid" + ;; + *) + echo "Usage: ctl wifi {pick}" >&2 + exit 1 + ;; + esac + ;; power) require fuzzel lock="󰌾 Lock" @@ -176,7 +198,7 @@ power) esac ;; *) - echo "Usage: ctl {screenshot|ocr|keyboard|audio|brightness|volume|power}" >&2 + echo "Usage: ctl {screenshot|ocr|keyboard|audio|wifi|brightness|volume|power}" >&2 exit 1 ;; esac