mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-07 14:34:07 +09:00
swaylock
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.applications.swaylock;
|
||||
hmCfg = config.my.applications.swaylock.homeManager;
|
||||
in
|
||||
{
|
||||
options.my.applications.swaylock.homeManager = {
|
||||
enable = lib.mkEnableOption "swaylock home-manager configuration";
|
||||
};
|
||||
|
||||
config.home-manager.sharedModules = [
|
||||
(
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
config = lib.mkIf (cfg.enable && hmCfg.enable) {
|
||||
home.packages = with pkgs; [
|
||||
swaylock # Wayland screen locker using ext-session-lock-v1
|
||||
];
|
||||
|
||||
# systemd-lock-handler holds a sleep inhibitor until this service is
|
||||
# ready. swaylock forks only after the compositor confirms the lock.
|
||||
systemd.user.services.swaylock = {
|
||||
Unit = {
|
||||
Description = "Screen locker for Wayland";
|
||||
Documentation = [ "man:swaylock(1)" ];
|
||||
OnSuccess = [ "unlock.target" ];
|
||||
PartOf = [ "lock.target" ];
|
||||
Before = [ "lock.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "forking";
|
||||
ExecStart = "${lib.getExe pkgs.swaylock} -f";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 0;
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "lock.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user