fix(home): Various polybar fixes

This commit is contained in:
punkfairie 2024-11-22 22:09:36 -08:00
parent ec923b007f
commit 0b5219c89f
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696

View file

@ -5,27 +5,25 @@
...
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (lib) mkEnableOption mkIf getExe;
cfg = config.marleyos.services.polybar;
hasXorg = config.xsession.enable;
xrandr = getExe pkgs.xorg.xrandr;
grep = getExe pkgs.gnugrep;
cut = "${pkgs.coreutils}/bin/cut";
in
{
options.marleyos.services.polybar.enable = mkEnableOption "polybar";
config = mkIf (cfg.enable && hasXorg) {
home.packages = with pkgs; [
xorg.xrandr
];
services.polybar = {
enable = true;
package = config.lib.nixGL.wrap pkgs.polybar;
script = # bash
''
if type "xrandr" &/dev/null; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
for m in $(${xrandr} --query | ${grep} " connected" | ${cut} -d" " -f1); do
bar="main"
if [[ "$m" == "DP-0" ]]; then
@ -34,9 +32,6 @@ in
MONITOR="$m" polybar -q "$bar" &
done
else
polybar -q main &
fi
'';
# colorblock theme from
@ -66,7 +61,7 @@ in
cfgHome = config.xdg.configHome;
in
{
### Global Settings ###
# Global Settings - - - - - - - - - - - - - - - - - - - - - - - - - -
"settings" = {
screenchange.reload = true;
compositing = {
@ -82,7 +77,7 @@ in
margin.bottom = 0;
};
### Bars ###
# Bars - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"bar/main" = {
monitor.text = "\${env:MONITOR:}";
monitor.strict = false;
@ -123,10 +118,10 @@ in
"bar/tray" = {
"inherit" = "bar/main";
modules.right = "color-switch tray sep updates sep cpu memory pulseaudio network date sep sysmenu";
modules.right = "tray filesystem sep cpu memory pulseaudio network date sep sysmenu";
};
### Modules ###
# Modules - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"module/sep" = {
type = "custom/text";
format = " ";
@ -343,6 +338,14 @@ in
background = color.shade2;
};
};
ramp.volume = {
text = [
""
""
""
];
font = 2;
};
};
"module/network" = {
@ -393,6 +396,19 @@ in
};
click.left = mkIf hasRofi "${cfgHome}/rofi/powermenu/type-1/powermenu.sh &";
};
"module/tray" = {
type = "internal/tray";
tray = {
size = 16;
background = color.shade2;
spacing = "5px";
};
format = {
background = color.shade2;
padding = 2;
};
};
};
};
};