Custom shortcut to i3lock screen

12,333

Solution 1

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).

Solution 2

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

or

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.

Share:
12,333

Related videos on Youtube

Wanderer
Author by

Wanderer

Updated on September 18, 2022

Comments

  • Wanderer
    Wanderer over 1 year

    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.

    • Admin
      Admin over 9 years
      Does using the same command used in the terminal not work?