-
-
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.
waylogout: added configuration module
90% of the code is copied over from swaylock so thanks to the creator of that module!
- Loading branch information
1 parent
f26aa4b
commit 82ef35e
Showing
3 changed files
with
63 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
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,56 @@ | ||
{ pkgs, config, lib, ... }: | ||
|
||
with lib; | ||
|
||
let cfg = config.programs.waylogout; | ||
in { | ||
meta.maintainers = [ hm.maintainers.noodlez ]; | ||
|
||
options.programs.waylogout = { | ||
enable = mkOption { | ||
default = false; | ||
type = lib.types.bool; | ||
example = true; | ||
description = '' | ||
Whether or not to enable waylogout. | ||
''; | ||
}; | ||
|
||
package = mkPackageOption pkgs "waylogout" { }; | ||
|
||
settings = mkOption { | ||
type = with types; attrsOf (oneOf [ bool float int str ]); | ||
default = { }; | ||
description = '' | ||
Default arguments to {command}`waylogout`. An empty set | ||
disables configuration generation. | ||
''; | ||
example = { | ||
color = "808080"; | ||
poweroff-command = "systemctl poweroff"; | ||
reboot-command = "systemctl reboot"; | ||
scaling = "fit"; | ||
effect-blur = "7x4"; | ||
screenshots = true; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
assertions = [ | ||
(lib.hm.assertions.assertPlatform "programs.waylogout" pkgs | ||
lib.platforms.linux) | ||
]; | ||
|
||
home.packages = [ cfg.package ]; | ||
|
||
xdg.configFile."waylogout/config" = mkIf (cfg.settings != { }) { | ||
text = concatStrings (mapAttrsToList (n: v: | ||
if v == false then | ||
"" | ||
else | ||
(if v == true then n else n + "=" + builtins.toString v) + "\n") | ||
cfg.settings); | ||
}; | ||
}; | ||
} |