Reorganize files, use less extra options on Sway, move session commands to home-manager

This commit is contained in:
Bun 2025-05-09 17:37:01 -04:00
parent 5cdd7b1de8
commit ee3b40f61f
25 changed files with 64 additions and 107 deletions

View file

@ -1,53 +1,34 @@
{ config, lib, pkgs, ... }:
let
lockcommand = "${pkgs.swaylock-effects}/bin/swaylock --daemonize";
unlockcommand = "pkill -SIGUSR1 swaylock";
timeoutcommand = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
resumecommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\"";
with pkgs; let
lockCommand = "${swaylock-effects}/bin/swaylock --daemonize";
sleepCommand = "${systemd}/bin/systemctl suspend";
in
{
config = lib.mkIf config.home.desktop.enable {
services.swayidle = {
enable = config.home.desktop.enable;
enable = true;
events = [
{
event = "before-sleep";
command = lockcommand;
command = lockCommand;
}
{
event = "lock";
command = lockcommand;
}
{
event = "unlock";
command = unlockcommand;
}
{
event = "after-resume";
command = resumecommand;
command = lockCommand;
}
];
timeouts = [
{
{
timeout = 900; # 15m
command = lockCommand;
}
{
timeout = 1800; # 30m
command = "${pkgs.libnotify}/bin/notify-send \"Locking in 30 seconds\"";
}
{
timeout = 1830;
command = lockcommand;
}
{
timeout = 3600; # 1h
command = timeoutcommand;
resumeCommand = resumecommand;
}
{
timeout = 3605;
command = "${pkgs.systemd}/bin/systemctl suspend";
command = sleepCommand;
}
];
};
home.packages = with pkgs; [ sway-audio-idle-inhibit ];
home.packages = with pkgs; [ wayland-pipewire-idle-inhibit ];
};
}