idle and background

This commit is contained in:
Zoty 2026-06-17 08:26:45 -03:00
parent 79c56ca955
commit 12f4f8b5c3
Signed by: Zoty
SSH key fingerprint: SHA256:WsGEGivgl37t3Mth6uugXMOgMCTR7QolIepNbC+j/tA
2 changed files with 36 additions and 2 deletions

View file

@ -1,4 +1,27 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
let
wallpaper = "${config.home.homeDirectory}/repos/nixos/wallpapers/astronaut.png";
in {
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock}/bin/swaylock -f -i ${wallpaper}";
}
{
timeout = 600;
command = "${pkgs.niri}/bin/niri msg action power-off-monitors";
}
];
events = [
{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock -f -i ${wallpaper}";
}
];
};
home.sessionVariables = {
XDG_CURRENT_DESKTOP = "niri";
XDG_SESSION_DESKTOP = "niri";
@ -41,6 +64,16 @@
'';
};
home.file.".local/bin/swww-init" = {
executable = true;
text = ''
#!/usr/bin/env bash
swww-daemon &
sleep 0.5
swww img "${wallpaper}" --transition-type none
'';
};
xdg.configFile."quickshell".source =
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/repos/nixos/quickshell";
@ -75,6 +108,7 @@
prefer-no-csd
spawn-at-startup "quickshell"
spawn-at-startup "bash" "-c" "$HOME/.local/bin/swww-init"
screenshot-path "${config.xdg.userDirs.pictures}/screenshots/%Y-%m-%d %H-%M-%S.png"
@ -110,7 +144,7 @@
// System
Mod+Shift+E { quit; }
Mod+L { spawn "swaylock"; }
Mod+L { spawn "swaylock" "-i" "${wallpaper}"; }
// Volume
XF86AudioRaiseVolume { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%+"; }