From 6dc85e2832af7e5507f0ef708a6dc54c71afd820 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Tue, 25 Mar 2025 16:44:02 -0400 Subject: [PATCH] feh slideshow on one monitor --- scripts/executable_dual-monitor-slideshow | 64 ++++++++++++----------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/scripts/executable_dual-monitor-slideshow b/scripts/executable_dual-monitor-slideshow index 2f20312..779d4c3 100755 --- a/scripts/executable_dual-monitor-slideshow +++ b/scripts/executable_dual-monitor-slideshow @@ -1,41 +1,43 @@ #!/usr/bin/env fish # Find a random image -set image (fdfind -e jpg -e jpeg -e png -e webp . /mnt/linux-files-2/Pictures/hevin | shuf -n 1) +#set image (fdfind -e jpg -e jpeg -e png -e webp . /mnt/linux-files-2/Pictures/hevin | shuf -n 1) -# Create blurred lock image -convert "$image" -resize 1920x1080^ -gravity center -extent 1920x1080 /tmp/lock.png +## Create blurred lock image +#convert "$image" -resize 1920x1080^ -gravity center -extent 1920x1080 /tmp/lock.png -# Lock with i3lock-color -i3lock -n -i /tmp/lock.png +## Lock with i3lock-color +#i3lock -n -i /tmp/lock.png +# -------------------- #!/usr/bin/env fish -# Directory containing your wallpapers -#set WALLPAPER_DIR ~/Pictures/Screensaver +set WALLPAPER_DIR "/mnt/linux-files-2/Pictures/hevin" +set CYCLE_TIME 5 # Seconds between image changes +set LOCK_AFTER 500 # Activate real lock after 30 seconds of screensaver -## Get a list of monitors -#set MONITORS (xrandr --listmonitors | grep -v 'Monitors:' | awk '{print $4}') - -## Generate blurred lock images for each monitor -#for monitor in $MONITORS - ## Pick a random image for this monitor - #set IMAGE (fdfind -e jpg -e jpeg -e png -e webp . $WALLPAPER_DIR | shuf -n 1) +# Use a transparent window to cover everything +while true + set image (fdfind -e jpg -e jpeg -e png -e webp . $WALLPAPER_DIR | shuf -n 1) - ## Generate a blurred version at /tmp/lock-$monitor.png - #convert "$IMAGE" \ - #-resize 1920x1080^ \ - #-gravity center \ - #-extent 1920x1080 \ - #-blur 0x8 \ - #"/tmp/lock-$monitor.png" -#end - -## Build i3lock command for each monitor -#set LOCK_CMD "i3lock-color -n" -#for monitor in $MONITORS - #set LOCK_CMD "$LOCK_CMD --image=/tmp/lock-$monitor.png --screen=$monitor --ignore-empty-password" -#end - -## Execute the lock command -#eval $LOCK_CMD + # Create fullscreen image + convert "$image" -resize (xrandr | grep '*' | head -1 | awk '{print $1}')^ \ + -gravity center -extent (xrandr | grep '*' | head -1 | awk '{print $1}') \ + /tmp/screensaver.png + + # Display fullscreen using feh + feh --fullscreen --hide-pointer --no-fehbg /tmp/screensaver.png & + set feh_pid $last_pid + + # Wait for timeout or mouse movement + sleep $CYCLE_TIME + kill $feh_pid + + # After longer timeout, activate real lock + if test (math $CYCLE_TIME \* $count) -ge $LOCK_AFTER + i3lock -n -i /tmp/screensaver.png + set count 0 + else + set count (math $count + 1) + end +end