update settings
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
"custom/mount-data",
|
"custom/mount-data",
|
||||||
"custom/mount-usb1",
|
"custom/mount-usb1",
|
||||||
"cpu",
|
"cpu",
|
||||||
"memory",
|
|
||||||
"tray"
|
"tray"
|
||||||
],
|
],
|
||||||
"hyprland/workspaces": {
|
"hyprland/workspaces": {
|
||||||
@@ -46,11 +45,10 @@
|
|||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
"format": " {usage}%",
|
"format": " {usage}%",
|
||||||
"tooltip": false
|
"tooltip": false,
|
||||||
},
|
"on-click": "alacritty -e btop"
|
||||||
"memory": {
|
|
||||||
"format": " {}%"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"custom/mount-data": {
|
"custom/mount-data": {
|
||||||
"exec": "$HOME/.config/waybar/scripts/check-mount.sh /mnt/data data",
|
"exec": "$HOME/.config/waybar/scripts/check-mount.sh /mnt/data data",
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
|
|||||||
53
.config/waybar/scripts/mem-swap.sh
Executable file
53
.config/waybar/scripts/mem-swap.sh
Executable file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
mode="${1:-status}"
|
||||||
|
|
||||||
|
read -r mem_total mem_used swap_total swap_used <<EOF
|
||||||
|
$(free -b | awk '
|
||||||
|
/^Mem:/ { mem_total=$2; mem_used=$3 }
|
||||||
|
/^Swap:/ { swap_total=$2; swap_used=$3 }
|
||||||
|
END { printf "%s %s %s %s\n", mem_total, mem_used, swap_total, swap_used }
|
||||||
|
')
|
||||||
|
EOF
|
||||||
|
|
||||||
|
format_bytes() {
|
||||||
|
numfmt --to=iec-i --suffix=B --format='%.1f' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_used_h="$(format_bytes "$mem_used")"
|
||||||
|
mem_total_h="$(format_bytes "$mem_total")"
|
||||||
|
mem_pct="$(awk -v used="$mem_used" -v total="$mem_total" 'BEGIN { if (total > 0) printf "%.1f", (used/total)*100; else print "0.0" }')"
|
||||||
|
|
||||||
|
if [[ "$swap_total" -gt 0 ]]; then
|
||||||
|
swap_used_h="$(format_bytes "$swap_used")"
|
||||||
|
swap_total_h="$(format_bytes "$swap_total")"
|
||||||
|
swap_pct="$(awk -v used="$swap_used" -v total="$swap_total" 'BEGIN { if (total > 0) printf "%.1f", (used/total)*100; else print "0.0" }')"
|
||||||
|
else
|
||||||
|
swap_used_h="0.0B"
|
||||||
|
swap_total_h="0.0B"
|
||||||
|
swap_pct="0.0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$mode" in
|
||||||
|
ram)
|
||||||
|
notify-send "RAM usage" "${mem_used_h} / ${mem_total_h} (${mem_pct}%)"
|
||||||
|
;;
|
||||||
|
swap)
|
||||||
|
if [[ "$swap_total" -gt 0 ]]; then
|
||||||
|
notify-send "Swap usage" "${swap_used_h} / ${swap_total_h} (${swap_pct}%)"
|
||||||
|
else
|
||||||
|
notify-send "Swap usage" "Swap is disabled"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
if [[ "$swap_total" -gt 0 ]]; then
|
||||||
|
tooltip="Left click: RAM (${mem_used_h}/${mem_total_h}, ${mem_pct}%)\nRight click: Swap (${swap_used_h}/${swap_total_h}, ${swap_pct}%)"
|
||||||
|
else
|
||||||
|
tooltip="Left click: RAM (${mem_used_h}/${mem_total_h}, ${mem_pct}%)\nRight click: Swap (disabled)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '{"text":"","tooltip":"%s"}\n' "$tooltip"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -1,37 +1,109 @@
|
|||||||
@import url("/etc/xdg/waybar/style.css");
|
* {
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-family: "SauceCodePro Nerd Font", "SauceCodePro Nerd Font Mono", "Symbols Nerd Font Mono", "Symbols Nerd Font", "Font Awesome 7 Free", sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
window#waybar {
|
||||||
|
background: alpha(#2e3440, 0.92);
|
||||||
|
color: #eceff4;
|
||||||
|
border-bottom: 2px solid alpha(#5e81ac, 0.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
tooltip {
|
||||||
|
background: #3b4252;
|
||||||
|
color: #eceff4;
|
||||||
|
border: 1px solid #4c566a;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces {
|
||||||
|
background: alpha(#3b4252, 0.88);
|
||||||
|
padding: 2px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button {
|
||||||
|
color: #d8dee9;
|
||||||
|
background: transparent;
|
||||||
|
padding: 2px 10px;
|
||||||
|
margin: 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button:hover {
|
||||||
|
background: alpha(#4c566a, 0.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button.active {
|
||||||
|
color: #2e3440;
|
||||||
|
background: #88c0d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button.urgent {
|
||||||
|
color: #eceff4;
|
||||||
|
background: #bf616a;
|
||||||
|
}
|
||||||
|
|
||||||
|
#window,
|
||||||
|
#clock,
|
||||||
#custom-screenshot,
|
#custom-screenshot,
|
||||||
#idle_inhibitor,
|
#idle_inhibitor,
|
||||||
#pulseaudio,
|
#pulseaudio,
|
||||||
#network,
|
#network,
|
||||||
#clock,
|
|
||||||
#cpu,
|
#cpu,
|
||||||
#memory,
|
#memory,
|
||||||
#tray,
|
#tray,
|
||||||
#custom-mount-data,
|
#custom-mount-data,
|
||||||
#custom-mount-usb1 {
|
#custom-mount-usb1 {
|
||||||
font-family: "SauceCodePro Nerd Font", "SauceCodePro Nerd Font Mono", "Symbols Nerd Font Mono", "Symbols Nerd Font", "Font Awesome 7 Free", sans-serif;
|
background: alpha(#3b4252, 0.88);
|
||||||
|
color: #eceff4;
|
||||||
|
padding: 0 10px;
|
||||||
|
margin: 4px 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-screenshot {
|
#clock {
|
||||||
padding: 0 10px;
|
background: alpha(#5e81ac, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
#cpu,
|
||||||
|
#memory {
|
||||||
|
background: alpha(#81a1c1, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
#network {
|
||||||
|
background: alpha(#88c0d0, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
#network.disconnected {
|
||||||
|
color: #bf616a;
|
||||||
|
background: alpha(#bf616a, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pulseaudio.muted {
|
||||||
|
color: #ebcb8b;
|
||||||
|
}
|
||||||
|
|
||||||
|
#idle_inhibitor.activated {
|
||||||
|
color: #a3be8c;
|
||||||
|
}
|
||||||
|
|
||||||
|
#idle_inhibitor.deactivated {
|
||||||
|
color: #bf616a;
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-mount-data,
|
#custom-mount-data,
|
||||||
#custom-mount-usb1 {
|
#custom-mount-usb1 {
|
||||||
padding: 0 10px;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-mount-data.mounted,
|
#custom-mount-data.mounted,
|
||||||
#custom-mount-usb1.mounted {
|
#custom-mount-usb1.mounted {
|
||||||
color: #a3be8c;
|
color: #a3be8c;
|
||||||
background: rgba(163, 190, 140, 0.12);
|
background: alpha(#a3be8c, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-mount-data.unmounted,
|
#custom-mount-data.unmounted,
|
||||||
#custom-mount-usb1.unmounted {
|
#custom-mount-usb1.unmounted {
|
||||||
color: #bf616a;
|
color: #bf616a;
|
||||||
background: rgba(191, 97, 106, 0.14);
|
background: alpha(#bf616a, 0.16);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user