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",
"power-profiles-daemon",
"cpu",
//"memory",
"custom/memtmp",
//"temperature",
"backlight",
//"sway/language",
@@ -169,6 +169,13 @@
"tooltip": false,
"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": {
"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";
* {
font-family: 'JetBrainsMono';
font-family: 'JetBrainsMono Nerd Font';
font-size: 13px;
}
@@ -89,6 +89,7 @@ button:hover {
#battery,
#cpu,
#memory,
#custom-memtmp,
#disk,
#temperature,
#backlight,