Compare commits

...
1 Commits
Author SHA1 Message Date
tgrosinger 1b4bfa3e7e Waybar: add new memory widget 2026-09-15 13:38:26 -07:00
3 changed files with 27 additions and 2 deletions
+8 -1
View File
@@ -23,7 +23,7 @@
"network", "network",
"power-profiles-daemon", "power-profiles-daemon",
"cpu", "cpu",
//"memory", "custom/memtmp",
//"temperature", //"temperature",
"backlight", "backlight",
//"sway/language", //"sway/language",
@@ -169,6 +169,13 @@
"tooltip": false, "tooltip": false,
"on-click": "alacritty -e /home/tgrosinger/.local/share/mise/shims/btop" "on-click": "alacritty -e /home/tgrosinger/.local/share/mise/shims/btop"
}, },
"custom/memtmp": {
"exec": "bash $HOME/.config/waybar/memtmp.sh",
"return-type": "json",
"interval": 5,
"format": "{}",
"on-click": "alacritty -e /home/tgrosinger/.local/share/mise/shims/btop"
},
"memory": { "memory": {
"format": "{}% " "format": "{}% "
}, },
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Waybar custom module: available RAM (GiB) and current /tmp usage.
#
# Available RAM uses MemAvailable, the kernel's honest "allocatable without
# swapping" figure. /tmp is tmpfs, so its used space is live RAM consumption;
# df -h auto-scales the unit (it is usually in the MB range).
set -euo pipefail
MEM_ICON=$''
TMP_ICON=$''
avail_gib=$(awk '/^MemAvailable:/ {printf "%.1f", $2/1048576}' /proc/meminfo)
read -r tmp_used tmp_size < <(df -h --output=used,size /tmp | awk 'NR==2 {print $1, $2}')
printf '{"text":"%sG %s %s %s","tooltip":"RAM available: %s GiB\\n/tmp used: %s of %s"}\n' \
"$avail_gib" "$MEM_ICON" "$tmp_used" "$TMP_ICON" \
"$avail_gib" "$tmp_used" "$tmp_size"
+2 -1
View File
@@ -1,7 +1,7 @@
@import "latte.css"; @import "latte.css";
* { * {
font-family: 'JetBrainsMono'; font-family: 'JetBrainsMono Nerd Font';
font-size: 13px; font-size: 13px;
} }
@@ -89,6 +89,7 @@ button:hover {
#battery, #battery,
#cpu, #cpu,
#memory, #memory,
#custom-memtmp,
#disk, #disk,
#temperature, #temperature,
#backlight, #backlight,