Swaylock
This commit is contained in:
parent
f7a08debf5
commit
79470640c1
2 changed files with 62 additions and 6 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
swaybg
|
swaybg
|
||||||
libnotify
|
libnotify
|
||||||
swaylock
|
swaylock
|
||||||
|
networkmanagerapplet
|
||||||
];
|
];
|
||||||
programs.niri = {
|
programs.niri = {
|
||||||
settings = {
|
settings = {
|
||||||
|
|
@ -46,11 +47,6 @@
|
||||||
};
|
};
|
||||||
in [
|
in [
|
||||||
set-low-brightness
|
set-low-brightness
|
||||||
{
|
|
||||||
command = [
|
|
||||||
"${lib.getExe pkgs.waybar}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
command = [
|
command = [
|
||||||
"${lib.getExe pkgs.networkmanagerapplet}"
|
"${lib.getExe pkgs.networkmanagerapplet}"
|
||||||
|
|
@ -146,7 +142,7 @@
|
||||||
"XF86MonBrightnessDown".action = sh "brightnessctl set 10%-";
|
"XF86MonBrightnessDown".action = sh "brightnessctl set 10%-";
|
||||||
#"Mod+Tab".action = focus-window-down-or-column-right;
|
#"Mod+Tab".action = focus-window-down-or-column-right;
|
||||||
#"Mod+Shift+Tab".action = focus-window-up-or-column-left;
|
#"Mod+Shift+Tab".action = focus-window-up-or-column-left;
|
||||||
"Mod+Tab".action = open-overview;
|
"Mod+Tab".action = toggle-overview;
|
||||||
};
|
};
|
||||||
input = {
|
input = {
|
||||||
focus-follows-mouse = {
|
focus-follows-mouse = {
|
||||||
|
|
@ -157,6 +153,7 @@
|
||||||
xkb.layout = "us, ru";
|
xkb.layout = "us, ru";
|
||||||
xkb.options = "grp:lctrl_toggle, ctrl:nocaps" + (if hwconfig.hostname == "kylekrein-mac" then ", altwin:swap_alt_win" else "");
|
xkb.options = "grp:lctrl_toggle, ctrl:nocaps" + (if hwconfig.hostname == "kylekrein-mac" then ", altwin:swap_alt_win" else "");
|
||||||
track-layout = "window";
|
track-layout = "window";
|
||||||
|
#numlock = true;
|
||||||
};
|
};
|
||||||
touchpad = {
|
touchpad = {
|
||||||
tap = true;
|
tap = true;
|
||||||
|
|
@ -214,4 +211,62 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.swaylock = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
color = "808080";
|
||||||
|
font-size = 24;
|
||||||
|
indicator-idle-visible = false;
|
||||||
|
indicator-radius = 100;
|
||||||
|
line-color = "ffffff";
|
||||||
|
show-failed-attempts = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.swayidle = let
|
||||||
|
locking-script = pkgs.writeShellScript "locking-script" ''
|
||||||
|
pidof swaylock || "${pkgs.swaylock}/bin/swaylock -fF"
|
||||||
|
'';
|
||||||
|
suspendScript = pkgs.writeShellScript "suspend-script" ''
|
||||||
|
# check if any player has status "Playing"
|
||||||
|
${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q
|
||||||
|
# only suspend if nothing is playing
|
||||||
|
if [ $? == 1 ]; then
|
||||||
|
${pkgs.systemd}/bin/systemctl suspend
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in{
|
||||||
|
enable = true;
|
||||||
|
events = [
|
||||||
|
{
|
||||||
|
event = "before-sleep";
|
||||||
|
command = "${locking-script};niri msg action power-off-monitors";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = "after-resume";
|
||||||
|
command = "niri msg action power-on-monitors";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = "lock";
|
||||||
|
command = "${locking-script}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
timeouts = let
|
||||||
|
secondary = "systemctl suspend";
|
||||||
|
in[
|
||||||
|
{
|
||||||
|
timeout = 30;
|
||||||
|
command = "pidof swaylock && ${secondary}";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 300;
|
||||||
|
command = "${locking-script}";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 330;
|
||||||
|
command = "pidof swaylock && ${secondary}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
inputs.niri-flake.nixosModules.niri
|
inputs.niri-flake.nixosModules.niri
|
||||||
];
|
];
|
||||||
|
security.pam.services.swaylock = {};
|
||||||
programs.niri = {
|
programs.niri = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.niri-unstable;
|
package = pkgs.niri-unstable;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue