swayidle: extract config from sway
This commit is contained in:
parent
ce4a6bb501
commit
5f0c129b63
2 changed files with 37 additions and 26 deletions
34
user/sway/swayidle.nix
Normal file
34
user/sway/swayidle.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
inherit (pkgs.uservars) key accent font theme;
|
||||
inherit (theme) color;
|
||||
in
|
||||
{
|
||||
services.swayidle = {
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 360;
|
||||
command = "${pkgs.swaylock}/bin/swaylock -f";
|
||||
}
|
||||
{
|
||||
timeout = 1800;
|
||||
command = ''
|
||||
mpc status | grep "^[playing]" > /dev/null || ${pkgs.sway}/bin/swaymsg "output * dpms off"
|
||||
'';
|
||||
resumeCommand = ''
|
||||
${pkgs.sway}/bin/swaymsg "output * dpms on"
|
||||
'';
|
||||
}
|
||||
];
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${pkgs.swaylock}/bin/swaylock -f";
|
||||
}
|
||||
{
|
||||
event = "after-resume";
|
||||
command = ''swaymsg "output * dpms on"'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue