I use i3wm, with betterlockscreen to lock the screen. I want to use XScreensaver to launch a Screensaver when I lock the screen manually and then return to the locked betterlockscreen after I move the mouse or press a key.
XScreensaver has the screensaver I want but not a good lock screen. I tried gnome-screensaver (which shows a blank screen, and I found no way to configure it). Light Locker and Slim are good replacements for the lockscreen part of XScreensaver, but don’t support screensavers.
I can start the screensaver by executing it from /usr/lib/xscreensaver but that is of no use without XScreensaver.
I have configured i3lock and script which blurs the screen - hit Ctrl-Alt-Del - then L - nothing fancy - and something I rarely use - but I reckon the it is necessary for many users.
The different screen savers you can choose - is those separate binaries/scripts - I mean - they cannot all be a part of the bin - but must be implemented as libraries or something - if I look at xsreensaver - there is a lot of backends and frontends and choices - just check with AUR
Following script should do what you want. It’s watching the status of the xscreensaver until it is UNBLANK.
#!/bin/bash
xscreensaver-command -activate &
xscreensaver-command -watch | while read -r line
do
if [[ ${line::1} == U ]]
then
killall xscreensaver-command
betterlockscreen -l
fi
done