mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-22 08:04:20 +01:00
Improved screenlocker with wallpapers
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
8116fc9940
commit
04ac85ae0a
|
@ -1,17 +0,0 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
systemd.user.services.light-locker = {
|
||||
Unit = {
|
||||
Description = "LightLocker screen locker";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
ExecStart = ''/bin/sh -l -c "${lib.getExe pkgs.lightlocker} --lock-on-suspend"'';
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
};
|
||||
}
|
|
@ -195,7 +195,7 @@ dbe = false;
|
|||
|
||||
# Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows, like games.
|
||||
# Known to cause flickering when redirecting/unredirecting windows.
|
||||
unredir-if-possible = false;
|
||||
unredir-if-possible = true;
|
||||
|
||||
# Specify a list of conditions of windows that should always be considered focused.
|
||||
focus-exclude = [ ];
|
||||
|
|
|
@ -32,13 +32,13 @@ in
|
|||
../picom
|
||||
../dunst
|
||||
../keynav
|
||||
../lightlocker
|
||||
../bash
|
||||
../emacs
|
||||
../xmonad
|
||||
../pantalaimon.nix
|
||||
../ssh.nix
|
||||
../wallpaper
|
||||
../screenlocker
|
||||
];
|
||||
|
||||
programs.librewolf = {
|
||||
|
|
54
home-manager/modules/screenlocker/default.nix
Normal file
54
home-manager/modules/screenlocker/default.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
singleton
|
||||
getExe
|
||||
makeBinPath;
|
||||
|
||||
locker = pkgs.writeShellScript "i3lock-dynamic-image" ''
|
||||
export PATH=${makeBinPath (with pkgs; [ gnugrep coreutils xorg.xdpyinfo imagemagick i3lock ])}:$PATH
|
||||
|
||||
WALLPAPER_CACHE="$HOME/.local/tmp/wallpaper_cache"
|
||||
|
||||
mkdir -p $WALLPAPER_CACHE
|
||||
|
||||
SCREEN_RESOLUTION="$(xdpyinfo | grep dimensions | cut -d' ' -f7)"
|
||||
IMAGEFILE="$WALLPAPER_CACHE/$(sha256sum $HOME/.config/wallpaper | tr -s ' ' | cut -f 1 -d' ').png"
|
||||
I3LOCK="i3lock -d -c 000000 -i $IMAGEFILE"
|
||||
|
||||
if ! [[ -e "$IMAGEFILE" ]]
|
||||
then
|
||||
convert "$HOME/.config/wallpaper" -gravity Center -background "#000000" -extent "$SCREEN_RESOLUTION" "$IMAGEFILE"
|
||||
fi
|
||||
|
||||
if [[ -e /dev/fd/''${XSS_SLEEP_LOCK_FD:--1} ]]; then
|
||||
kill_i3lock() {
|
||||
pkill -xu $EUID "$@" i3lock
|
||||
}
|
||||
|
||||
trap kill_i3lock TERM INT
|
||||
|
||||
$I3LOCK {XSS_SLEEP_LOCK_FD}<&-
|
||||
|
||||
exec {XSS_SLEEP_LOCK_FD}<&-
|
||||
|
||||
while kill_i3lock -0; do
|
||||
sleep 0.5
|
||||
done
|
||||
else
|
||||
trap 'kill %%' TERM INT
|
||||
$I3LOCK
|
||||
wait
|
||||
fi
|
||||
'';
|
||||
in
|
||||
{
|
||||
services.screen-locker = {
|
||||
enable = true;
|
||||
inactiveInterval = 5;
|
||||
|
||||
xss-lock.extraOptions = singleton "--transfer-sleep-lock";
|
||||
|
||||
lockCmd = toString locker;
|
||||
};
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
name = "xmonad.hs";
|
||||
file = ./xmonad.hs;
|
||||
substitutes = {
|
||||
"lightLockerCommand" = "${pkgs.lightlocker}/bin/light-locker-command";
|
||||
"brightnessctl" = lib.getExe pkgs.brightnessctl;
|
||||
"playerctl" = lib.getExe pkgs.playerctl;
|
||||
"dmenu_run" = "${pkgs.dmenu}/bin/dmenu_run";
|
||||
|
|
|
@ -138,7 +138,7 @@ myKeymap c =
|
|||
, ("M-S-l", withFocused (xMoveWindow ( 0,-10)))
|
||||
, ("M-S-ß", withFocused (xMoveWindow ( 10, 0)))
|
||||
|
||||
, ("M-z", spawn "@lightLockerCommand@ --lock")
|
||||
, ("M-z", spawn "loginctl lock-session")
|
||||
|
||||
, ("<XF86AudioMute>" , spawn "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle")
|
||||
, ("<XF86AudioRaiseVolume>" , spawn "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+")
|
||||
|
|
Loading…
Reference in a new issue