i3lock: Cool Screen Locker (Console) for Ubuntu Linux

Ubuntu comes with a screen locking utility by default and it is pretty decent. However, if you wanted something that gives you more options plus, a bit fun to use, then you might like the utility called “i3lock”.

Let’s say you wanted to lock your screen with the mouse pointer enabled and set the background to a screenshot of your desktop that you just took, and to make your wildest dreams come true ;-), a friend comes and tries to use the computer but complains saying that the desktop seems to be stuck ;-), yep, you can do that with “i3lock”.

It’s actually a pretty powerful tool and has few options (that are easy to enable/disable) such as:

*. Change the background color (default is “White”) or use a custom background.

Wanna leave something like this on your locked screen?, It could be fun, or maybe not 😉 …

*. Enable/Disable the mouse pointer once the screen is locked (hidden by default).

*. Enable/Disable “DPMS” (disabled by default).

In other words, once you lock the screen with the “DPMS” (an advanced power saving technology that comes with display screens) option enabled, “i3lock” will turn off your monitor immediately to save power and will be automatically turned on when you start typing the password or move your mouse.

*. Image “tiling”: If your custom image has a smaller resolution than the monitor, then this will make it tiled all over your screen.

*. Multi-monitor support.

*. Enable/Disable “Beeps” on errors (however, it did not work while I was using it).

That’s it.

You can install “i3lock” utility in Ubuntu 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04 by using the below commands in your Terminal window.

sudo apt-get install i3lock

The versions in the Ubuntu repositories are slightly outdated than the current version but I don’t think they aren’t missing out any new features nonetheless.

How to use it?

Quite simple actually. If all you want is to lock your screen with the default settings, then simply use the below command.

i3lock -n

Once it unlocks the screen, you should see an output similar to this (including failed attempts due to wrong passwords, if any)…

The “-n” argument is not really necessary, but without it, when you unlock the screen, “i3lock” will still be running in the background, so you’ll have to manually close it. But with the “-n” argument, as soon as you unlock your screen, the utility will also be terminated automatically. So I prefer to use it all the time.

How to unlock the screen?

Unlike with the built in screen lock tool in Ubuntu, “i3lock” does not have a password input field. So to unlock the screen, simply type your password and when done press the “Enter” key. Then wait for like a second and it should unlock the screen.

If you mistype the password, then you can simply press the “Enter” key. And then again re-type the correct password and press the “Enter” again which should do the trick (or you can keep pressing the backspace to delete the wrong password. But since it doesn’t have a password field, it’s a bit hectic to know if all the characters are deleted or not though).

How to change the default color?

For that, use it in the below format.

i3lock -c 000000 -n

Just replace “000000” with your preferred color (in RGB format).

Using an image (my favorite! ;-)) with the mouse pointer enabled …

As mentioned, you can get a little fun out of your friends by setting the current desktop’s screenshot as the background (or any image you want). For that, please use the below command.

i3lock -i your-image-path -p default -n

Just replace “your-image-path” with the name and the path of your image file and don’t change anything else. For instance, let’s say that I have an image called “fake-desktop.png” on my “Home” folder that I want to use. Then I’ll the below command.

i3lock -i fake-desktop.png -p default -n

If you want the monitor to be turned off automatically, then use the “-d” argument with any of the above mentioned custom commands.

For instance, if I wanted to turn the monitor off with the above command (so the fake desktop image will be only visible after moving the mouse or clicking the keyboard), then I’d simply add the “-d” argument as shown below.

i3lock -i fake-desktop.png -p default -d -n

All these commands are actually written in its manual. To read that, use the below command.

man i3lock

That’s it.

So, as a final word, if you’re bored with the functionality of the default screen locker in Ubuntu and looking for something that lets you lock your screen directly from the Console (command-line) with some cool features, then “i3lock” is worth trying :D. Enjoy!.

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

12 thoughts on “i3lock: Cool Screen Locker (Console) for Ubuntu Linux”

    • Hi,

      Well, you could customize the keyboard shortcut and simply try adding the ‘i3lock’ command as the command that gets executed when those shortcuts are used.

      • Yeah, I had that idea too, but it only works if I use the shortcut…
        I would like that my laptop uses i3lock when I open… (If I do the shorcut before closing the laptop, the screens doesn’t suspend and I’m afraid it would consume much energy).
        In any case, thanks for you’re answer 🙂

  1. FYI i3lock is a utility part of the i3 window manager, a lightweight tiling window manager which is excellent for small screens, battery life, and efficiency.

    This is a newer fork of the old i3 called i3-gaps: https://github.com/Airblader/i3

    You can install some distros with i3 preinstalled, I recommend the community maintained Manjaro+i3 distribution (based on Manjaro and in turn based on Arch).


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.