pinwheel: Add and use physlock module

This commit is contained in:
Alexander Heldt
2023-10-21 19:44:04 +02:00
parent 2cd1a0a730
commit f927cb49b1
3 changed files with 46 additions and 1 deletions

View File

@@ -78,7 +78,8 @@
nix-index.enable = true; nix-index.enable = true;
greetd.enable = true; greetd.enable = true;
hyprland.enable = true; hyprland.enable = true;
swaylock.enable = true; swaylock.enable = false;
physlock.enable = true;
git.enable = true; git.enable = true;
openvpn.enable = true; openvpn.enable = true;
go.enable = true; go.enable = true;

View File

@@ -24,6 +24,8 @@ in
env = GDK_DPI_SCALE,1.5 env = GDK_DPI_SCALE,1.5
env = XCURSOR_SIZE,64 env = XCURSOR_SIZE,64
monitor=eDP-1, 1920x1200, 0x0, 1
workspace = 1, monitor:HDMI-A-1 workspace = 1, monitor:HDMI-A-1
workspace = 2, monitor:HDMI-A-1 workspace = 2, monitor:HDMI-A-1
workspace = 3, monitor:HDMI-A-1 workspace = 3, monitor:HDMI-A-1

View File

@@ -0,0 +1,42 @@
{ pkgs, lib, config, ... }:
let
enabled = config.mod.physlock.enable;
hyprlandEnabled = config.mod.hyprland.enable;
in
{
options = {
mod.physlock = {
enable = lib.mkEnableOption "enable physlock module";
};
};
config = lib.mkIf enabled {
services.physlock = {
enable = true;
# Wraps the `physlock` binary in a "wrapper" which allows any
# user to run the wrapper (located in `config.security.wrapperDir`)
allowAnyUser = true;
lockOn = {
hibernate = true;
suspend = true;
};
};
home-manager.users.alex = {
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind =
let
pause-music = "${pkgs.playerctl}/bin/playerctl -p spotify pause";
in
[
"$mod SHIFT, x, exec, ${pause-music}; systemctl suspend"
"$mod, x, exec, ${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m"
];
};
};
};
};
}