Waybar : Add groups.

This commit is contained in:
Dmitry Voronin 2024-09-13 23:05:51 +03:00
parent dc5010e303
commit b9eaa1467d
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 40 additions and 56 deletions

View file

@ -3,8 +3,7 @@
in { in {
file = (pkgs.formats.json {}).generate "WaybarConfig" { file = (pkgs.formats.json {}).generate "WaybarConfig" {
height = 34; height = 34;
layer = "top"; layer = "top"; margin-left = config.style.window.gap;
margin-left = config.style.window.gap;
margin-right = config.style.window.gap; margin-right = config.style.window.gap;
margin-top = config.style.window.gap; margin-top = config.style.window.gap;
mode = "dock"; mode = "dock";
@ -28,12 +27,8 @@ in {
modules-right = [ modules-right = [
"sway/language" "sway/language"
"pulseaudio" "pulseaudio"
"battery" "group/batteryinfo"
"custom/powerlimit" "group/hardware"
"cpu"
"temperature"
"memory"
"custom/powersave"
"custom/display" "custom/display"
"tray" "tray"
]; ];
@ -78,6 +73,15 @@ in {
on-click-right = "powerlimit toggle"; on-click-right = "powerlimit toggle";
interval = refreshInterval; interval = refreshInterval;
}; };
"custom/powerlimit" = {
exec = "powerlimit widget";
on-click-right = "powerlimit toggle";
signal = 6;
};
"group/batteryinfo" = {
orientation = "horizontal";
modules = [ "battery" "custom/powerlimit" ];
};
pulseaudio = { pulseaudio = {
scroll-step = 5; scroll-step = 5;
format = "{volume}%{icon}{format_source}"; format = "{volume}%{icon}{format_source}";
@ -128,6 +132,16 @@ in {
on-click-right = "powersave toggle"; on-click-right = "powersave toggle";
tooltip = false; tooltip = false;
}; };
"custom/powersave" = {
exec = "powersave widget";
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
signal = 5;
};
"group/hardware" = {
orientation = "horizontal";
modules = [ "cpu" "memory" "temperature" "custom/powersave" ];
};
"custom/display" = { "custom/display" = {
exec = "swayscript displaywidget"; exec = "swayscript displaywidget";
on-click = "sleep 0.1 && swayscript dnd"; # HACK: https://github.com/Alexays/Waybar/issues/2166 & https://github.com/Alexays/Waybar/issues/1968 on-click = "sleep 0.1 && swayscript dnd"; # HACK: https://github.com/Alexays/Waybar/issues/2166 & https://github.com/Alexays/Waybar/issues/1968
@ -136,16 +150,5 @@ in {
return-type = "json"; return-type = "json";
signal = 4; signal = 4;
}; };
"custom/powersave" = {
exec = "powersave widget";
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
signal = 5;
};
"custom/powerlimit" = {
exec = "powerlimit widget";
on-click-right = "powerlimit toggle";
signal = 6;
};
}; };
} }

View file

@ -2,61 +2,42 @@
paddingV = "0"; paddingV = "0";
paddingH = "12px"; paddingH = "12px";
in { in {
# ISSUE: https://github.com/Alexays/Waybar/issues/3303
text = '' text = ''
#pulseaudio, #batteryinfo,
#mpris,
#battery,
#custom-display,
#custom-powersave,
#custom-powerlimit,
#tray,
#temperature,
#memory,
#cpu,
#clock, #clock,
#custom-display,
#hardware,
#language,
#mpris,
#pulseaudio,
#scratchpad, #scratchpad,
#language { #tray {
padding: ${paddingV} ${paddingH}; padding: ${paddingV} ${paddingH};
border-top: ${toString config.style.window.border}px solid transparent; border-top: ${toString config.style.window.border}px solid transparent;
border-bottom: ${toString config.style.window.border}px solid transparent; border-bottom: ${toString config.style.window.border}px solid transparent;
} }
#cpu {
padding-right: 0;
}
#temperature {
padding-left: 0;
padding-right: 0;
}
#memory {
padding-left: 0;
}
#custom-powersave,
#custom-powerlimit {
margin-left: -${paddingH};
padding-left: 0;
}
#clock { #clock {
font-weight: bold; font-weight: bold;
} }
#battery:hover, #custom-powerlimit,
#custom-powersave,
#memory,
#temperature {
padding-left: 4px;
}
#batteryinfo:hover,
#clock:hover, #clock:hover,
#cpu:hover,
#custom-display:hover, #custom-display:hover,
#custom-powerlimit:hover, #hardware:hover,
#custom-powersave:hover,
#language:hover, #language:hover,
#memory:hover,
#mpris:hover, #mpris:hover,
#pulseaudio:hover, #pulseaudio:hover,
#temperature:hover,
#tray:hover,
#scratchpad:hover, #scratchpad:hover,
#tray:hover,
#workspaces button:hover { #workspaces button:hover {
background-color: rgba(${config.style.color.border-r},${config.style.color.border-g},${config.style.color.border-b},${toString config.style.opacity.desktop}); background-color: rgba(${config.style.color.border-r},${config.style.color.border-g},${config.style.color.border-b},${toString config.style.opacity.desktop});
} }