From eeac4793c25ebce98f59fb7c23f209f7528feaff Mon Sep 17 00:00:00 2001 From: 514fpv Date: Wed, 14 Feb 2024 15:38:19 +0800 Subject: [PATCH] feat(swayidle): set up idle behaviour --- home/swayidle/home.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 home/swayidle/home.nix diff --git a/home/swayidle/home.nix b/home/swayidle/home.nix new file mode 100644 index 00000000..93158c26 --- /dev/null +++ b/home/swayidle/home.nix @@ -0,0 +1,20 @@ +{ pkgs +, lib +, config +, ... }: with lib; mkIf config.passthrough.gui { + services.swayidle = { + enable = true; + systemdTarget = "sway-session.target"; + timeouts = [ + { timeout = 600; command = "swaymsg 'output * dpms off'"; resumeCommand = "swaymsg 'output * dpms on'"; } + ]; + events = [ + { event = "before-sleep"; command = "${pkgs.swaylock-effects}/bin/swaylock -f --grace 0"; } + ]; + }; + + # fullscreen as simple idle inhibitor shortcut + wayland.windowManager.sway.config.window.commands = [ + { criteria.shell = ".*"; command = "inhibit_idle fullscreen"; } + ]; +}