1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat: disable xautolock, lock only manually

This commit is contained in:
2020-12-13 20:08:26 +01:00
parent 10ad21a39c
commit 72f04f9391
5 changed files with 28 additions and 42 deletions

View File

@@ -233,7 +233,6 @@ in {
./vscode.nix
./watson.nix
./wifi.nix
./xautolock.nix
./zsh.nix
];
}

View File

@@ -201,7 +201,7 @@ in {
"${modifier}+t" = "exec ${(defaultApplications pkgs).fileManager}";
"${modifier}+y" = "exec ${(defaultApplications pkgs).browser}";
"${modifier}+Shift+w" = "exec ${pkgs.xautolock}/bin/xautolock -locknow";
"${modifier}+Shift+w" = "exec ${pkgs.scripts.k-lock}/bin/k-lock";
"${modifier}+a" =
"exec --no-startup-id ${pkgs.rofi}/bin/rofi -display-window -show window";
"${modifier}+d" = "exec --no-startup-id ${pkgs.dmenu}/bin/dmenu_run";
@@ -245,7 +245,7 @@ in {
"exec --no-startup-id ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPrev" =
"exec --no-startup-id ${pkgs.playerctl}/bin/playerctl previous";
"XF86ScreenSaver" = "exec ${pkgs.xautolock}/bin/xautolock -locknow";
"XF86ScreenSaver" = "exec ${pkgs.scripts.k-lock}/bin/k-lock";
"XF86Display" = "exec ${pkgs.scripts.dmenurandr}/bin/dmenurandr";

View File

@@ -1,39 +0,0 @@
{ config, pkgs, lib, ... }:
let
suspendIfBored = false;
xlockModes = lib.concatStringsSep "\\n" [
# "braid"
"galaxy"
# "lightning"
# "matrix"
"pyro2"
"space"
];
my-xlock = pkgs.writers.writeDashBin "xlock" ''
MODE=$(printf "${xlockModes}" | shuf -n 1)
${pkgs.xlockmore}/bin/xlock \
-saturation 0.4 \
-erasemode no_fade \
+description \
-showdate \
-username " " \
-password " " \
-info " " \
-validate "..." \
-invalid "Computer says no." \
-mode "$MODE"
'';
in {
services.xserver.xautolock = rec {
enable = true;
killer =
if suspendIfBored then "${pkgs.systemd}/bin/systemctl suspend" else null;
locker = "${my-xlock}/bin/xlock";
nowlocker = locker;
enableNotifier = true;
notifier = ''
${pkgs.libnotify}/bin/notify-send -u normal -a xautolock "Locking" "in 10 seconds."'';
};
}

View File

@@ -242,4 +242,5 @@ in rec {
bvg = pkgs.callPackage ./bvg.nix { };
nav = pkgs.callPackage ./nav.nix { };
k-lock = pkgs.callPackage ./k-lock.nix { };
}

View File

@@ -0,0 +1,25 @@
{ writers, lib, xlockmore }:
let
xlockModes = lib.concatStringsSep "\\n" [
# "braid"
"galaxy"
# "lightning"
# "matrix"
"pyro2"
"space"
];
in writers.writeDashBin "k-lock" ''
MODE=$(printf "${xlockModes}" | shuf -n 1)
${xlockmore}/bin/xlock \
-saturation 0.4 \
-erasemode no_fade \
+description \
-showdate \
-username " " \
-password " " \
-info " " \
-validate "..." \
-invalid "Computer says no." \
-mode "$MODE"
''