Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display image inside of indicator #89

Open
wants to merge 53 commits into
base: master
Choose a base branch
from

Conversation

ErikReider
Copy link

Example:
swaylock --indicator-image /var/lib/AccountsService/icons/erikreider

fade-in=0.2
image=~/.cache/wallpaper

ignore-empty-password

indicator
indicator-caps-lock
indicator-radius=60
indicator-thickness=5

effect-blur=12x12
effect-vignette=0.5:0.5

line-color=00000000
line-clear-color=00000000
line-caps-lock-color=00000000
line-ver-color=00000000
line-wrong-color=00000000

ring-color=00000033
ring-caps-lock-color=5500A3FF
ring-wrong-color=FF0000FF

separator-color=00000000

text-color=00000000
text-clear-color=00000000
text-clear-color=00000000
text-wrong-color=00000000
text-ver-color=00000000
text-caps-lock-color=00000000

inside-color=00000000
inside-clear-color=00000000
inside-caps-lock-color=00000000
inside-ver-color=00000000
inside-wrong-color=00000000

image

Fixes #68

emersion and others added 30 commits February 17, 2021 16:50
mako does something similar.
Initializing to 1 is incorrect when the surface scale is > 1.
We incorrectly used the buffer size instead of the surface size.
Let's not bother and just damage the maximum region.
Signed-off-by: Elyes HAOUAS <[email protected]>
An odd value of fe.height lead to the indicator disappearing. This was
due to the buffer size no longer being a multiple of the buffer scale.
This commit fixes the issue by checking both height and width to be a
multiple of scale.

This is done early to avoid excessive re-calls of create_buffer if the
buffer_height != new_height in render.c line 314 (now 318).
The next commit will need that version. Adjust the build to not
trigger deprecation warnings.
This allows building swaylock with a local wayland-protocols.
This is a new protocol to lock the session [1]. It should be more
reliable than layer-shell + input-inhibitor.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/131
More consistent with our code style.
We don't actually require xdg-shell support.
It can be sent before keyboard.keymap (for example
when running swaylock from a different tty), in
which case the xkb state isn't initialized yet.
The problem here was that a commit in reaction to wl_output::geometry
was made before the surface was configured, which is a protocol error.
See 65552.531 in the following log.

    [  65537.378] [email protected](37, "wl_output", 4)
    [  65537.534]  -> [email protected](37, "wl_output", 3, new id [unknown]@21)
    [  65537.679]  -> [email protected]_surface(new id wl_surface@19)
    [  65537.744]  -> [email protected]_surface(new id wl_surface@23)
    [  65537.822]  -> [email protected]_subsurface(new id wl_subsurface@24, wl_surface@23, wl_surface@19)
    [  65537.934]  -> [email protected]_sync()
    [  65537.973]  -> [email protected]_lock_surface(new id ext_session_lock_surface_v1@25, wl_surface@19, wl_output@21)
    [  65538.086]  -> [email protected]_region(new id wl_region@26)
    [  65538.148]  -> [email protected](0, 0, 2147483647, 2147483647)
    [  65538.275]  -> [email protected]_opaque_region(wl_region@26)
    [  65538.325]  -> [email protected]()
    [  65538.383]  -> [email protected](new id wl_callback@27)
    [  65551.781] [email protected]_id(26)
    [  65551.924] [email protected]_id(27)
    [  65551.971] [email protected](839, wl_surface@15, 558.01562500, 785.66796875)
    [  65552.093]  -> [email protected]_cursor(839, nil, 0, 0)
    [  65552.231] [email protected](0, 0, 440, 300, 0, "Samsung Electric Company", "SyncMaster", 0)
    [  65552.453]  -> [email protected](new id wl_callback@26)
    [  65552.531]  -> [email protected]()
    [  65552.568] [email protected](1, 1680, 1050, 59883)
    [  65552.685] [email protected](1)
    [  65552.762] [email protected]()
    [  65552.796] [email protected](840, 1680, 1050)
    [  65552.893]  -> [email protected]_configure(840)
    [  65553.044]  -> [email protected]_pool(new id wl_shm_pool@28, fd 7, 7056000)
    [  65553.156]  -> [email protected]_buffer(new id wl_buffer@29, 0, 1680, 1050, 6720, 0)
    [  65553.224]  -> [email protected]()
    [  65558.903]  -> [email protected]_buffer_scale(1)
    [  65558.953]  -> [email protected](wl_buffer@29, 0, 0)
    [  65558.981]  -> [email protected]_buffer(0, 0, 2147483647, 2147483647)
    [  65559.013]  -> [email protected]()
    [  65559.026]  -> [email protected]_position(842, 465)
    [  65559.063]  -> [email protected](nil, 0, 0)
    [  65559.088]  -> [email protected]()
    [  65559.110]  -> [email protected]_position(782, 465)
    [  65559.186]  -> [email protected]_pool(new id wl_shm_pool@30, fd 8, 58564)
    [  65559.220]  -> [email protected]_buffer(new id wl_buffer@31, 0, 121, 121, 484, 0)
    [  65559.266]  -> [email protected]()
    [  65559.287]  -> [email protected](nil, 0, 0)
    [  65559.316]  -> [email protected]()
    [  65559.385]  -> [email protected]_buffer_scale(1)
    [  65559.402]  -> [email protected](wl_buffer@31, 0, 0)
    [  65559.427]  -> [email protected]_buffer(0, 0, 2147483647, 2147483647)
    [  65559.458]  -> [email protected]()
    [  65559.467]  -> [email protected]()
    [  65559.478] [email protected](840)
    [  65559.740] [email protected](ext_session_lock_surface_v1@25, 0, "session lock surface has never been configured")
    ext_session_lock_surface_v1@25: error 0: session lock surface has never been configured
Commit 2bf7600

This merge replaces mortie#64 which didn't preserve
identity of the original commits.
jirutka and others added 7 commits June 22, 2022 02:35
bd-g and others added 16 commits November 9, 2022 22:26
When a surface is created, a fade in effect occurs (if specified in the
arguments). This animation is desirable when swaylock is initially run,
however, it is undesirable after it is run.

For example, on a running swaylock process, if the surface is destroyed
when a laptop is closed, the surface must be recreated when the lid is
reopened and the output turns on again. During this recreation, the fade
in animation replays, temporarily showing the working state of the
machine long after swaylock was initially run.

This has obvious security and privacy concerns - anyone can see the
working state of a machine by closing and reopening a laptop lid, or by
hooking up another monitor and forcing another surface to be created.
This PR is a simple attempt to fix that by only allowing the fade
animation to occur in a small time window immediately after swaylock
starts.

Resolves mortie#12
Since version 0.46 of Meson, released 23 April 2018, you can directly
include a dependency on OpenMP, as opposed to manually adding the
compiler flags. This results in fewer lines of code, notifies you if
there's something wrong with your OpenMP installation (for instance, on
my machine, with Clang, I needed to separately install a package for
omp.h; the existing solution executed meson setup build without errors,
but failed to compile, whilst this proposed solution catches any
problems at the setup stage) and is more portable (for instance, the
-fopenmp flag is deprecated for the Intel compiler).
This commit introduces support for all eight 10-bit colour formats
supported by wl_shm.

le32toh is used to convert little endian pixels to host endianness.
This function is available on Linux in <endian.h> and FreeBSD in
<sys/endian.h>.

For readability, the if/else chain is converted into a switch.
When the upstream branch was merged in, this change was missed for the
initially_render_surface() function, which was split out from
create_surface().

Fixes mortie#3.
With ext_session_lock_v1, it is impossible to obtain screenshots after
the lock is initiated. The compositor is supposed to stop all normal
rendering after call to ext_session_lock_manager_v1_lock().

Instead, let's enumerate outputs *before* locking the screen, so that we
can obtain screenshots of each output before they are hidden by the
ext_session_lock_v1 api.

Fixes mortie#5.
Note that the fade-in effect is still pretty much broken with
ext_session_lock_v1. We will need to update the fade algorithm to
actually do pixel blending instead of using the alpha channel.
With ext_session_lock_v1, it is no longer possible to have an lockscreen
surface with alpha channel. Instead, we have to implement the alpha
blending ourselves.

Instead of reinventing the wheel yet again, we simply make use of the
screenshot we have taken beforehand (before the lock was even
initiated). We draw our intended background image on top of an
unmodified version of the screenshots directly, by using
cairo_paint_with_alpha().
This reduces flickering while the effects are being applied. The
downside is that now there might be a small delay between running
swaylock and when the lock is actually applied, but that should be fine
given there are visual confirmations for the lock (as in, whether
swaylock showed up or not).
This further reduces the blank time between activating the lock and we
rendering the first frame. Note that this means we must do the commit
outside of render_frame_background().

render_frame_background() itself was modified with a new parameter.
Compared to just removing wl_surface_commit() from it, this approach can
reduce the chance of future mismerges by forgetting wl_surface_commit().
DRAGONTOS added a commit to DRAGONTOS/swaylock-effects that referenced this pull request Jan 21, 2024
pull: Display image inside of indicator mortie#89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--effect-compose not scaling correctly