more rice stuff

This commit is contained in:
chrisbell committed 2026-10-03 12:00:24 -05:00
1 parent 3a345929b9
commit e2d34c6d1e
7 files changed
+156 -45

No files matched your search

+20 -8
View File
@@ -1,4 +1,4 @@
{ lib, pkgs, ... }:
{ pkgs, ... }:
let
polybar = pkgs.polybar.override { pulseSupport = true; };
@@ -18,6 +18,7 @@ in
dim = #565f89
[bar/main]
monitor = ''${env:MONITOR:}
width = 100%
height = 22pt
background = ''${colors.background}
@@ -36,8 +37,15 @@ in
tray-position = right
# Second monitor: same look, no tray, fewer modules (it's narrow when rotated)
[bar/secondary]
inherit = bar/main
modules-right = cpu memory
tray-position = none
[module/bspwm]
type = internal/bspwm
pin-workspaces = true
label-focused = %name%
label-focused-background = ''${colors.primary}
label-focused-foreground = ''${colors.background}
@@ -73,19 +81,23 @@ in
label-muted-foreground = ''${colors.dim}
'';
# One bar per monitor. The primary monitor gets "main" (with tray), others get "secondary".
# If no monitor is marked primary, the first one listed gets "main".
xdg.configFile."polybar/launch.sh" = {
executable = true;
text = ''
#!/bin/sh
${pkgs.procps}/bin/pkill -x polybar
while ${pkgs.procps}/bin/pgrep -x polybar >/dev/null; do sleep 0.2; done
${pkgs.util-linux}/bin/setsid -f ${polybar}/bin/polybar main
LIST=$(${polybar}/bin/polybar --list-monitors)
PRIMARY=$(echo "$LIST" | ${pkgs.gnugrep}/bin/grep '(primary)' | ${pkgs.coreutils}/bin/cut -d: -f1)
[ -z "$PRIMARY" ] && PRIMARY=$(echo "$LIST" | ${pkgs.coreutils}/bin/head -n1 | ${pkgs.coreutils}/bin/cut -d: -f1)
for m in $(echo "$LIST" | ${pkgs.coreutils}/bin/cut -d: -f1); do
if [ "$m" = "$PRIMARY" ]; then bar=main; else bar=secondary; fi
MONITOR=$m ${pkgs.util-linux}/bin/setsid -f ${polybar}/bin/polybar $bar
done
'';
};
# home.activation.reloadPolybar = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# if ${pkgs.procps}/bin/pgrep -x bspwm >/dev/null; then
# DISPLAY=:0 $HOME/.config/polybar/launch.sh || true
# fi
# '';
}