Always hibernate
This commit is contained in:
parent
ad99c6152a
commit
578f05b4f1
|
@ -33,12 +33,10 @@ set $menu exec alacritty --class launcher -e env TERMINAL_COMMAND="alacritty -e"
|
||||||
bindsym $mod+Space exec $menu
|
bindsym $mod+Space exec $menu
|
||||||
|
|
||||||
# Set shut down, restart and locking features
|
# Set shut down, restart and locking features
|
||||||
set $mode_system (l)ock, (e)xit, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
||||||
bindsym $mod+0 mode "$mode_system"
|
bindsym $mod+0 mode "$mode_system"
|
||||||
mode "$mode_system" {
|
mode "$mode_system" {
|
||||||
bindsym l exec swaylock-bg, mode "default"
|
|
||||||
bindsym e exec swaymsg exit, mode "default"
|
bindsym e exec swaymsg exit, mode "default"
|
||||||
bindsym s exec systemctl suspend, mode "default"
|
|
||||||
bindsym h exec systemctl hibernate, mode "default"
|
bindsym h exec systemctl hibernate, mode "default"
|
||||||
bindsym r exec systemctl reboot, mode "default"
|
bindsym r exec systemctl reboot, mode "default"
|
||||||
bindsym Shift+s exec systemctl poweroff, mode "default"
|
bindsym Shift+s exec systemctl poweroff, mode "default"
|
||||||
|
|
|
@ -9,12 +9,10 @@ pkgs:
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swaylock}/bin:${pkgs.swaylock-bg}/bin";
|
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin";
|
||||||
ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \
|
ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \
|
||||||
timeout 600 'swaylock-bg' \
|
timeout 300 'swaymsg "output * dpms off"' \
|
||||||
timeout 900 'swaymsg "output * dpms off"' \
|
timeout 600 'systemctl hibernate' \
|
||||||
resume 'swaymsg "output * dpms on"' \
|
|
||||||
before-sleep 'swaylock-bg'
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
Install = {
|
Install = {
|
||||||
|
|
|
@ -12,7 +12,6 @@ with final; {
|
||||||
s = writeShellScriptBin "s" (import ./s.nix final);
|
s = writeShellScriptBin "s" (import ./s.nix final);
|
||||||
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
|
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
|
||||||
sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final);
|
sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final);
|
||||||
swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix final);
|
|
||||||
toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final);
|
toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final);
|
||||||
uhk-agent = import ./uhk-agent.nix final;
|
uhk-agent = import ./uhk-agent.nix final;
|
||||||
wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final);
|
wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final);
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
self: with self; ''
|
|
||||||
# Dependencies:
|
|
||||||
# swaylock
|
|
||||||
|
|
||||||
# Make sure we aren't running twice
|
|
||||||
RUNNING=$(ps -A | grep swaylock | wc -l)
|
|
||||||
if [ $RUNNING -ne 0 ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
IMAGE=$XDG_CONFIG_HOME/wallpaper.jpg
|
|
||||||
LOCKARGS=""
|
|
||||||
|
|
||||||
for OUTPUT in `${sway}/bin/swaymsg -t get_outputs | jq -r '.[].name'`
|
|
||||||
do
|
|
||||||
LOCKARGS="''${LOCKARGS} --image ''${OUTPUT}:''${IMAGE}"
|
|
||||||
IMAGES="''${IMAGES} ''${IMAGE}"
|
|
||||||
done
|
|
||||||
exec ${swaylock}/bin/swaylock $LOCKARGS
|
|
||||||
''
|
|
Loading…
Reference in a new issue