diff --git a/modules/home/services/polybar/default.nix b/modules/home/services/polybar/default.nix index dc96133..0487427 100644 --- a/modules/home/services/polybar/default.nix +++ b/modules/home/services/polybar/default.nix @@ -5,38 +5,33 @@ ... }: 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 - bar="main" + for m in $(${xrandr} --query | ${grep} " connected" | ${cut} -d" " -f1); do + bar="main" - if [[ "$m" == "DP-0" ]]; then - bar="tray" - fi + if [[ "$m" == "DP-0" ]]; then + bar="tray" + fi - MONITOR="$m" polybar -q "$bar" & - done - else - polybar -q main & - fi + MONITOR="$m" polybar -q "$bar" & + done ''; # 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; + }; + }; }; }; };