Liang Xu | action colleague, let me stay up all night working all in vain ......

Bear children, it is a kind of magical creatures

They days fearless

Enormous destructive power, endurance and full

And "Protection of Minors Act" as they escort ......

At home destroyed by these children bear no problem,

But in the company, as much as those of some of my colleagues destructive bear children

See the server running,

They will poke here, there Dodo

On Liangzi - hand cheap! !

If you are not careful,

You stay up all night to do the work,

It may be a key colleague bear destroyed ......

but it does not matter,

Today tool introduced

It is to respond to bear children bear colleague

Since then allow you peace of mind, peace of mind to work

1. Install xtrlock Tools

xtrlock Tool in most Linux distributions software library, we can directly use the corresponding distribution's package manager to install it.

It can be used directly apt-get command to install on Debian, Ubuntu, Linux Mint:

$ sudo apt-get install xtrlock

Other distributions use their own software installation command to install.

2. Use xtrlock lock the keyboard and mouse, but does not lock the screen

After installation xtrlock, we can create a keyboard shortcut for it, so that we can use the key combination of your choice to quickly lock the keyboard and mouse.

First, /usr/local/bincreate a file named in lockkbmousethe new file.

$ sudo vim /usr/local/bin/lockkbmouse

In which add the following:

#!/bin/bash
sleep 1 && xtrlock

First Ann Esc key, then press : wq to save and close it. Then we use the following command to add executable permissions to it:

$ sudo chmod a+x /usr/local/bin/lockkbmouse

Next, we create a keyboard shortcut, when we press the shortcut key set can execute the above script.

a) If you are using Ubuntu system

Set the following steps:

Enter the System Setup → Device → keyboard → click the plus sign at the end of

Enter a name for the shortcut, and add the following at the command box, and then click the "Add" button.

bash -c "sleep 1 && xtrlock"

Next, the shortcut key assigned to the newly created shortcut. Here simply select or double-click it, then click the "Settings shortcut" button.

We will see the following prompt:

Enter key combination you want. Also here using ALT + K, you can also set other key combination you want.

If we want to clear key combination, then press BACKSPACE. When the shortcut has been set up, we can close the "Keyboard Settings" window up.

b) If you are using Arch Linux MATE system

Set the following steps:

Go to System → Preferences → Hardware → Keyboard Shortcuts

Click "Add" to create a new shortcut.

Enter the name of the shortcut, the name just to distinguish other shortcut keys, and add the following at the command box, and then click 'Apply' button.

bash -c "sleep 1 && xtrlock"

Then define shortcut keys for this shortcut. We just need to select or double-click the shortcut just created, and then type the key combination we selected. For example, here we use alt+k, of course, you can also assign additional shortcuts according to their habits.

If we want to clear the key combination, then press BACKSPACE, and then close the "Keyboard Settings" window.

When everything is set up, whenever we press the keyboard shortcuts (in our example is the alt + k), the mouse pointer changes to a padlock. At this time, the keyboard and mouse have been locked, so we are free to watch movies or anything want to see. Even their children or pets touch some of the key or clicking the mouse button on the keyboard, they will not have any effect.

This is the practical application xtrlock, we can see that the mouse pointer turns into a padlock shape, this time the mouse and keyboard have been out of action, and we only have to unlock the screen and manually close Xtrlock, before they can return to normal function.

3. unlock the keyboard and mouse

To unlock the keyboard and mouse, just enter your password and press "Enter" key. However, when we type the password, we can not see the password. So you get over it, just enter the password, and then press ENTER on it.

After entering the correct password, the mouse and keyboard will begin to return to normal operation. If you enter an incorrect password, the system will be ringing alarm. Then you need to press the ESC key to clear the wrong password, then re-enter the correct password. If you simply delete a character typed password, just press BACKSPACE or DELETE keys can be.

4. If I was permanently locked out of the screen how to do?

XtrLock tools may not work on some distributions, such as GDM. If you are forced to use it, it could permanently lock our screen. So before use, it is recommended that you first test it in a virtual machine, and then test again on your computer to verify that it really works.

But if unfortunately we were permanently lock the screen, and then we need to switch to the TTY window (CTRL + ALT + F2), and then run the following command:

$ sudo killall xtrlock

For more xtrlock usage, we can refer to its man page.

$ man xtrlock

-----------------

I am a good promise, the world's top 500 foreign Linux development engineer, specializing in the production of dry Linux. I welcome the attention of the public number " Liang Xu Linux " reply " 1024 " for the latest and most comprehensive technical information, respond to " the group " into the clearing technology exchange group.

img

Guess you like

Origin www.cnblogs.com/yychuyu/p/11445846.html