Repository navigation
xscreensaver getimage file
Prints the name of a file in a directory. Iterates through files in the directory in sequence between each invocation (case insensitive ascending), with a 2s buffer.
Used to override xscreensaver-getimage-file from xscreensaver, which returns image files randomly.
Requirement: Desktop wallpaper transition in sequence on multiple monitors. The wallpaper shown on each monitor should be synchronised
Environment:
- Multihead 2 x 1920 x 1080 monitors,
xrandred into a single 3840 x 1080 screen - Openbox
-
~/.fehbgto set wallpaper - Conky, with
own_window_transparent = true
Setting wallpaper directly with ~/.fehbg in a cronjob would work, but there aren't fadein fadeout transitions.
Instead, glslideshow from xscreensaver was used to enable transitions:
/usr/lib/xscreensaver/glslideshow -root -zoom 100 -fade 1 -duration 5
.xscreensaver file:
grabDesktopImages: False
grabVideoFrames: False
chooseRandomImages: True
imageDirectory: /home/user/wallpapers
Each wallpaper was also converted to 3840 x 1080: convert wallpaper.png wallpaper.png +append wallpaper2x.png
But conky doesn't keep transparency. Conky has to be setup with argb and a compositing manager to enable true transparency. compton was used, and conky is setup as follows:
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_transparent = false,
But now glslideshow doesn't work. It has to be wrapped in xwinwrap, and run once for each monitor:
xwinwrap -b -nf -ni -sp -st -ov -g 1920x1080+0+0 -- /usr/lib/xscreensaver/glslideshow -root -zoom 100 -fade 1 -duration 5 -window-id WID &
xwinwrap -b -nf -ni -sp -st -ov -g 1920x1080+1920+0 -- /usr/lib/xscreensaver/glslideshow -root -zoom 100 -fade 1 -duration 5 -window-id WID &
glslideshow statelessly executes xscreensaver-getimage-file, which first writes a cache file $HOME/xscreensaver/xscreensaver-getimage.cache consisting of paths of image files in the wallpaper directory. It then randomly selects an entry in the cache file and prints to stdout to be used by glslideshow.
If two instances of glslideshow are run simultaneously, this means:
- Images shown on both monitors are different
- The images don't run in sequence
A Python3 script is placed in $HOME/bin to override xscreensaver-getimage-file in xscreensaver.
It writes $HOME/.cache/xscreensaver/xscreensaver-getimage-alt.cache which contains last updated time (within 2s) and image file. Continous invocations of the script within 2s will return the same value, after which it will return the next file in sequence (wrapping around if necessary)