Browse Source

feh slideshow on one monitor

slideshow-screensaver
Kevin Mok 1 week ago
parent
commit
64f5c77d37
Signed by: Kevin-Mok GPG Key ID: FB0DA56BEB5D98F3
  1. 2
      aliases/key_aliases.tmpl
  2. 122
      scripts/executable_dual-monitor-slideshow

2
aliases/key_aliases.tmpl

@ -1047,6 +1047,8 @@ ttrtk "timetrace report -s 2023-04-20 -p totk"
cpsdv "cp * /home/kevin/Documents/stardew-valley-sdv-saves/hevintales"
rclh "rclone copy --progress hevin:/ ."
# ]]] games #
# work [[[ #

122
scripts/executable_dual-monitor-slideshow

@ -1,41 +1,107 @@
#!/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)
## 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
## Generate a blurred version at /tmp/lock-$monitor.png
#convert "$IMAGE" \
#-resize 1920x1080^ \
#-gravity center \
#-extent 1920x1080 \
#-blur 0x8 \
#"/tmp/lock-$monitor.png"
## 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
## 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
# --------------------
#!/usr/bin/env fish
# Configuration
set WALLPAPER_DIR "/mnt/linux-files-2/Pictures/hevin"
set CYCLE_TIME 5 # Seconds between image changes
#set BLUR_AMOUNT "0x5" # Set to "0x0" for no blur
set BLUR_AMOUNT "0x0" # Set to "0x0" for no blur
# Get monitor information - sanitize names by replacing hyphens with underscores
set monitors (xrandr --query | grep " connected" | awk '{print $1}' | string replace -a '-' '_')
set geometries (xrandr --query | grep -A1 " connected" | grep -v " connected" | awk '{print $1}')
# Verify we found monitors
if test (count $monitors) -eq 0
echo "Error: No monitors detected!"
exit 1
end
# Create monitor geometry mapping
set -g monitor_geometries
for i in (seq (count $monitors))
set monitor $monitors[$i]
set geo $geometries[$i]
if test -z "$geo"
echo "Warning: Could not get geometry for monitor $monitor, using default 1920x1080"
set geo "1920x1080"
end
set monitor_geometries $monitor_geometries "$monitor:$geo"
end
while true
# Use only the first monitor's geometry
set entry $monitor_geometries[1]
set monitor (echo $entry | cut -d':' -f1)
set geo (echo $entry | cut -d':' -f2)
set width (echo $geo | cut -d'x' -f1)
set height (echo $geo | cut -d'x' -f2)
# Select and process image
set image (fdfind -e jpg -e jpeg -e png -e webp . $WALLPAPER_DIR | shuf -n 1)
if test -n "$image"
convert "$image" \
-resize {$width}x{$height}^ \
-gravity center \
-extent {$width}x{$height} \
-blur $BLUR_AMOUNT \
"/tmp/screensaver-$monitor.png"
# Display image on single monitor
feh --no-fehbg --hide-pointer --fullscreen --title 'screensaver' "/tmp/screensaver-$monitor.png" &
set feh_pid $last_pid
## Execute the lock command
#eval $LOCK_CMD
# Wait for cycle time
sleep $CYCLE_TIME
# Kill feh process
kill $feh_pid 2>/dev/null
else
echo "Error: No images found in $WALLPAPER_DIR"
exit 1
end
end
Loading…
Cancel
Save