diff options
Diffstat (limited to 'home-manager/modules/services/random-background.nix')
-rw-r--r-- | home-manager/modules/services/random-background.nix | 84 |
1 files changed, 39 insertions, 45 deletions
diff --git a/home-manager/modules/services/random-background.nix b/home-manager/modules/services/random-background.nix index cbec97ae7cb..9deee8deb5c 100644 --- a/home-manager/modules/services/random-background.nix +++ b/home-manager/modules/services/random-background.nix @@ -6,23 +6,26 @@ let cfg = config.services.random-background; - flags = lib.concatStringsSep " " ( - [ - "--bg-${cfg.display}" - "--no-fehbg" - "--randomize" - ] - ++ lib.optional (!cfg.enableXinerama) "--no-xinerama" - ); + flags = lib.concatStringsSep " " + ([ "--bg-${cfg.display}" "--no-fehbg" "--randomize" ] + ++ lib.optional (!cfg.enableXinerama) "--no-xinerama"); -in - -{ +in { meta.maintainers = [ maintainers.rycee ]; options = { services.random-background = { - enable = mkEnableOption "random desktop background"; + enable = mkEnableOption "" // { + description = '' + Whether to enable random desktop background. + </para><para> + Note, if you are using NixOS and have set up a custom + desktop manager session for Home Manager, then the session + configuration must have the <option>bgSupport</option> + option set to <literal>true</literal> or the background + image set by this module may be overwritten. + ''; + }; imageDirectory = mkOption { type = types.str; @@ -63,41 +66,32 @@ in }; }; - config = mkIf cfg.enable ( - mkMerge ([ - { - systemd.user.services.random-background = { - Unit = { - Description = "Set random desktop background using feh"; - After = [ "graphical-session-pre.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - - Service = { - Type = "oneshot"; - ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}"; - IOSchedulingClass = "idle"; - }; + config = mkIf cfg.enable (mkMerge ([ + { + systemd.user.services.random-background = { + Unit = { + Description = "Set random desktop background using feh"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}"; + IOSchedulingClass = "idle"; }; - } - (mkIf (cfg.interval != null) { - systemd.user.timers.random-background = { - Unit = { - Description = "Set random desktop background using feh"; - }; - Timer = { - OnUnitActiveSec = cfg.interval; - }; + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; + } + (mkIf (cfg.interval != null) { + systemd.user.timers.random-background = { + Unit = { Description = "Set random desktop background using feh"; }; - Install = { - WantedBy = [ "timers.target" ]; - }; - }; - }) - ])); + Timer = { OnUnitActiveSec = cfg.interval; }; + + Install = { WantedBy = [ "timers.target" ]; }; + }; + }) + ])); } |