parent
1105e2de4a
commit
f39bd3263a
2 changed files with 35 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
imports = [
|
||||
./wl-clipboard.nix
|
||||
./mako.nix
|
||||
./swayidle.nix
|
||||
];
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
|
|
34
config/programs/swayidle.nix
Normal file
34
config/programs/swayidle.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
lock-script = pkgs.writeScript "suspend" ''
|
||||
${pkgs.swaylock}/bin/swaylock -f -c 000000
|
||||
${pkgs.mpc-cli}/bin/mpc pause
|
||||
'';
|
||||
screen-off-script = pkgs.writeScript "screenOff" ''
|
||||
${pkgs.sway}/bin/swaymsg "output * dpms off"
|
||||
'';
|
||||
suspend-script = pkgs.writeScript "suspend" ''
|
||||
${pkgs.systemctl}/bin/systemctl suspend
|
||||
'';
|
||||
resume-script = pkgs.writeScript "resume" ''
|
||||
${pkgs.sway}/bin/swaymsg "output * dpms on"
|
||||
'';
|
||||
unlock-script = pkgs.writeScript "unlock" ''
|
||||
${pkgs.procps}/bin/pkill swaylock
|
||||
${pkgs.mpc-cli}/bin/mpc play
|
||||
'';
|
||||
in
|
||||
{
|
||||
systemd.user.services.swayidle = {
|
||||
Unit = {
|
||||
Description = "swayidle";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.swayidle}/bin/swayidle -w timeout 300 ${lock-script} timeout 305 ${screen-off-script} timeout 900 ${suspend-script} resume ${resume-script} lock ${lock-script} unlock ${unlock-script}";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue