diff options
Diffstat (limited to 'hosts/ali/desktop-environment/window-manager.nix')
-rw-r--r-- | hosts/ali/desktop-environment/window-manager.nix | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/hosts/ali/desktop-environment/window-manager.nix b/hosts/ali/desktop-environment/window-manager.nix new file mode 100644 index 0000000..d36fc14 --- /dev/null +++ b/hosts/ali/desktop-environment/window-manager.nix @@ -0,0 +1,38 @@ +{pkgs, ...}: { + services.xserver.windowManager.dwm.enable = true; + + # FIXME: Deduplicate this with omar's config (noting the difference in BAT0 vs BAT1). + # Show battery and clock in status bar. This is a background daemon which + # updates the root window, which DWM uses for status. + systemd.user.services.dwm-battery = { + description = "Battery status update"; + partOf = ["graphical-session.target"]; + wantedBy = ["graphical-session.target"]; + + serviceConfig.ExecStart = pkgs.writeShellScript "dwm-battery" '' + while true; do + echo -n "$(date +%H:%M) - "; + + # See: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power + case "$(cat /sys/class/power_supply/BAT1/status)" in + Charging) echo -n "🔋 " ;; + Discharging) echo -n "🪫 " ;; + "Not charging") echo -n "🪫 " ;; + Full) echo -n "🔋 " ;; + Unknown) echo -n "? " ;; + ""|*) echo -n "?? " ;; + esac + + echo -n "$(cat /sys/class/power_supply/BAT1/capacity)%" + + echo + sleep 5 + done | ${pkgs.dwm-setstatus}/bin/dwm-setstatus + ''; + }; + + environment.systemPackages = with pkgs; [ + st + dmenu + ]; +} |