Waybar: Add a warn for cpu and mem usage.

This commit is contained in:
Dmitry Voronin 2024-11-08 08:21:49 +03:00
parent 6ad96a7018
commit 1313311da8
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 55 additions and 30 deletions

View file

@ -128,17 +128,19 @@ in {
}; };
}; };
cpu = { cpu = {
format = "{usage}% ({load})"; format = "{usage}% ({load})";
interval = refreshInterval; interval = refreshInterval;
on-click = "foot -e bash -c btop"; on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle"; on-click-right = "powersave toggle";
tooltip = false; states.critical = 80;
tooltip = false;
}; };
memory = { memory = {
format = "{percentage}%"; format = "{percentage}%";
interval = refreshInterval; interval = refreshInterval;
on-click = "foot -e bash -c btop"; on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle"; on-click-right = "powersave toggle";
states.critical = 80;
}; };
temperature = { temperature = {
critical-threshold = 80; critical-threshold = 80;
@ -160,10 +162,12 @@ in {
"group/hardware" = { "group/hardware" = {
orientation = "horizontal"; orientation = "horizontal";
modules = [ modules = [
"custom/tag1"
"cpu" "cpu"
"temperature" "temperature"
"memory" "memory"
"custom/powersave" "custom/powersave"
"custom/tag2"
]; ];
}; };
"custom/display" = { "custom/display" = {
@ -174,5 +178,11 @@ in {
return-type = "json"; return-type = "json";
signal = 4; signal = 4;
}; };
"custom/tag1" = {
exec = "echo ";
};
"custom/tag2" = {
exec = "echo ";
};
}; };
} }

View file

@ -9,6 +9,18 @@ in {
# This way I am forced to apply the padding to children of each group # This way I am forced to apply the padding to children of each group
# instead of the whole group. # instead of the whole group.
text = '' text = ''
/* See the ISSUE above. */
#custom-tag1,
#battery {
padding-left: ${paddingH};
}
#custom-tag2,
#custom-powerlimit {
padding-right: ${paddingH};
}
/* Padding for global widgets. */
#clock, #clock,
#custom-display, #custom-display,
#language, #language,
@ -17,33 +29,17 @@ in {
#scratchpad, #scratchpad,
#tray { #tray {
padding: ${paddingV} ${paddingH}; padding: ${paddingV} ${paddingH};
border-top: ${toString config.module.style.window.border}px solid transparent;
border-bottom: ${toString config.module.style.window.border}px solid transparent;
}
#cpu,
#battery {
padding-left: ${paddingH};
}
#custom-powersave,
#custom-powerlimit {
padding-right: ${paddingH};
}
#clock {
font-weight: bold;
} }
/* Padding for combined widgets. */
#custom-powerlimit, #custom-powerlimit,
#custom-powersave, #custom-powersave,
#memory, #memory,
#temperature { #temperature {
padding-left: 4px; padding-left: 4px;
border-top: ${toString config.module.style.window.border}px solid transparent;
border-bottom: ${toString config.module.style.window.border}px solid transparent;
} }
/* Hover style. */
#batteryinfo:hover, #batteryinfo:hover,
#clock:hover, #clock:hover,
#custom-display:hover, #custom-display:hover,
@ -57,15 +53,30 @@ in {
background-color: rgba(${config.module.style.color.border-r},${config.module.style.color.border-g},${config.module.style.color.border-b},${toString config.module.style.opacity.desktop}); background-color: rgba(${config.module.style.color.border-r},${config.module.style.color.border-g},${config.module.style.color.border-b},${toString config.module.style.opacity.desktop});
} }
/* Critical state. */
#battery,
#cpu,
#custom-display,
#memory,
#pulseaudio,
#temperature,
#tray {
border-top: ${toString config.module.style.window.border}px solid transparent;
border-bottom: ${toString config.module.style.window.border}px solid transparent;
}
#battery.critical,
#cpu.critical,
#custom-display.modified,
#memory.critical,
#pulseaudio.muted, #pulseaudio.muted,
#pulseaudio.source-muted, #pulseaudio.source-muted,
#battery.critical,
#temperature.critical, #temperature.critical,
#tray.needs-attention, #tray.needs-attention {
#custom-display.modified {
border-top: ${toString config.module.style.window.border}px solid #${config.module.style.color.accent}; border-top: ${toString config.module.style.window.border}px solid #${config.module.style.color.accent};
} }
/* Widget-specific styling. */
#workspaces button { #workspaces button {
padding: ${paddingV} 4px; padding: ${paddingV} 4px;
border-top: ${toString config.module.style.window.border}px solid transparent; border-top: ${toString config.module.style.window.border}px solid transparent;
@ -76,5 +87,9 @@ in {
#workspaces button.focused { #workspaces button.focused {
border-top: ${toString config.module.style.window.border}px solid #${config.module.style.color.accent}; border-top: ${toString config.module.style.window.border}px solid #${config.module.style.color.accent};
} }
#clock {
font-weight: bold;
}
''; '';
} }