1
0
mirror of https://github.com/kmein/niveum synced 2026-03-17 10:41:06 +01:00
Files
niveum/configs/xautolock.nix

40 lines
924 B
Nix
Raw Normal View History

2019-06-15 20:15:04 +02:00
{ config, pkgs, lib, ... }:
let
2020-01-03 12:01:46 +01:00
suspendIfBored = false;
2019-06-15 20:15:04 +02:00
xlockModes = lib.concatStringsSep "\\n" [
2019-06-17 19:10:42 +02:00
# "braid"
2019-06-15 20:15:04 +02:00
"galaxy"
# "lightning"
2019-06-17 19:10:42 +02:00
# "matrix"
2019-06-15 20:15:04 +02:00
"pyro2"
"space"
];
2019-07-03 22:12:40 +02:00
my-xlock = pkgs.writers.writeDashBin "xlock" ''
2019-06-15 20:15:04 +02:00
MODE=$(printf "${xlockModes}" | shuf -n 1)
2019-04-19 03:11:51 +02:00
2019-06-15 20:15:04 +02:00
${pkgs.xlockmore}/bin/xlock \
-saturation 0.4 \
-erasemode no_fade \
+description \
-showdate \
-username " " \
-password " " \
-info " " \
-validate "..." \
-invalid "Computer says no." \
-mode "$MODE"
'';
2020-06-10 17:37:25 +02:00
in {
2019-06-08 15:00:57 +02:00
services.xserver.xautolock = rec {
2019-04-19 03:11:51 +02:00
enable = true;
2020-06-10 17:37:25 +02:00
killer =
if suspendIfBored then "${pkgs.systemd}/bin/systemctl suspend" else null;
2019-06-15 20:15:04 +02:00
locker = "${my-xlock}/bin/xlock";
2019-06-08 15:00:57 +02:00
nowlocker = locker;
2019-04-19 03:11:51 +02:00
enableNotifier = true;
2020-06-10 17:37:25 +02:00
notifier = ''
${pkgs.libnotify}/bin/notify-send -u normal -a xautolock "Locking" "in 10 seconds."'';
2019-04-19 03:11:51 +02:00
};
}