Created attachment 2239 Add slock to xflock4 In the attached patch, I put slock as the first try - my rationale is that slock is obscure enough that if anyone has it installed, I'd expect that they will prefer to use it.
If an user is running (x|gnome-)screensaver this one should be run preferently :)
Created attachment 2241 Try #2 Good point. How's this? (hopefully it's not overcomplicated) * attached patch implements this version * if test x"$(which slock 2>/dev/null)" != x"" ; then if ! ( ps -fC xscreensaver | grep $USER ) ; then if ! ( ps -fC gnome-screensaver | grep $USER ) ; then slock fi fi elif test x"$(which xscreensaver-command 2>/dev/null)" != x"" ; then xscreensaver-command -lock elif test x"$(which gnome-screensaver-command 2>/dev/null)" != x"" ; then gnome-screensaver-command --lock else xlock $* fi exit 0
I don't really like grepping through ps output. 'xscreensaver-command -version' will return a nonzero exit status if xscreensaver isn't running, so you can test that. Should figure out how to do something similar with gnome-screensaver.
Okay, rather than a patch, here's my latest proposal. It's a few more lines than what is currently present though... I've got a request for some gnome guys to verify that gnome-screensaver behaves the same as xscreensaver with respect to what -command returns if the daemon isn't running, but assuming it does, I think this will work: if [ -x $(which xscreensaver-command 2>/dev/null) ]; then xscreensaver-command -lock || break fi if [ -x $(which gnome-screensaver-command --lock 2>/dev/null) ]; then gnome-screensaver-command --lock || break fi if [ -x $(which slock 2>/dev/null) ]; then slock || break fi xlock $* exit 0
Geez. Sorry for the bug spam, but I overlooked an obvious problem. The following should be good now: if [ -x $(which xscreensaver-command 2>/dev/null) ]; then xscreensaver-command -lock || break exit 0 fi if [ -x $(which gnome-screensaver-command --lock 2>/dev/null) ]; then gnome-screensaver-command --lock || break exit 0 fi if [ -x $(which slock 2>/dev/null) ]; then slock || break exit 0 fi # If none of the above return successfully, then fallback to xlock xlock $* exit 0
Created attachment 2257 Try #3 - hopefully final After discussion on IRC with Brian, the new patch should be sufficient, I think.
*** This bug has been marked as a duplicate of bug 6253 ***