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
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
idleD = pkgs.writeShellScript "hyprland-idled" ''
|
idleD = let
|
||||||
${lib.getExe pkgs.swayidle} -w \
|
timeouts =
|
||||||
before-sleep '${lib.getExe pkgs.playerctl} pause' \
|
["timeout 120 '${lib.getExe pkgs.brightnessctl} -s set 10' resume '${lib.getExe pkgs.brightnessctl} -r'"]
|
||||||
before-sleep '${lib.getExe pkgs.swaylock}' \
|
++ (
|
||||||
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
|
if cfg.desktop.hyprland.autoSuspend
|
||||||
resume '${lib.getExe pkgs.brightnessctl} -r' \
|
then ["timeout 600 'sleep 2 && ${lib.getExe' pkgs.systemd "systemctl"} suspend'"]
|
||||||
timeout 300 '${lib.getExe pkgs.swaylock}' \
|
else [
|
||||||
timeout 330 '${hyprctl} dispatch dpms off' \
|
"timeout 600 '${lib.getExe pkgs.swaylock}'"
|
||||||
resume '${hyprctl} dispatch dpms on' \
|
"timeout 630 '${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 ''\''
|
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" ''
|
tablet = pkgs.writeShellScript "hyprland-tablet" ''
|
||||||
STATE=`${lib.getExe pkgs.dconf} read /org/gnome/desktop/a11y/applications/screen-keyboard-enabled`
|
STATE=`${lib.getExe pkgs.dconf} read /org/gnome/desktop/a11y/applications/screen-keyboard-enabled`
|
||||||
|
|
|
@ -7,21 +7,27 @@
|
||||||
cfg = config.ar.home;
|
cfg = config.ar.home;
|
||||||
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
|
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
|
||||||
in {
|
in {
|
||||||
idleD = pkgs.writeShellScript "sway-idled" ''
|
idleD = let
|
||||||
${lib.getExe pkgs.swayidle} -w \
|
timeouts =
|
||||||
before-sleep '${lib.getExe pkgs.playerctl} pause' \
|
["timeout 120 '${lib.getExe pkgs.brightnessctl} -s set 10' resume '${lib.getExe pkgs.brightnessctl} -r'"]
|
||||||
before-sleep '${lib.getExe pkgs.swaylock}' \
|
++ (
|
||||||
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
|
if cfg.desktop.sway.autoSuspend
|
||||||
resume '${lib.getExe pkgs.brightnessctl} -r' \
|
then ["timeout 600 'sleep 2 && ${lib.getExe' pkgs.systemd "systemctl"} suspend'"]
|
||||||
timeout 300 '${lib.getExe pkgs.swaylock}' \
|
else [
|
||||||
timeout 330 '${swaymsg} "output * dpms off"' \
|
"timeout 600 '${lib.getExe pkgs.swaylock}'"
|
||||||
resume '${swaymsg} "output * dpms on"' \
|
"timeout 630 '${swaymsg} \"output * dpms off\"' resume '${swaymsg} \"output * dpms on\"'"
|
||||||
${
|
]
|
||||||
if cfg.desktop.sway.autoSuspend
|
);
|
||||||
then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \''
|
|
||||||
else ''\''
|
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" ''
|
randomWallpaper = pkgs.writeShellScript "sway-randomWallpaper" ''
|
||||||
kill `pidof swaybg`
|
kill `pidof swaybg`
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
modifier = "Mod4";
|
modifier = "Mod4";
|
||||||
in {
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
wrapperFeatures.gtk = true;
|
|
||||||
checkConfig = false;
|
checkConfig = false;
|
||||||
|
package = lib.mkDefault pkgs.swayfx;
|
||||||
|
wrapperFeatures.gtk = true;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
bars = [{command = lib.getExe pkgs.waybar;}];
|
bars = [{command = lib.getExe pkgs.waybar;}];
|
||||||
|
@ -162,8 +163,8 @@ in {
|
||||||
"${modifier}+Shift+S" = "move scratchpad";
|
"${modifier}+Shift+S" = "move scratchpad";
|
||||||
|
|
||||||
# Screenshots
|
# Screenshots
|
||||||
"PRINT" = "exec ${helpers.screenshot.screen}";
|
"PRINT" = "exec ${helpers.screenshot}";
|
||||||
"${modifier}+PRINT" = "exec ${helpers.screenshot.region}";
|
"Control+F12" = "exec ${helpers.screenshot}";
|
||||||
|
|
||||||
# Show/hide waybar
|
# Show/hide waybar
|
||||||
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar";
|
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar";
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
autologin = "aly";
|
autologin = "aly";
|
||||||
};
|
};
|
||||||
|
|
||||||
gnome.enable = true;
|
hyprland.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.aly = {
|
users.aly = {
|
||||||
|
|
Loading…
Reference in a new issue