mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 02:13:55 -05:00
home: nixify swayidle (#60)
Some checks are pending
flakehub / flakehub-publish (push) Waiting to run
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
Some checks are pending
flakehub / flakehub-publish (push) Waiting to run
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
* home/hyprland: nixify idled * home/hyprland: don't pass before-sleep commands if autosuspend is disabled * home/hyprland: simplify idled options * home/sway: mirror hyprland idleD improvements
This commit is contained in:
parent
ba1d6fe0fd
commit
ae0e007ba2
|
@ -26,21 +26,27 @@ in {
|
|||
fi
|
||||
'';
|
||||
|
||||
idleD = pkgs.writeShellScript "hyprland-idled" ''
|
||||
${lib.getExe pkgs.swayidle} -w \
|
||||
before-sleep '${lib.getExe pkgs.playerctl} pause' \
|
||||
before-sleep '${lib.getExe pkgs.swaylock}' \
|
||||
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
|
||||
resume '${lib.getExe pkgs.brightnessctl} -r' \
|
||||
timeout 300 '${lib.getExe pkgs.swaylock}' \
|
||||
timeout 330 '${hyprctl} dispatch dpms off' \
|
||||
resume '${hyprctl} dispatch dpms on' \
|
||||
${
|
||||
if cfg.desktop.hyprland.autoSuspend
|
||||
then ''timeout 900 'sleep 2 && ${lib.getExe' pkgs.systemd "systemctl"} suspend' \''
|
||||
else ''\''
|
||||
}
|
||||
'';
|
||||
idleD = let
|
||||
timeouts =
|
||||
["timeout 120 '${lib.getExe pkgs.brightnessctl} -s set 10' resume '${lib.getExe pkgs.brightnessctl} -r'"]
|
||||
++ (
|
||||
if cfg.desktop.hyprland.autoSuspend
|
||||
then ["timeout 600 'sleep 2 && ${lib.getExe' pkgs.systemd "systemctl"} suspend'"]
|
||||
else [
|
||||
"timeout 600 '${lib.getExe pkgs.swaylock}'"
|
||||
"timeout 630 '${hyprctl} dispatch dpms off' resume '${hyprctl} dispatch dpms on'"
|
||||
]
|
||||
);
|
||||
|
||||
beforeSleeps =
|
||||
lib.optionals cfg.desktop.hyprland.autoSuspend
|
||||
[
|
||||
"before-sleep '${lib.getExe pkgs.playerctl} pause'"
|
||||
"before-sleep '${lib.getExe pkgs.swaylock}'"
|
||||
];
|
||||
in
|
||||
pkgs.writeShellScript "hyprland-idled"
|
||||
"${lib.getExe pkgs.swayidle} -w ${lib.strings.concatStringsSep " " (timeouts ++ beforeSleeps)}";
|
||||
|
||||
tablet = pkgs.writeShellScript "hyprland-tablet" ''
|
||||
STATE=`${lib.getExe pkgs.dconf} read /org/gnome/desktop/a11y/applications/screen-keyboard-enabled`
|
||||
|
|
|
@ -7,21 +7,27 @@
|
|||
cfg = config.ar.home;
|
||||
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
|
||||
in {
|
||||
idleD = pkgs.writeShellScript "sway-idled" ''
|
||||
${lib.getExe pkgs.swayidle} -w \
|
||||
before-sleep '${lib.getExe pkgs.playerctl} pause' \
|
||||
before-sleep '${lib.getExe pkgs.swaylock}' \
|
||||
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
|
||||
resume '${lib.getExe pkgs.brightnessctl} -r' \
|
||||
timeout 300 '${lib.getExe pkgs.swaylock}' \
|
||||
timeout 330 '${swaymsg} "output * dpms off"' \
|
||||
resume '${swaymsg} "output * dpms on"' \
|
||||
${
|
||||
if cfg.desktop.sway.autoSuspend
|
||||
then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \''
|
||||
else ''\''
|
||||
}
|
||||
'';
|
||||
idleD = let
|
||||
timeouts =
|
||||
["timeout 120 '${lib.getExe pkgs.brightnessctl} -s set 10' resume '${lib.getExe pkgs.brightnessctl} -r'"]
|
||||
++ (
|
||||
if cfg.desktop.sway.autoSuspend
|
||||
then ["timeout 600 'sleep 2 && ${lib.getExe' pkgs.systemd "systemctl"} suspend'"]
|
||||
else [
|
||||
"timeout 600 '${lib.getExe pkgs.swaylock}'"
|
||||
"timeout 630 '${swaymsg} \"output * dpms off\"' resume '${swaymsg} \"output * dpms on\"'"
|
||||
]
|
||||
);
|
||||
|
||||
beforeSleeps =
|
||||
lib.optionals cfg.desktop.sway.autoSuspend
|
||||
[
|
||||
"before-sleep '${lib.getExe pkgs.playerctl} pause'"
|
||||
"before-sleep '${lib.getExe pkgs.swaylock}'"
|
||||
];
|
||||
in
|
||||
pkgs.writeShellScript "sway-idled"
|
||||
"${lib.getExe pkgs.swayidle} -w ${lib.strings.concatStringsSep " " (timeouts ++ beforeSleeps)}";
|
||||
|
||||
randomWallpaper = pkgs.writeShellScript "sway-randomWallpaper" ''
|
||||
kill `pidof swaybg`
|
||||
|
|
|
@ -10,8 +10,9 @@
|
|||
modifier = "Mod4";
|
||||
in {
|
||||
enable = true;
|
||||
wrapperFeatures.gtk = true;
|
||||
checkConfig = false;
|
||||
package = lib.mkDefault pkgs.swayfx;
|
||||
wrapperFeatures.gtk = true;
|
||||
|
||||
config = {
|
||||
bars = [{command = lib.getExe pkgs.waybar;}];
|
||||
|
@ -162,8 +163,8 @@ in {
|
|||
"${modifier}+Shift+S" = "move scratchpad";
|
||||
|
||||
# Screenshots
|
||||
"PRINT" = "exec ${helpers.screenshot.screen}";
|
||||
"${modifier}+PRINT" = "exec ${helpers.screenshot.region}";
|
||||
"PRINT" = "exec ${helpers.screenshot}";
|
||||
"Control+F12" = "exec ${helpers.screenshot}";
|
||||
|
||||
# Show/hide waybar
|
||||
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar";
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
autologin = "aly";
|
||||
};
|
||||
|
||||
gnome.enable = true;
|
||||
hyprland.enable = true;
|
||||
};
|
||||
|
||||
users.aly = {
|
||||
|
|
Loading…
Reference in a new issue