swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.63k stars 1.11k forks source link

Animated lock/screensaver #2254

Closed TimsManter closed 6 years ago

TimsManter commented 6 years ago

It's an use case of swaylock and an idea for little improvement to make swaylock more flexible.

I've managed to personalize swaylock so it now works as animated lock screen. The way is to use custom script which creates floating window with specified title (termite + cmatrix in my case), next runs swaylock with transparent color and at the end waits for swaylock process to exit then kills floating window. Script by itself looks like so:

#!/bin/sh
term='termite -t Screensaver -e'
saver=cmatrix
locker='swaylock -c 00000000'
($term $saver) &
sleep .2
($locker && kill $!) &

And is controlled by swayidle in config:

for_window [title="Screensaver"] floating enable
for_window [title="Screensaver"] fullscreen enable
set $kbdbl sudo brightnessctl -d tpacpi::kbd_backlight set
set $scroff swaymsg "output * dpms off"
set $scron swaymsg "output * dpms on"
set $hidecursor swaymsg seat seat0 cursor set 2000 2000
exec swayidle \
  timeout 5 '$hidecursor' \
  timeout 300 locker \
  timeout 360 '$scroff; $kbdbl 0' \
    resume '$scron; $kbdbl 1' \
  before-sleep locker

The final result depends on:

I think there're at least two things that can be improved:

  1. Ability to set command to run in swaylock container just like solid color or image so the script wouldn't be mandatory,
  2. Appearance setting to disable cleared indicator or set delay in seconds after indicator is hidden; current --no-unlock-indicator is not a good solution.

BTW: The setup above works on current wlroots version of sway from the latest master branch.

ddevault commented 6 years ago

Ability to set command to run in swaylock container just like solid color or image so the script wouldn't be mandatory,

What?

I'm not sure what you expect to come out of this ticket.

TimsManter commented 6 years ago

Ability to set command to run in swaylock container just like solid color or image so the script wouldn't be mandatory What?

Currently swaylock behaves as a top layer to sway workspace. swaylock by itself renders two separate layers - background and indicator - it's possible to set color or image as a background layer but not a window like termite. Such option would make many customization possibilities.

I'm not sure what you expect to come out of this ticket.

I introduced my hack to make something like xscreensaver mixed with lock screen but in Wayland/Sway way and only thing I expect is opinion that it could be eventually implemented more natively in Sway later on in form of appearance settings in this or other way.

ddevault commented 6 years ago

Currently swaylock behaves as a top layer to sway workspace. swaylock by itself renders two separate layers - background and indicator - it's possible to set color or image as a background layer but not a window like termite. Such option would make many customization possibilities.

This isn't going to happen.

I suggest you fork swaylock.