diff options
| author | tv <tv@krebsco.de> | 2026-12-04 01:30:49 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-04 03:05:12 +0000 |
| commit | b25c2abad084fa6d2fc930e27998533010b50708 (patch) | |
| tree | 9fde45348b6c9eb2753489486bc978f085023aa5 /modules/x11/xresources.nix | |
| parent | 607fb1010baae845910e75ba31687bffb259636b (diff) | |
x11: xmonad
From the dirt. Hosts set what's specific to them: XMONAD_MASTER_* by
the unit's environment, and shortcuts by hrm.xmonad.shortcuts.
hrm.xresources replaces tv.Xresources: X resources per display, and "*"
for all, loaded by the session service xresources@ instead of a system
service.
Diffstat (limited to 'modules/x11/xresources.nix')
| -rw-r--r-- | modules/x11/xresources.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/x11/xresources.nix b/modules/x11/xresources.nix new file mode 100644 index 00000000..981d1cad --- /dev/null +++ b/modules/x11/xresources.nix @@ -0,0 +1,44 @@ +# Loads X resources into each X session, before the session's other +# services start. +{ config, lib, pkgs, ... }: let + cfg = config.hrm.xresources; + + files = + pkgs.linkFarm "xresources" + (lib.mapAttrs + (display: resources: + pkgs.writeText "xresources-${display}" + (lib.concatStrings + (lib.mapAttrsToList + (name: value: "${name}: ${value}\n") + resources))) + ({ "*" = {}; } // cfg)); +in { + options.hrm.xresources = lib.mkOption { + default = {}; + type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); + example = { + "*"."Xcursor.size" = "64"; + "8"."XTerm*background" = "#1e171e"; + }; + description = '' + X resources, by display number. Those under "*" are for every + display, and a display's own override them. + ''; + }; + config = lib.mkIf config.hrm.xsession.enable { + hrm.xsession.services = [ "xresources" ]; + systemd.user.services."xresources@".serviceConfig = { + ExecStart = pkgs.writeDash "xresources-load" '' + set -efu + LC_ALL=C ${pkgs.xrdb}/bin/xrdb -load ${files}/'*' + f=${files}/''${DISPLAY#:} + if test -e "$f"; then + LC_ALL=C ${pkgs.xrdb}/bin/xrdb -override "$f" + fi + ''; + RemainAfterExit = true; + Type = "oneshot"; + }; + }; +} |
