mstoeckl / swaylock-plugin

Screen locker for Wayland -- fork with background plugin support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swaylock-plugin

This is a fork of swaylock, a screen locking utility for Wayland compositors. With swaylock-plugin, you can for your lockscreen background display the animated output from any wallpaper program that implements the wlr-layer-shell-unstable-v1 protocol. All you have to do is run swaylock-plugin --command 'my-wallpaper ...', where my-wallpaper ... is replaced by your desired program. Examples:

  • swaybg, which displays regular background images
  • mpvpaper, which lets you play videos
  • shaderbg, renders OpenGL shaders
  • rwalkbg, a very slow animation
  • wscreensaver, an experiment in porting a few xscreensaver hacks to Wayland
  • windowtolayer, a tool that can be used to run normally windowed applications, like terminals, as wallpapers. Requires --command-each flag.
  • You can rotate between wallpapers in a folder by setting the following script as the command; e.g.: swaylock-plugin --command './example_rotate.sh /path/to/folder'. (This works by periodically killing the wallpaper program, after which swaylock-plugin automatically restarts it.)
    #!/bin/sh
    file=`ls $1 | shuf -n 1`
    delay=60.
    echo "Runnning swaybg for $delay secs on: $1/$file"
    timeout $delay swaybg -i $1/$file
    

swaylock-plugin requires that the Wayland compositor implement the ext-session-lock-v1 protocol.

This is experimental software, so if something fails to work it's probably a bug in this program -- report it at https://github.com/mstoeckl/swaylock-plugin .

As this fork is not nearly as well tested as the original swaylock, before using this program, ensure that you can recover from both an unresponsive lockscreen and one that has crashed. (For example, in Sway, by creating a --locked bindsym to kill and restart swaylock-plugin; or by switching to a different virtual terminal, running killall swaylock-plugin and running swaylock-plugin, and restarting with e.g. WAYLAND_DISPLAY=wayland-1 swaylock-plugin .)

See the man page, swaylock-plugin(1), for instructions on using swaylock-plugin.

Installation

Install dependencies:

  • meson *
  • wayland
  • wayland-protocols *
  • libxkbcommon
  • cairo
  • gdk-pixbuf2
  • pam (optional)
  • scdoc (optional: man pages) *
  • git *
  • swaybg

* Compile-time dep

Run these commands:

meson build
ninja -C build
sudo ninja -C build install

On systems without PAM, you need to suid the swaylock-plugin binary:

sudo chmod a+s /usr/local/bin/swaylock-plugin

Swaylock will drop root permissions shortly after startup.

About

Screen locker for Wayland -- fork with background plugin support

License:MIT License


Languages

Language:C 92.8%Language:Shell 3.5%Language:Meson 3.3%Language:Python 0.4%