Merge pull request 'Fix swayidle, lock, waybar menu' (#131) from fix/swayidle-waybar-menu into main

Reviewed-on: https://git.b12f.io/pub-solar/os/pulls/131
Reviewed-by: Benjamin Bädorf <hello@benjaminbaedorf.eu>
This commit is contained in:
teutat3s 2022-10-01 23:47:53 +00:00
commit a4545fa1d2
No known key found for this signature in database
GPG key ID: 5FEAFA6A0FC8075D
3 changed files with 16 additions and 9 deletions

View file

@ -1,6 +1,13 @@
{ psCfg, ... }: '' { pkgs, psCfg, ... }: ''
# Set shut down, restart and locking features # Set shut down, restart and locking features
'' + (if psCfg.core.hibernation.enable && !psCfg.paranoia.enable then ''
set $mode_system (e)xit, (h)ibernate, (l)ock, (s)uspend, (r)eboot, (Shift+s)hutdown
'' else if psCfg.paranoia.enable then ''
set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown
'' else ''
set $mode_system (e)xit, (l)ock, (s)uspend, (r)eboot, (Shift+s)hutdown
'')
+ ''
bindsym $mod+0 mode "$mode_system" bindsym $mod+0 mode "$mode_system"
mode "$mode_system" { mode "$mode_system" {
bindsym e exec swaymsg exit, mode "default" bindsym e exec swaymsg exit, mode "default"
@ -8,7 +15,7 @@
bindsym h exec systemctl hibernate, mode "default" bindsym h exec systemctl hibernate, mode "default"
'' else "") '' else "")
+ (if !psCfg.paranoia.enable then '' + (if !psCfg.paranoia.enable then ''
bindsym l exec swaylock-bg, mode "default" bindsym l exec ${pkgs.swaylock-bg}/bin/swaylock-bg, mode "default"
bindsym s exec systemctl suspend, mode "default" bindsym s exec systemctl suspend, mode "default"
'' else "") + '' '' else "") + ''
bindsym r exec systemctl reboot, mode "default" bindsym r exec systemctl reboot, mode "default"

View file

@ -98,7 +98,7 @@ in
xdg.configFile."sway/config.d/theme.conf".source = ./config/config.d/theme.conf; xdg.configFile."sway/config.d/theme.conf".source = ./config/config.d/theme.conf;
xdg.configFile."sway/config.d/gaps.conf".source = ./config/config.d/gaps.conf; xdg.configFile."sway/config.d/gaps.conf".source = ./config/config.d/gaps.conf;
xdg.configFile."sway/config.d/custom-keybindings.conf".source = ./config/config.d/custom-keybindings.conf; xdg.configFile."sway/config.d/custom-keybindings.conf".source = ./config/config.d/custom-keybindings.conf;
xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix { inherit psCfg; }; xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix { inherit pkgs psCfg; };
xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf; xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf;
xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf; xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf;
}; };

View file

@ -9,14 +9,14 @@
}; };
Service = { Service = {
Type = "simple"; Type = "simple";
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin"; Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swaylock-bg}/bin:${pkgs.swayidle}/bin";
ExecStart = ''${pkgs.swayidle}/bin/swayidle -w \ ExecStart = ''swayidle -w \
after-resume 'swaymsg "output * dpms on"' \ after-resume 'swaymsg "output * dpms on"' \
before-sleep '${pkgs.swaylock-bg}/bin/swaylock-bg' '' + (if psCfg.paranoia.enable then '' \ before-sleep 'swaylock-bg' '' + (if psCfg.paranoia.enable then '' \
timeout 120 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ timeout 120 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
timeout 150 'systemctl hibernate' timeout 150 'systemctl hibernate'
'' else '' \ '' else '' \
timeout 600 '${pkgs.swaylock-bg}/bin/swaylock-bg' \ timeout 600 'swaylock-bg' \
timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
''); '');
}; };