Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waylogout: added configuration module #5898

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/lib/maintainers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -628,4 +628,10 @@
keys =
[{ fingerprint = "BC82 4BB5 1656 D144 285E A0EC D382 C4AF EECE AA90"; }];
};
noodlez = {
name = "Nathaniel Barragan";
email = "contact@nathanielbarragan.xyz";
github = "Noodlez1232";
githubId = 12480453;
};
}
1 change: 1 addition & 0 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ let
./programs/pywal.nix
./programs/rbenv.nix
./programs/watson.nix
./programs/waylogout.nix
./programs/waybar.nix
./programs/wezterm.nix
./programs/wlogout.nix
Expand Down
56 changes: 56 additions & 0 deletions modules/programs/waylogout.nix
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);
};
};
}
Loading