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.

Ubuntu 14.04 introduces a new lockscreen that looks similar to the login screen.

New lockscreen

I am still able to lock the screen using the command gnome-screensaver-command --lock (as I always did before), which under 14.04 does lock the screen, but:

  • If you are running it from the desktop, it locks the screen using the new lockscreen.
  • If you are running it from a virtual console or via SSH, it locks the screen using the old lockscreen.

I've also tried using xdg-screensaver lock, but it works in the same way as gnome-screensaver-command --lock does (only uses the new lockscreen when it's ran from the desktop).

Running light-locker-command --lock didn't work, as light-locker is not installed.

I guess there must be some differences between running the same command from the desktop and running it via SSH/virtual console, but I was not able to find any difference in the environment variables.

So, my question is: How can I lock the screen using the new Unity lockscreen and not the old lockscreen from the command line?

This question is probably related as it asks for the new command that needs to be used, so here's another question: Why does running the same lock command give different results?

Note that gnome-screensaver is not being used anymore in 14.04, according to this bug report:

That's not really a gnome-screensaver bug, that component stopped being used in trusty.

share|improve this question
1  
I would like to know as well. Using dm-tool lock comes close: it locks the screen, but (unlike the default Unity lock screen) also allows you switch users. –  Aibara Iduas Jun 30 at 22:58
    
dm-tool lock and dm-tool switch-to-greeter seem to be doing the same thing: take you back to the log in screen (greeter), which does look very similiar to the lockscreen. –  Léo Lam Jul 2 at 12:48

2 Answers 2

up vote 2 down vote accepted

I don't have gnome-screensaver installed, and the only command I can find that works is this:

dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock

share|improve this answer
1  
qdbus org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock –  Aquarius Power Aug 2 at 0:37

You can use gnome-screensaver-command -l. It's still supported, just the unlock command isn't. This will work from terminal but maybe not over ssh?

share|improve this answer
    
Well, I've already tried it (see question), but it doesn't look the screen using the new lockscreen in some cases (for example, over SSH). [Update: yes, you're right. It doesn't use the new lockscreen over SSH.] I can't figure out what changes its behaviour. –  Léo Lam Jun 23 at 19:15
    
@LeoLam no, me neither... If you ssh in, then execute the command xdotool keydown Super; xdotool key L; xdotool keyup Super does that use new or old? –  Tim Jun 23 at 21:54
    
It seems to have no effect, even when setting the DISPLAY env variable. –  Léo Lam Jun 24 at 12:32

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.