xresources: implement by using session commands
This commit is contained in:
parent
9fc62f557a
commit
cbd9e5ea8a
|
@ -50,14 +50,6 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
services.xresources.user = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "nobody";
|
|
||||||
description = ''
|
|
||||||
The user the xresources should be loaded as.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
services.xresources.resources = mkOption {
|
services.xresources.resources = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.str;
|
||||||
|
@ -79,30 +71,11 @@ in
|
||||||
user = cfg.user;
|
user = cfg.user;
|
||||||
xres = concatStringsSep "\n" (attrValues cfg.resources);
|
xres = concatStringsSep "\n" (attrValues cfg.resources);
|
||||||
|
|
||||||
mkService = user: xres: rec {
|
in mkIf cfg.enable {
|
||||||
description = "xresources managment script";
|
services.xserver.displayManager.sessionCommands = ''
|
||||||
requires = [ "display-manager.service" ];
|
|
||||||
after = requires;
|
|
||||||
path = [ pkgs.xlibs.xrdb ];
|
|
||||||
|
|
||||||
#TODO: make DISPLAY configurable
|
|
||||||
environment = {
|
|
||||||
DISPLAY = ":0";
|
|
||||||
};
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
User = user;
|
|
||||||
RemainAfterExit = "yes";
|
|
||||||
ExecStart = writeScript "${user}-xresources-init" ''
|
|
||||||
#!/bin/sh
|
|
||||||
echo ${shell-escape xres} | xrdb -merge
|
echo ${shell-escape xres} | xrdb -merge
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
in mkIf cfg.enable {
|
|
||||||
systemd.services."${user}-xresources" = mkService user xres;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user