Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want make som scripts to lock(mute,screen off,lock)/unlock(unmute,screen on,unlock) session, and I want execute it with hotkeys.

I have script for lock Windows and Linux. And I need scripts to ulock sessions locked with password.

I know in Windows it must be Service: http://msdn.microsoft.com/en-us/library/ms686953%28VS.85%29.aspx What to call in my service to login with password?

And what is the way to do unlock Linux session?

Thanks for reply.

share|improve this question
    
To make this question clear, you would need to specify which distribution of Linux you are running and whether you are using the default window manager or have installed your own (if you don't know what a window manager is, you are using the default, but please specify that). –  ShankarG Mar 22 '12 at 6:39
add comment

1 Answer

If you are using any of the major distributions and if you are using GNOME or KDE, there are graphical interfaces that will allow you to specify hotkeys for this. If not, or if you want a generic solution, most distributions come with the xlock command. You can then write a short script like this

#!/bin/bash
amixer sset Master mute
xlock

Save this script somewhere in your PATH (if you don't know what that is, look at this intro page on it) and make it executable with the command chmod a+x <script name>.

Then, you'll have to set a hot key that will execute this script in your window manager, but that will depend on which one you're using. To find out more you can just Google your distribution or window manager's name along with the words "key bindings" or "hot keys" and you're likely to find instructions.

Unlocking from xlock is just a question of moving your mouse or pressing any key, and then entering your password.

If you want a different screensaver, run man xlock and look at the various options.

share|improve this answer
add comment

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.