I've been happily using blueproximity in 13.10, but since upgrade to 14.04 it only locks when my phone goes out of range (using gnome-screensaver-command -l), but it does not unlock with gnome-screensaver-command -d.

Now the reason that gnome-screensaver-command -d doesn't work is because of a bug.

However on that bug report it is mentioned that the gnome-screensaver is no longer used in trusty and therefore the gnome-screensaver-command is expected to be phased out, which could also be related to why the command doesn't work.

So my question is, if the gnome-screensaver is replaced, then what would be the new command to unlock the screen without relying on gnome-screensaver-command?

@Braiam This question is specific to 14.04 and later. Why did you remove the tag? There is no reason why to avoid using gnome-screensaver-command in earlier versions!
–
d_inevitableMay 18 '14 at 21:25

Yourself answered: 14.04 and later. 14.04 should be used only if that's the only version affected, which is not true since 14.10 has it. BTW, do not ask about bugs.
–
BraiamMay 18 '14 at 21:45

@Braiam 1. I do not know about later!! How can I? There is no later version yet. As of now it is only 14.04. And I did not ask about bugs. So if you don't mind, I will revert your edit.
–
d_inevitableMay 18 '14 at 21:47

One important thing to bear in mind - this can't be undone without your bluetooth device. If for some reason it fails, you have to restart. Because of that, it might be advisable to leave the keyboard enabled, and set up the unlock command to a chosen shortcut.

Hey nice idea! Would it be possible to change such that any keyboard input will lock the screen instead (giving a chance of unlocking it without the bluetooth device) instead of ignoring all keyboard input?
–
d_inevitableMay 16 '14 at 15:40

That's even better! I was just about to post another idea, but I'll get working on that!
–
TimMay 16 '14 at 16:24

@d_inevitable Have a look at my new answer, it is neater (especially the 2nd method). I'm pretty sure it works.
–
TimMay 17 '14 at 19:48

The click is to wake it up (it should click inside the login box, because of the mouse move), and show the nice new lock screen, instead of the "sleeping" black screen.

Then it types mypassword123! with an enter, to submit it, into the text box.

Important. For some reason - probably because of what xdotool is actually meant to be used for (keyboard shortcuts) - you can't enter double letters. To get around this, split it into 2 commands at each double letter (as above). Also, numbers have to have their own, separate command from letters (also above). Finally, modifiers (such as shift) need a separate one, as does the Return key.

No2:

This is the second one. It is a bit better and less hackish, but requires a lot of setting up.

First install actionaz:

sudo apt-get install actionaz

Open a new script, and drag in the correct items to your flow. (you can download the completed one here. If you chose to download this, open it, double click on Write text - Password here, and enter your password).

Pause: enter 3 seconds.

Click: copy and paste 165:555 into the Position box. (Depending on screen side, this may be different. Make sure it is clicking in the password box, otherwise it doesn't work).

Write text: enter your password in the box

Key: Click in the box and press Return

Save it in your home folder as unlock.ascr (or any name - I just didn't want to advertise that it had my password in it)

Set up your proximity command to be:

xdotool mousemove 0 0 && actionaz unlock.ascr -ex

The mouse move wakes it up, and the options tell it to execute the script and then exit at the end.

If you lose your device, you can always just type your password, so it is reversible.

Hey, this look pretty good, but unfortunately storing password in clean text is not option. Its almost as bad a running everything in root as my user is on the sudoers list. But I think a combination of your two answers would work. I will try something out as soon as i can. Basically dim the screen until the mouse moves, a key is pressed or the bluetooth device comes back in range. If mouse moves or key is pressed, switch the screen back on and run gnome-screensaver-command -l so that a password can be entered while the bluetooth device is absent. I think it should be doable.
–
d_inevitableMay 18 '14 at 21:22

I did quickly look at the 'mouse move' option... I was thinking that xev might be able to do that?you could set it up that the mouse moves over the xev window, and if the output changes, you know something has happened.
–
TimMay 19 '14 at 15:01

Agree, storing password in plain text is pretty bad. Having your homedir encrypted - as I think is the default now in Ubuntu - would make it a bit less bad though. I've played a bit around with it, and actually find solution #1 far easier, and don't really consider it all that hackish. Made a small change though. Instead of the mousemove, I put in gnome-screensaver -d as that still wakes up the screen and enables me to have a much shorter sleep (I got it set now to 0.1, but wonder if it's needed at all)
–
Wouter Van VlietJul 2 '14 at 13:43