From eb0c53d8e21c51ac82c43f0114eabdee9853a366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 11 Jun 2024 00:53:59 +0200 Subject: [PATCH] Improve lockhelper for gunter --- home/hyprland/hypridle_gunter.conf | 4 ++-- home/hyprland/hyprland_gunter.nix | 2 +- home/hyprland/hyprlock_gunter.conf | 32 ++++++++++++++++++++++++++++-- home/scripts/lockhelper.nix | 3 ++- home/scripts/lockhelper.sh | 9 +++++++-- home/scripts/randomwp.sh | 2 +- 6 files changed, 43 insertions(+), 9 deletions(-) diff --git a/home/hyprland/hypridle_gunter.conf b/home/hyprland/hypridle_gunter.conf index d7b2820..346b64e 100644 --- a/home/hyprland/hypridle_gunter.conf +++ b/home/hyprland/hypridle_gunter.conf @@ -1,12 +1,12 @@ general { lock_cmd = hyprlock # dbus/sysd lock command (loginctl lock-session) # unlock_cmd = notify-send "unlock!" # same as above, but unlock - before_sleep_cmd = hyprlock # command ran before sleep + before_sleep_cmd = lockhelper # command ran before sleep # after_sleep_cmd = # command ran after sleep ignore_dbus_inhibit = false # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam) } listener { timeout = 240 # in seconds - on-timeout = hyprlock # command to run when timeout has passed + on-timeout = lockhelper # command to run when timeout has passed } diff --git a/home/hyprland/hyprland_gunter.nix b/home/hyprland/hyprland_gunter.nix index 0a19c4b..d5419c0 100644 --- a/home/hyprland/hyprland_gunter.nix +++ b/home/hyprland/hyprland_gunter.nix @@ -132,7 +132,7 @@ "$mainMod,Return,exec,$term" # hyprlock - "$shiftMainMod,l,exec,hyprlock" + "$shiftMainMod,l,exec,lockhelper" # rofi "$mainMod,D,exec,rofi-launcher" diff --git a/home/hyprland/hyprlock_gunter.conf b/home/hyprland/hyprlock_gunter.conf index 030bceb..168bdc4 100644 --- a/home/hyprland/hyprlock_gunter.conf +++ b/home/hyprland/hyprlock_gunter.conf @@ -1,7 +1,35 @@ # BACKGROUND background { - monitor = - path = ~/wallpapers/current + monitor = DP-5 + path = /tmp/lockscreen/DP-5.png + blur_passes = 3 + contrast = 0.8916 + brightness = 0.8172 + vibrancy = 0.1696 + vibrancy_darkness = 0.0 +} + +background { + monitor = DP-6 + path = /tmp/lockscreen/DP-6.png + blur_passes = 3 + contrast = 0.8916 + brightness = 0.8172 + vibrancy = 0.1696 + vibrancy_darkness = 0.0 +} +background { + monitor = DP-7 + path = /tmp/lockscreen/DP-7.png + blur_passes = 3 + contrast = 0.8916 + brightness = 0.8172 + vibrancy = 0.1696 + vibrancy_darkness = 0.0 +} +background { + monitor = DP-8 + path = /tmp/lockscreen/DP-8.png blur_passes = 3 contrast = 0.8916 brightness = 0.8172 diff --git a/home/scripts/lockhelper.nix b/home/scripts/lockhelper.nix index 3302fda..7b51fc4 100644 --- a/home/scripts/lockhelper.nix +++ b/home/scripts/lockhelper.nix @@ -3,7 +3,8 @@ let lockhelper = pkgs.writeShellApplication { name = "lockhelper"; runtimeInputs = with pkgs; [ - grimblast + grim + jq ]; text = (builtins.readFile ./lockhelper.sh); }; diff --git a/home/scripts/lockhelper.sh b/home/scripts/lockhelper.sh index e35f87b..5d78521 100644 --- a/home/scripts/lockhelper.sh +++ b/home/scripts/lockhelper.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -eo pipefail -grimblast save output /tmp/lock.png || true -hyprlock +mkdir -p /tmp/lockscreen || true +monitors=$(hyprctl monitors -j | jq -r '.[] | select( .name | contains ("DP")) | .name') + +while IFS= read -r m; do + grim -o "$m" "/tmp/lockscreen/$m.png" || true +done <<< "$monitors" +hyprlock diff --git a/home/scripts/randomwp.sh b/home/scripts/randomwp.sh index 52afe56..e257521 100644 --- a/home/scripts/randomwp.sh +++ b/home/scripts/randomwp.sh @@ -39,7 +39,7 @@ if command -v wal &> /dev/null; then wal -i "$wallpaper_path" fi -unlink "$WALLPAPER_DIR/current" || true +unlink "$WALLPAPER_DIR/current.png" || true ln -s "$wallpaper_path" "$WALLPAPER_DIR/current.png" for monitor in $(hyprctl monitors | grep 'Monitor' | awk '{ print $2 }'); do