mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
waylogout: added configuration module
90% of the code is copied over from swaylock so thanks to the creator of that module!
This commit is contained in:
parent
0d616edbac
commit
1e0c64b6a2
2 changed files with 57 additions and 0 deletions
|
@ -269,6 +269,7 @@ let
|
|||
./programs/pywal.nix
|
||||
./programs/rbenv.nix
|
||||
./programs/watson.nix
|
||||
./programs/waylogout.nix
|
||||
./programs/waybar.nix
|
||||
./programs/wezterm.nix
|
||||
./programs/wlogout.nix
|
||||
|
|
56
modules/programs/waylogout.nix
Normal file
56
modules/programs/waylogout.nix
Normal file
|
@ -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);
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue