feat(waybar): clicking

This commit is contained in:
Barrett Ruth 2026-02-14 16:18:55 -05:00
parent f1015c40c4
commit 79202e1f20
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
3 changed files with 58 additions and 13 deletions

View file

@ -2,7 +2,7 @@ include=~/.config/fuzzel/themes/theme.ini
[main] [main]
font=SF Pro Display:size=12,Symbols Nerd Font:size=12 font=SF Pro Display:size=12,Symbols Nerd Font:size=12
prompt="> " prompt=" "
width=50 width=50
lines=10 lines=10
horizontal-pad=24 horizontal-pad=24

View file

@ -85,6 +85,7 @@ in
"network" "network"
"battery" "battery"
"clock" "clock"
"custom/power"
]; ];
"hyprland/workspaces" = { "hyprland/workspaces" = {
@ -99,6 +100,7 @@ in
format-en = "en"; format-en = "en";
format-en-colemak = "cmk"; format-en-colemak = "cmk";
tooltip-format = "{long}"; tooltip-format = "{long}";
on-click = "ctl keyboard toggle";
}; };
privacy = { privacy = {
@ -110,6 +112,7 @@ in
icon-size = 16; icon-size = 16;
spacing = 8; spacing = 8;
tooltip = true; tooltip = true;
show-passive-items = true;
}; };
"hyprland/window" = { "hyprland/window" = {
@ -130,6 +133,9 @@ in
}; };
signal = 1; signal = 1;
tooltip-format = "{desc}"; tooltip-format = "{desc}";
on-click = "pamixer -t";
on-scroll-up = "pamixer -i 5";
on-scroll-down = "pamixer -d 5";
}; };
network = { network = {
@ -140,6 +146,7 @@ in
interval = 10; interval = 10;
tooltip-format-wifi = "{signalStrength}% · {ipaddr}"; tooltip-format-wifi = "{signalStrength}% · {ipaddr}";
tooltip-format-ethernet = "{ipaddr}/{cidr}"; tooltip-format-ethernet = "{ipaddr}/{cidr}";
on-click = "ctl audio out";
}; };
battery = { battery = {
@ -181,6 +188,13 @@ in
interval = 1; interval = 1;
tooltip-format = "{:%A, %d %B %Y\nTimezone: %Z}"; tooltip-format = "{:%A, %d %B %Y\nTimezone: %Z}";
}; };
"custom/power" = {
format = "";
tooltip = true;
tooltip-format = "power menu";
on-click = "ctl power";
};
}; };
style = '' style = ''
@ -195,6 +209,7 @@ in
} }
#workspaces button { #workspaces button {
font-family: "SF Pro Display", sans-serif;
padding: 0 10px; padding: 0 10px;
min-width: 24px; min-width: 24px;
background: transparent; background: transparent;
@ -212,7 +227,8 @@ in
#pulseaudio, #pulseaudio,
#network, #network,
#battery, #battery,
#clock { #clock,
#custom-power {
padding: 0 10px; padding: 0 10px;
} }
@ -230,29 +246,42 @@ in
enable = true; enable = true;
settings = { settings = {
global = { global = {
font = "SF Pro Display 15"; font = "SF Pro Display 13";
frame_color = c.fgAlt; 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_color = "frame";
separator_height = 1;
gap_size = 8;
corner_radius = 0;
background = c.bg; background = c.bg;
foreground = c.fg; foreground = c.fg;
alignment = "left";
ellipsize = "end";
icon_position = "left";
max_icon_size = 32;
format = "<b>%s</b>\\n%b";
}; };
urgency_low = { urgency_low = {
background = c.bg; background = c.bg;
foreground = c.blue; foreground = c.fg;
frame_color = c.blue; frame_color = c.border;
}; };
urgency_normal = { urgency_normal = {
background = c.bg; background = c.bg;
foreground = c.fg; foreground = c.fg;
frame_color = c.border;
}; };
urgency_critical = { urgency_critical = {
background = c.bg; background = c.bg;
foreground = c.red; foreground = c.red;
frame_color = c.red; frame_color = c.red;
}; };
experimental = {
per_monitor_dpi = true;
};
}; };
}; };
xdg.configFile."waybar/themes/midnight.css".text = mkWaybarTheme config.palettes.midnight; xdg.configFile."waybar/themes/midnight.css".text = mkWaybarTheme config.palettes.midnight;

View file

@ -16,7 +16,7 @@ screenshot)
file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png" file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png"
if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
require grim slurp wl-copy require grim slurp wl-copy
grim -g "$(slurp)" "$file" && wl-copy < "$file" grim -g "$(slurp)" "$file" && wl-copy <"$file"
else else
require maim xclip require maim xclip
maim -s "$file" && xclip -selection clipboard -t image/png -i "$file" & maim -s "$file" && xclip -selection clipboard -t image/png -i "$file" &
@ -33,13 +33,13 @@ ocr)
region="$(slurp)" region="$(slurp)"
[ -n "$region" ] || exit 0 [ -n "$region" ] || exit 0
grim -g "$region" "$file" && grim -g "$region" "$file" &&
tesseract -l eng "$file" - 2>/dev/null | wl-copy tesseract -l eng "$file" - 2>/dev/null | wl-copy
) </dev/null >/dev/null 2>&1 & ) </dev/null >/dev/null 2>&1 &
else else
require maim xclip require maim xclip
( (
maim -s "$file" && 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 >/dev/null 2>&1 & ) </dev/null >/dev/null 2>&1 &
fi fi
;; ;;
@ -100,8 +100,24 @@ audio)
;; ;;
esac 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 exit 1
;; ;;
esac esac