mortie / swaylock-effects

Swaylock, with fancy effects
MIT License
698 stars 44 forks source link

[Feature request] Enable video file playing (via mpv, mplayer or similar) #79

Open wakatara opened 2 years ago

wakatara commented 2 years ago

While swaylock is minimal, I genuinely prefer nicer lockscreens, so glad to see this fork.

Is it possible to add the capability to play a movie on loop from the lock? And then overlay the unlocking interface?

Am attempting to find a way to duplicate Aerial on sway (so minimal, and jaw-droppingly gorgeous... =] ).

thanks! (already added this to my Arch sway config... =] ).

eddsalkield commented 2 years ago

Seems that mpv has a C API to allow you to render directly into an OpenGL context: https://github.com/mpv-player/mpv/blob/master/libmpv/client.h

Currently swaylock-effects uses Cairo for its image rendering, not OpenGL. However, there seems to be a guide on how to copy pixel data from a Cairo surface to an OpenGL texture here: https://www.cairographics.org/OpenGL/

So in theory we could move swaylock-effects to render using OpenGL. Existing rendering would happen in Cairo and be copied out to OpenGL, making it easier to track upstream. Additional options could be added that depend solely on the OpenGL backend, such as video playback.

Perhaps this move could also help tackle issues that are blocked by limitations of Cairo, e.g. #15?

mstoeckl commented 1 year ago

It's not integrated with swaylock-effects, but I do have a fork of swaylock that can solve this problem. swaylock-plugin can use wallpaper-drawing programs for its own backgrounds. If you build mpvpaper from git, or use version 1.3 when it comes out, the following command should display a video as the background for all outputs:

swaylock --command 'mpvpaper -o loop "*" path-to-video-file'

The swaylock fork is fairly new and untested code that I've only used in conjunction with Sway built from git master, so don't use it without a way to recover from lock screen crashes.