Converted swayidle to a home module
This commit is contained in:
parent
9fb7bb1ae1
commit
0862244fd2
|
@ -7,7 +7,7 @@
|
|||
namespace,
|
||||
...
|
||||
}: {
|
||||
aa = {
|
||||
${namespace} = {
|
||||
apps = {
|
||||
bat.enable = true;
|
||||
btop.enable = true;
|
||||
|
@ -30,8 +30,9 @@
|
|||
};
|
||||
|
||||
services = {
|
||||
swaync.enable = true;
|
||||
playerctld.enable = true;
|
||||
swayidle.enable = true;
|
||||
swaync.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
40
modules/home/services/swayidle/default.nix
Normal file
40
modules/home/services/swayidle/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
|
||||
cfg = config.${namespace}.services.swayidle;
|
||||
in {
|
||||
options.${namespace}.services.swayidle = {
|
||||
enable = mkEnableOption "swayidle";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [pkgs.swayidle];
|
||||
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 300;
|
||||
command = "${pkgs.swaylock}/bin/swaylock";
|
||||
}
|
||||
{
|
||||
timeout = 600;
|
||||
command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'";
|
||||
resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'";
|
||||
}
|
||||
];
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${pkgs.swaylock}/bin/swaylock";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.aa.desktop.addons.swayidle;
|
||||
in {
|
||||
options.aa.desktop.addons.swayidle = with types; {
|
||||
enable = mkEnableOption "swayidle";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [swayidle];
|
||||
|
||||
aa.home.extraOptions = {
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 300;
|
||||
command = "${pkgs.swaylock}/bin/swaylock";
|
||||
}
|
||||
{
|
||||
timeout = 600;
|
||||
command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'";
|
||||
resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'";
|
||||
}
|
||||
];
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${pkgs.swaylock}/bin/swaylock";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -38,7 +38,6 @@ in {
|
|||
aa.desktop.addons = {
|
||||
alacritty.enable = true;
|
||||
gammastep.enable = true;
|
||||
swayidle.enable = true;
|
||||
|
||||
# TODO
|
||||
# light
|
||||
|
|
Loading…
Reference in a new issue