Swaylock
Instead of swaylock
, install swaylock-effects-git
fork because it has cooler effects that you can use.
How to install?
Install it with yay swaylock-effects-git
from the AUR packages.
Useful Info:
I think that you have to create a config file, with the entries that you see in the Swaylock Manual Page
Swaylock Effects Github Page
If VSCode doesn't recognize the language of the config file and does NOT highlight the colours. You can add #!/bin/bash/
to the beginning of the file and then your config file will be highlighted correctly.
To make Swaylock work nicer, make a wallpaper script, and make that script copy the curren used wallpaper into ~/.cache/current_wallpaper.jpg
so this way, you can point swaylock to use it without setting up the image in the config file manually.
Watch this video for more info
How to use?
- Create the config directory
~/.swaylock
. - Create it config file and call it config.
- Then go to the swaylock man page.
- By reading the manual, add the entries that you want with their properties to the config file, one on top of the other.
- For extended features coming with the swaylock-effects-git fork, go to the Github page of this fork.
- Once done, to test it, save it and in your terminal, run:
swaylock
command.
You should use =
when entering the values for the properties/entries. I did not try with :
but I know that it works with =
.
For example if in the manual page it is written as:
--indicator-radius <radius>
then you should write it in your config file as:
indicator-radius=150
.
Where should the config file be placed?
- $HOME/.swaylock/config
- XDG_CONFIG_HOME/swaylock/config
- SYSCONFDIR/swaylock/config
An example config file from Reddit:
Sway config:
### Idle configuration
exec swayidle -w \
timeout 240 '$HOME/.config/sway/scripts/lock.sh' \
before-sleep '$HOME/.config/sway/scripts/lock.sh'
### Manual Lock
bindsym --release $mod+Control+s exec '$HOME/.config/sway/scripts/lock.sh'
#!/bin/bash
# If idle for 15s, power down the output
swayidle -w \
timeout 15 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' &
# Lock screen immediately
swaylock --image ~/wallpaper.png
# Kill the last instance of swayidle so the timer doesn't keep running in background
pkill --newest swayidle
In the reddit thread, the user who created this script is saying that, by creating the second script separately let's you lock the screen separately. For more info, check the reddit link above.
An other example from Reddit
Swaylock config file:
# lock screen before suspend. Use loginctl lock-session to lock your screen.
exec swayidle -w timeout 300 'swaylock -C$HOME/.config/swaylock/config.idle' timeout 420 'systemctl suspend' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock'
exec swayidle lock 'swaymsg "output * dpms on"&& swaylock' unlock 'kill -s 1 $(pgrep swaylock)'
Config.idle file:
grace=5
daemonize
screenshots
fade-in=4
ignore-empty-password
effect-greyscale
effect-blur=10x2
indicator
clock
text-color=blue