OctopusET / sway-contrib

A collection of user-contributed scripts for sway
MIT License
58 stars 22 forks source link

swaylock with fadeout #14

Closed smason closed 10 months ago

smason commented 11 months ago

It took me ages to get around to setting up swaylock such that it could fade out the screen in an interruptible manner.

I've just found https://git.sr.ht/~emersion/chayang that does the interruptible fade nicely and was wondering whether this is something other people were struggling with.

I currently have it configured in a couple of bash scripts:

exec swaylock -f -F -c 000000

* `swayidle.sh` is callable from the main `sway/config` file via a simple `exec swayidle.sh`
```bash
set -eufo pipefail
lock=swaylock.sh
exec swayidle -w \
     timeout 300 "$lock slow" \
     timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
     before-sleep "$lock" \
     lock "$lock fast"

There are three states it tries to control here:

  1. normal 5 minute timeout does a very slow 10 second fade out
  2. fast lock (config via bindsym $mod+Escape exec loginctl lock-session) fades quickly (300ms)
  3. sleeping computer (e.g. via closing laptop lid) just immediately locks everything
OctopusET commented 11 months ago

Cool! I think it can be included in this repository if more attributes are controllable with arguments. Like numbers in timeout 300

Would you make some PR for it?

smason commented 11 months ago

Given these scripts are so simple I'd be tempted to just leave them in a markdown document, letting users customize them as they see fit.

Would that make sense as a PR, or just start using Github's Wiki functionality for things like this?

OctopusET commented 10 months ago

I opened wiki for everyone. Feel free to edit it. I will do some work for the wiki and README too.

However I think using a wiki is a bit of a stretch because it spreads out the work, but I think this repository is for the community not for myself, so I'm going to make it public and see how it goes.

OctopusET commented 10 months ago

You can still make PR or make a wiki page for this. Then I will close this. Thanks

smason commented 10 months ago

have turned this into the following wiki entry https://github.com/OctopusET/sway-contrib/wiki/swaylock