From 7f8c32c8295610ec7e5b8e387ea52cfa88250496 Mon Sep 17 00:00:00 2001 From: Linnnus Date: Sun, 23 Mar 2025 22:05:01 +0000 Subject: hosts/ali: Init --- hosts/ali/desktop-environment/window-manager.nix | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 hosts/ali/desktop-environment/window-manager.nix (limited to 'hosts/ali/desktop-environment/window-manager.nix') 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 + ]; +} -- cgit v1.2.3