[SOLVED] Using BlueProximity and xscreensaver

  • Josh Harding

    Josh Harding - 2010-06-22

    I use Xfce and want to be able to be able to use BlueProximity and have it work with xscreensaver.  But I read that this doesn't work.  The main issue is that xscreensaver-command doesn't have any options that will unlock the screen.

    So I figured, why not just have BP's unlock command kill xscreensaver?  That means that the lock command has to first start xscreensaver, then tell it to lock.  Easy enough, and it works:

    Set the locking command to:

        (xscreensaver -nosplash &); sleep 1; xscreensaver-command -l

    The parens are needed so that it can be backgrounded and the sleep is just to make sure the daemon starts before we tell it to lock.
    Set the unlocking command to:

        pkill xscreensaver

    The proximity command doesn't really matter since xscreensaver isn't running while you're within range.

  • Josh Harding

    Josh Harding - 2010-06-22

    Oh, I forgot that there's one other change needed to make that work.  Edit BP's proximity.py and remove the ".readlines()" from the end of line 1159, so it reads:

        ret_val = os.popen(self.config)

    Otherwise BP gets stuck waiting for the lock command to finish and won't do the unlock action.

    For those who like to see it formatted as a diff:

    -- proximity.py-orig   2010-06-21 19:57:35.000000000 -0500
    +++ proximity.py        2010-06-21 20:02:51.000000000 -0500
    @@ -1156,7 +1156,7 @@
                 self.logger.log_line(_('screen is locked'))
                 if (self.timeGone==0):
                     self.timeGone = time.time()
    -                ret_val = os.popen(self.config).readlines()
    +                ret_val = os.popen(self.config)
                     self.timeGone = 0
                     self.logger.log_line(_('A command for %s has been skipped because the former command did not finish yet.') % _('locking'))

  • Anonymous - 2011-08-30

    I know this is about a year old, but I stumbled across this information and found it helpful. So, thanks!

    I'd like to add that you don't need to hack the source/scripts. You can get away with creating a function in your ~/.bashrc and call that instead of pkill. e.g.

    function killxscreensaver()
       pkill xscreensaver
       echo ""

    Seems to work fine, and is a little more elegant I would like to think.

  • Jason Smith

    Jason Smith - 2012-01-05

    An alternative to the above workaround, which I have been using, is to use the proximity command to check and make sure xscreensaver is still running and just have the lock and unlock commands lock and kill it.  I also use the daemonize command to put xscreensaver in the background without causing BlueProximity to hang:


    Locking command:  xscreensaver-command -lock

    Unlocking command:  pkill xscreensaver

    Proximity command:  xscreensaver-command -time || daemonize /usr/bin/xscreensaver -no-splash

  • Dan Schmidt

    Dan Schmidt - 2014-09-23

    Necromancy! Hear me dead spirits!

    Seriously though, even though this thread is old, this is the first result I got from Google of "BlueProximity xscreensaver." I thought I should add my two cents.

    Said 2 cents are as follows:
    A. Thanks Jason Smith, I find your daemonize solution to be effective
    B. For some reason, I have much better luck with killall than pkill for the unlock

    With those small modifications, my blueproximity now seems to work. Much thanks to all.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks