Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
@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_inevitable May 18 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. –  Braiam May 18 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_inevitable May 18 at 21:47
    
Seriously? cdimage.ubuntu.com/daily-live/current try it out. –  Braiam May 18 at 21:50
    
@Braiam that is not a release. –  d_inevitable May 18 at 21:51

2 Answers 2

There is no way of doing this unfortunately :(

Update - I have found a way. Check out my newer answer

This is my previous solution - It is unadvisable to use, it is not unlockable if you lose your phone; you have to restart to unlock it

I eventually came up with a solution - don't lock it in the first place. This may sound odd - bear with.

Instead of locking it, I disabled the Mouse and Keyboard, hid all desktop icons and then switched to the desktop. You could possibly hide more stuff (like the launcher) but I have that hidden anyway.

This command requires a bit of setup.

Install : xdotool - sudo apt-get install xdotool

Enter: xinput --list and note down your mouse and keyboard ids.

I would suggest editing these commands in gedit

This one acts as the locker.

xinput set-prop <Keyboard ID> 'Device Enabled' 0 && xinput set-prop <Mouse ID> 'Device Enabled' 0 && gsettings set org.gnome.desktop.background show-desktop-icons false && wmctrl -k on

This acts as the unlock.

xinput set-prop <Keyboard ID> 'Device Enabled' 1 && xinput set-prop <Mouse ID> 'Device Enabled' 1 && gsettings set org.gnome.desktop.background show-desktop-icons true && wmctrl -k off

Change the and to their respective numbers, in both commands.

In order this:

  • Disables / Enables the Keyboard
  • Disables / Enables the Mouse
  • Hides / Shows all your desktop icons
  • Toggles showing your desktop.

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.

share|improve this answer
    
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_inevitable May 16 at 15:40
    
That's even better! I was just about to post another idea, but I'll get working on that! –  Tim May 16 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. –  Tim May 17 at 19:48

Update! There is a way to use the normal lock screen! Yay!

I don't know how secure it is (storing your password in plaintext), but I think it is the best possible.

This is the lock command: gnome-screensaver -d

There are 2 unlock commands:

No1:

This is the 1st unlock command:

gnome-screensaver -d && xdotool type mypassword12 && xdotool key Return

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).

  1. Pause: enter 3 seconds.
  2. 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).
  3. Write text: enter your password in the box
  4. 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.

share|improve this answer
    
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_inevitable May 18 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. –  Tim May 19 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 Vliet Jul 2 at 13:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.