First of all: great program, great how-to! Genius idea: locking pc on bluetooth signal strength.
Instead of Amarok, I use Rhythmbox and I got it to work with Rhythmbox as well, so here’s a little how-to for Rhythmbox.

  1. Make bash scripts
    To be able to run multiple commands it is preferable to use a bash script. Let’s make some, if you don’t have already.

    1. Open up a terminal and execute the commands in the code blocks.
    2. Let’s create a blueproximity directory in your home-dir.
      Code:
      mkdir ~/.blueproximity
    3. Create the bash files.
      Code:
      touch ~/.blueproximity/lock.sh ~/.blueproximity/unlock.sh
    4. Edit the lock file:
      Code:
      gedit ~/.blueproximity/lock.sh
    5. Insert the following code:
      Code:
      #!/bin/bash
      
      # Lock the screen (default BlueProximity)
      gnome-screensaver-command -l
      # Let's pause Rhythmbox
      rhythmbox-client --pause --no-start
    6. Save and exit Gedit
    7. Likewise for the unlock script:
      Code:
      gedit ~/.blueproximity/unlock.sh
    8. Insert the following code:
      Code:
      #!/bin/bash
      
      # Unlock the screen (default BlueProximity)
      gnome-screensaver-command -d
      # Let's resume Rhythmbox
      rhythmbox-client --play --no-start
    9. Save and exit Gedit
    10. Make the bash scripts executable (and readable) for everybody by using the following command
      Code:
      chmod a+r+x ~/.blueproximity/lock.sh ~/.blueproximity/unlock.sh
  2. Let Blueproximity use your bash scripts
    1. You can now close the terminal and open up the BlueProximity preferences (at tab Locking).
    2. Use as locking command ~/.blueproximity/lock.sh and likewise for the unlocking command ~/.blueproximity/unlock.sh.

Note: The –no-start option makes sure Rhythmbox does not open an instance when there is none. Otherwise, Rhythmbox will start when (un)locking when no instance is open. See also rhythmbox-client –help.

Other possible options for the rhythmbox-client command, see rhythmbox-client –help.
I can think of lowering the volume and bringing up again, in a for-loop to increase it smoothly. Or not pausing the music when your favourite artist is playing at the moment…

Advertisements