updated waybar disk usage component
This commit is contained in:
@@ -112,26 +112,19 @@ in {
|
||||
|
||||
"custom/disk-icon" = {
|
||||
exec = ''
|
||||
df /dev/disk/by-partlabel/disk-main-home /dev/disk/by-partlabel/disk-main-nix | awk '
|
||||
df / | awk '
|
||||
function format(size) {
|
||||
if (size >= 1024) return sprintf("%.1fTB", size / 1024)
|
||||
if (size >= 1024) return sprintf("%.1fTB", size / 1024);
|
||||
else return sprintf("%.1fGB", size)
|
||||
}
|
||||
$6 == "/home" {
|
||||
home_usage = $3 / 1024 / 1024
|
||||
home_total = $2 / 1024 / 1024
|
||||
home_percent = $5
|
||||
sub(/%/,"",home_percent)
|
||||
$6 == "/" {
|
||||
usage = $3 / 1024 / 1024;
|
||||
total = $2 / 1024 / 1024;
|
||||
percent = $5;
|
||||
sub(/%/, "", percent);
|
||||
printf "{\"class\": \"disk-icon\", \"tooltip\": \"/: %s / %s\", \"percentage\": %s}\n", format(usage), format(total), percent
|
||||
}
|
||||
$6 == "/nix" {
|
||||
nix_usage = $3 / 1024 / 1024
|
||||
nix_total = $2 / 1024 / 1024
|
||||
nix_percent = $5
|
||||
}
|
||||
END {
|
||||
printf "{\"class\": \"disk-icon\", \"tooltip\": \"/home: %s / %s\\n/nix: %s / %s\", \"percentage\": %s}\n",
|
||||
format(home_usage), format(home_total), format(nix_usage), format(nix_total), home_percent
|
||||
}' | jq --unbuffered --compact-output
|
||||
' | jq --unbuffered --compact-output
|
||||
'';
|
||||
interval = 60;
|
||||
return-type = "json";
|
||||
@@ -298,6 +291,8 @@ in {
|
||||
|
||||
#workspaces button:hover {
|
||||
border-radius: 8px;
|
||||
background: #${fg.lightest};
|
||||
color: #${bg.darkest};
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
|
||||
Reference in New Issue
Block a user