From 80e65b1056952ad16af658dcbc8d890a56376b1a Mon Sep 17 00:00:00 2001 From: "Henry J. Webster" Date: Fri, 31 Jul 2026 11:30:51 -0500 Subject: (yambar) single-symbol rework with on-click details Collapse each module to one glyph and surface details on left-click via notify-send/mako (yambar has no hover support). Add CPU, GPU (amdgpu via gpu.sh), volume (pipewire), and a dynamic user@host label before the clock. on-click runs without a shell, so CPU temp is read by cpu-notify.sh which takes {cpu} as an argument. --- yambar/.config/yambar/config.yml | 90 ++++++++++++++++++++++++++++++------- yambar/.config/yambar/cpu-notify.sh | 11 +++++ yambar/.config/yambar/gpu.sh | 39 ++++++++++++++++ yambar/.config/yambar/userhost.sh | 6 +++ 4 files changed, 130 insertions(+), 16 deletions(-) create mode 100755 yambar/.config/yambar/cpu-notify.sh create mode 100755 yambar/.config/yambar/gpu.sh create mode 100755 yambar/.config/yambar/userhost.sh (limited to 'yambar/.config') diff --git a/yambar/.config/yambar/config.yml b/yambar/.config/yambar/config.yml index 679e935..be8f0b9 100644 --- a/yambar/.config/yambar/config.yml +++ b/yambar/.config/yambar/config.yml @@ -1,7 +1,7 @@ bar: location: bottom height: 48 - spacing: 10 + spacing: 14 margin: 40 foreground: ffffffff @@ -18,42 +18,100 @@ bar: poll-interval: 30000 content: map: + on-click: 'notify-send -h string:x-canonical-private-synchronous:yambar "Network" "{ssid} · {quality}% ({signal} dBm) · {ipv4}"' default: {empty: {}} conditions: name == "wlp1s0": map: - default: {string: {text: "offline"}} + default: {string: {text: "󰤮", foreground: ff5555ff}} conditions: - carrier: {string: {text: "\uf1eb {ssid}"}} - - label: - content: {string: {text: "|"}} + carrier: {string: {text: ""}} + - pipewire: + content: + map: + on-click: + left: 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle' + wheel-up: 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ -l 1.0' + wheel-down: 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-' + default: {empty: {}} + conditions: + type == "sink": + map: + default: + ramp: + tag: cubic_volume + items: + - string: {text: "󰕿"} + - string: {text: "󰖀"} + - string: {text: "󰕾"} + conditions: + muted: {string: {text: "󰝟", foreground: ff5555ff}} + - cpu: + poll-interval: 2000 + content: + map: + on-click: '~/.config/yambar/cpu-notify.sh {cpu}' + default: {empty: {}} + conditions: + id == -1: + map: + default: {string: {text: "󰻠"}} + conditions: + cpu > 85: {string: {text: "󰻠", foreground: ff5555ff}} + - script: + path: ~/.config/yambar/gpu.sh + content: + map: + on-click: 'notify-send -h string:x-canonical-private-synchronous:yambar "GPU" "{gpu_busy}% · {gpu_temp}°C · {vram_used} / {vram_total} MiB"' + default: {string: {text: "󰢮"}} + conditions: + gpu_busy > 85: {string: {text: "󰢮", foreground: ff5555ff}} - mem: poll-interval: 5000 content: map: - default: {string: {text: "\uefc5 {percent_used}%"}} + on-click: 'notify-send -h string:x-canonical-private-synchronous:yambar "Memory" "{percent_used}% used"' + default: {string: {text: ""}} conditions: - percent_used > 85: {string: {text: "\uefc5 {percent_used}%", foreground: ff5555ff}} - - label: - content: {string: {text: "|"}} + percent_used > 85: {string: {text: "", foreground: ff5555ff}} - script: path: ~/.config/yambar/disk.sh content: map: - default: {string: {text: "\uf0a0 {disk_avail}"}} + on-click: 'notify-send -h string:x-canonical-private-synchronous:yambar "Disk /" "{disk_avail} free · {disk_used}% used"' + default: {string: {text: ""}} conditions: - disk_used > 85: {string: {text: "\uf0a0 {disk_avail}", foreground: ff5555ff}} - - label: - content: {string: {text: "|"}} + disk_used > 85: {string: {text: "", foreground: ff5555ff}} - battery: name: BAT0 poll-interval: 30000 content: map: - default: {string: {text: "\uf240 {capacity}%"}} + on-click: 'notify-send -h string:x-canonical-private-synchronous:yambar "Battery" "{capacity}% ({state}) · {estimate}"' + default: + ramp: + tag: capacity + items: + - string: {text: "󰂎", foreground: ff5555ff} + - string: {text: "󰁺", foreground: ff5555ff} + - string: {text: "󰁻"} + - string: {text: "󰁼"} + - string: {text: "󰁽"} + - string: {text: "󰁾"} + - string: {text: "󰁿"} + - string: {text: "󰂀"} + - string: {text: "󰂁"} + - string: {text: "󰂂"} + - string: {text: "󰁹"} conditions: - state == "charging": {string: {text: "chr {capacity}%"}} - state == "full": {string: {text: "bat full"}} + state == "charging": {string: {text: "󰂄"}} + state == "full": {string: {text: "󰁹"}} + - label: + content: {string: {text: "|"}} + - script: + path: ~/.config/yambar/userhost.sh + content: + - string: {text: "{user}@{host}"} - label: content: {string: {text: "|"}} - clock: diff --git a/yambar/.config/yambar/cpu-notify.sh b/yambar/.config/yambar/cpu-notify.sh new file mode 100755 index 0000000..4a8be5b --- /dev/null +++ b/yambar/.config/yambar/cpu-notify.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# Shows a CPU notification: usage (passed as $1 by yambar) + k10temp package temp. +# yambar on-click is not run in a shell, so the tag/temp work happens here. +usage="${1:-?}" +temp="?" +for name in /sys/class/hwmon/hwmon*/name; do + [ "$(cat "$name" 2>/dev/null)" = k10temp ] || continue + t="$(dirname "$name")/temp1_input" + [ -r "$t" ] && temp=$(( $(cat "$t") / 1000 )) && break +done +notify-send -h string:x-canonical-private-synchronous:yambar "CPU" "${usage}% · ${temp}°C" diff --git a/yambar/.config/yambar/gpu.sh b/yambar/.config/yambar/gpu.sh new file mode 100755 index 0000000..53675fb --- /dev/null +++ b/yambar/.config/yambar/gpu.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Emits amdgpu usage/temp/VRAM as yambar tags (continuous mode). +# gpu_busy: utilisation, percent (range, for conditional styling) +# gpu_temp: die temperature, whole degrees C +# vram_used: VRAM in use, MiB +# vram_total: total VRAM, MiB + +# Locate the amdgpu card (card0/card1/... varies per machine). +dev="" +for busy in /sys/class/drm/card*/device/gpu_busy_percent; do + [ -r "$busy" ] || continue + dev=$(dirname "$busy") + break +done + +while true; do + if [ -n "$dev" ]; then + busy=$(cat "$dev/gpu_busy_percent" 2>/dev/null || echo 0) + + temp_input=$(find "$dev/hwmon/hwmon"*/ -name temp1_input 2>/dev/null | head -n1) + if [ -n "$temp_input" ]; then + temp=$(( $(cat "$temp_input") / 1000 )) + else + temp="?" + fi + + vram_used=$(( $(cat "$dev/mem_info_vram_used" 2>/dev/null || echo 0) / 1048576 )) + vram_total=$(( $(cat "$dev/mem_info_vram_total" 2>/dev/null || echo 0) / 1048576 )) + else + busy=0; temp="?"; vram_used=0; vram_total=0 + fi + + echo "gpu_busy|range:0-100|$busy" + echo "gpu_temp|string|$temp" + echo "vram_used|string|$vram_used" + echo "vram_total|string|$vram_total" + echo "" + sleep 5 +done diff --git a/yambar/.config/yambar/userhost.sh b/yambar/.config/yambar/userhost.sh new file mode 100755 index 0000000..3f8d02f --- /dev/null +++ b/yambar/.config/yambar/userhost.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Emits user@host as yambar tags. Values are static, so emit once and idle. +printf 'user|string|%s\n' "$(id -un)" +printf 'host|string|%s\n' "$(uname -n)" +printf '\n' +while true; do sleep 86400; done -- cgit v1.3