-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux-wallpaperengine: add ckgxrg as maintainer
linux-wallpaperengine: add module linux-wallpaperengine is an implementation of Wallpaper Engine functionality on Linux, this module allows it to be declaratively configured.
- Loading branch information
1 parent
a042868
commit 90a1a2f
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -634,4 +634,10 @@ | |
github = "ALameLlama"; | ||
githubId = 55490546; | ||
}; | ||
ckgxrg = { | ||
name = "ckgxrg"; | ||
email = "[email protected]"; | ||
github = "ckgxrg-salt"; | ||
githubId = 165614491; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
|
||
cfg = config.services.linux-wallpaperengine; | ||
|
||
in { | ||
meta.maintainers = [ maintainers.ckgxrg ]; | ||
|
||
options.services.linux-wallpaperengine = { | ||
enable = mkEnableOption | ||
"linux-wallpaperengine, an implementation of Wallpaper Engine functionality"; | ||
|
||
package = mkOption { | ||
type = types.package; | ||
description = "The linux-wallpaperengine package to use."; | ||
default = pkgs.linux-wallpaperengine; | ||
defaultText = literalExpression "pkgs.linux-wallpaperengine"; | ||
}; | ||
|
||
assetsPath = mkOption { | ||
type = types.str; | ||
description = "Path to the assets directory."; | ||
}; | ||
|
||
clamping = mkOption { | ||
type = types.nullOr (types.enum [ "clamp" "border" "repeat" ]); | ||
default = null; | ||
description = "Clamping mode for all wallpapers."; | ||
}; | ||
|
||
wallpapers = mkOption { | ||
type = types.listOf (types.submodule { | ||
|
||
options = { | ||
monitor = mkOption { | ||
type = types.str; | ||
description = "Which monitor to display the wallpaper."; | ||
}; | ||
|
||
wallpaperId = mkOption { | ||
type = types.str; | ||
description = "Wallpaper ID to be used."; | ||
}; | ||
|
||
extraOptions = mkOption { | ||
type = types.listOf types.str; | ||
default = [ ]; | ||
description = | ||
"Extra arguments to pass to the linux-wallpaperengine command for this wallpaper."; | ||
}; | ||
|
||
scaling = mkOption { | ||
type = | ||
types.nullOr (types.enum [ "stretch" "fit" "fill" "default" ]); | ||
default = null; | ||
description = "Scaling mode for this wallpaper."; | ||
}; | ||
|
||
fps = mkOption { | ||
type = types.nullOr types.int; | ||
default = null; | ||
description = "Limits the FPS to a given number."; | ||
}; | ||
|
||
audio = { | ||
silent = mkOption { | ||
type = types.bool; | ||
default = false; | ||
description = "Mutes all sound of the wallpaper."; | ||
}; | ||
|
||
automute = mkOption { | ||
type = types.bool; | ||
default = true; | ||
description = "Automute when another app is playing sound."; | ||
}; | ||
|
||
audio-processing = mkOption { | ||
type = types.bool; | ||
default = true; | ||
description = "Enables audio processing for background."; | ||
}; | ||
}; | ||
}; | ||
}); | ||
default = [ ]; | ||
description = "Define wallpapers."; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
assertions = [ | ||
(lib.hm.assertions.assertPlatform "services.linux-wallpaperengine" pkgs | ||
lib.platforms.linux) | ||
]; | ||
|
||
home.packages = [ cfg.package ]; | ||
|
||
systemd.user.services."linux-wallpaperengine" = let | ||
args = lists.forEach cfg.wallpapers (each: | ||
concatStringsSep " " (cli.toGNUCommandLine { } { | ||
screen-root = each.monitor; | ||
inherit (each) scaling fps; | ||
silent = each.audio.silent; | ||
noautomute = !each.audio.automute; | ||
no-audio-processing = !each.audio.audio-processing; | ||
} ++ each.extraOptions) | ||
# This has to be the last argument in each group | ||
+ " --bg ${each.wallpaperId}"); | ||
in { | ||
Unit = { | ||
Description = "Implementation of Wallpaper Engine on Linux"; | ||
After = [ "graphical-session.target" ]; | ||
PartOf = [ "graphical-session.target" ]; | ||
}; | ||
Service = { | ||
ExecStart = "${cfg.package}/bin/linux-wallpaperengine " | ||
+ "--assets-dir ${cfg.assetsPath} " + "--clamping ${cfg.clamping} " | ||
+ (strings.concatStringsSep " " args); | ||
Restart = "on-failure"; | ||
}; | ||
Install = { WantedBy = [ "graphical-session.target" ]; }; | ||
}; | ||
}; | ||
} |