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]
font=SF Pro Display:size=12,Symbols Nerd Font:size=12
prompt="> "
prompt=" "
width=50
lines=10
horizontal-pad=24

View file

@ -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 = "<b>%s</b>\\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;

View file

@ -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 >/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 >/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