I'm having difficulties with creating a custom keyboard shortcut. I'm trying to lock my screen using i3lock with a picture.

From the terminal, the command

i3lock -i ~/Pictures/lock.png

works like charm.

When I go System Settings -> Keyboard -> Custom Shortcut what do I write into the Command line?

I've tried:

gnome-terminal -e "i3lock -i ~/Pictures/lock.png"

but it doesn't work.

  • Does using the same command used in the terminal not work? – HalosGhost Aug 16 '14 at 15:16

Okay, so I managed to solve it - maybe it's not the most elegant way but it works and it's good enough.

First I wrote a small script:

#!/bin/sh i3lock -i ~/Pictures/lock.png

Saved it (e.g. .locker) to the HOME address, then I ran "chmod +x .locker" so I could execute it and at the Custom Shortcuts to the Command line I wrote ./.locker

Choose an arbitrary shortcut for it (mine is SUPER+L).


Another way to solve this is in your i3 config (probably at ~/.i3/config) do something like :

bindsym Control+mod1+l exec i3lock -i ~/Pictures/lock.png


bindsym Control+mod1+l exec ~/.i3/scripts/locker

And remove any gnome shortcut that mirrors what you want to use. Obviously, the shortcut can be specified as wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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