Factor out screen locking
This commit is contained in:
parent
f435df434e
commit
63e7c14a8e
|
@ -53,6 +53,18 @@ with nLib; {
|
||||||
description = "Targets to install desktop services to";
|
description = "Targets to install desktop services to";
|
||||||
default = [ "hyprland-session.target" ];
|
default = [ "hyprland-session.target" ];
|
||||||
};
|
};
|
||||||
|
swaylock = {
|
||||||
|
package = mkOption {
|
||||||
|
description = "Swaylock package to use";
|
||||||
|
default =
|
||||||
|
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaylock-effects;
|
||||||
|
};
|
||||||
|
command = mkOption {
|
||||||
|
description = "Swaylock package to use";
|
||||||
|
default = ''
|
||||||
|
--screenshots --grace 30 --indicator --clock --timestr "%-I:%M:%S %p" --datestr "%A %Y-%M-%d" --effect-blur 20x3'';
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# Linux specific programs
|
# Linux specific programs
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
swaylock-package = config.nathan.config.desktop.swaylock.package;
|
||||||
|
swaylock-command = config.nathan.config.desktop.swaylock.command;
|
||||||
|
targets = config.nathan.config.desktop.targets;
|
||||||
|
in lib.mkMerge [
|
||||||
|
(lib.mkIf config.nathan.programs.hyprland.enable {
|
||||||
|
wayland.windowManager.hyprland.extraConfig = ''
|
||||||
|
bind = SUPER, Z, exec, ${swaylock-package}/bin/swaylock ${swaylock-command}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
({
|
||||||
|
home.packages = with pkgs; [ swaylock-package swayidle ];
|
||||||
|
|
||||||
|
services.swayidle = {
|
||||||
|
enable = true;
|
||||||
|
timeouts = [
|
||||||
|
# Lock the screen after 5 minutes of inactivity
|
||||||
|
{
|
||||||
|
timeout = 300;
|
||||||
|
command = "${swaylock-package}/bin/swaylock ${
|
||||||
|
builtins.replaceStrings [ "%" ] [ "%%" ] swaylock-command
|
||||||
|
}";
|
||||||
|
}
|
||||||
|
# Turn off the displays after 10 minutes of inactivity
|
||||||
|
{
|
||||||
|
timeout = 600;
|
||||||
|
command = "hyprctl dispatch dpms off";
|
||||||
|
resumeCommand = "hyprctl dispatch dpms on";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
systemd.user.services.swayidle = { Install = { WantedBy = targets; }; };
|
||||||
|
})
|
||||||
|
]
|
|
@ -1,14 +1,9 @@
|
||||||
{ config, lib, pkgs, inputs, ... }@args:
|
{ config, lib, pkgs, inputs, ... }@args:
|
||||||
let nathan = config.nathan;
|
let nathan = config.nathan;
|
||||||
in with lib; {
|
in with lib; {
|
||||||
imports = [ ./desktop/waybar.nix ];
|
imports = [ ./desktop/waybar.nix ./desktop/locking.nix ];
|
||||||
config = mkIf nathan.programs.hyprland.enable (let
|
config = mkIf nathan.programs.hyprland.enable (let
|
||||||
swaylock-package =
|
fuzzel-command = config.nathan.config.desktop.fuzzel-command;
|
||||||
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaylock-effects;
|
|
||||||
swaylock-command = ''
|
|
||||||
${swaylock-package}/bin/swaylock --screenshots --grace 30 --indicator --clock --timestr "%-I:%M:%S %p" --datestr "%A %Y-%M-%d" --effect-blur 20x3'';
|
|
||||||
# fuzzel-command = config.nathan.config.desktop.fuzzel-command;
|
|
||||||
fuzzel-command = "";
|
|
||||||
notif-package =
|
notif-package =
|
||||||
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter;
|
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter;
|
||||||
shortcuts = inputs.self.packages.${pkgs.system}.shortcuts;
|
shortcuts = inputs.self.packages.${pkgs.system}.shortcuts;
|
||||||
|
@ -16,10 +11,8 @@ in with lib; {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# General
|
# General
|
||||||
killall
|
killall
|
||||||
# Locking and display management
|
# Display management
|
||||||
wdisplays
|
wdisplays
|
||||||
swaylock-package
|
|
||||||
swayidle
|
|
||||||
# Clipboard
|
# Clipboard
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
cliphist
|
cliphist
|
||||||
|
@ -145,7 +138,6 @@ in with lib; {
|
||||||
bind = $mainMod, R, exec, ${fuzzel-command} --prompt='❯ '
|
bind = $mainMod, R, exec, ${fuzzel-command} --prompt='❯ '
|
||||||
bind = $mainMod, P, pseudo, # dwindle
|
bind = $mainMod, P, pseudo, # dwindle
|
||||||
bind = $mainMod, B, togglesplit, # dwindle
|
bind = $mainMod, B, togglesplit, # dwindle
|
||||||
bind = $mainMod, Z, exec, ${swaylock-command}
|
|
||||||
|
|
||||||
# Move focus with mainMod + arrow keys
|
# Move focus with mainMod + arrow keys
|
||||||
bind = $mainMod, H, movefocus, l
|
bind = $mainMod, H, movefocus, l
|
||||||
|
@ -387,28 +379,6 @@ in with lib; {
|
||||||
Install = { WantedBy = [ "hyprland-session.target" ]; };
|
Install = { WantedBy = [ "hyprland-session.target" ]; };
|
||||||
};
|
};
|
||||||
#########################
|
#########################
|
||||||
## Swayidle
|
|
||||||
#########################
|
|
||||||
services.swayidle = {
|
|
||||||
enable = true;
|
|
||||||
timeouts = [
|
|
||||||
# Lock the screen after 5 minutes of inactivity
|
|
||||||
{
|
|
||||||
timeout = 300;
|
|
||||||
command = builtins.replaceStrings [ "%" ] [ "%%" ] swaylock-command;
|
|
||||||
}
|
|
||||||
# Turn off the displays after 10 minutes of inactivity
|
|
||||||
{
|
|
||||||
timeout = 600;
|
|
||||||
command = "hyprctl dispatch dpms off";
|
|
||||||
resumeCommand = "hyprctl dispatch dpms on";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
systemd.user.services.swayidle = {
|
|
||||||
Install = { WantedBy = [ "hyprland-session.target" ]; };
|
|
||||||
};
|
|
||||||
#########################
|
|
||||||
## EasyEffects
|
## EasyEffects
|
||||||
#########################
|
#########################
|
||||||
services.easyeffects.enable = true;
|
services.easyeffects.enable = true;
|
||||||
|
|
Loading…
Reference in New Issue