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 on top of swaylock? #5

Closed
bhepple opened this issue Nov 7, 2021 · 13 comments
Closed

Display on top of swaylock? #5

bhepple opened this issue Nov 7, 2021 · 13 comments

Comments

@bhepple
Copy link
Contributor

bhepple commented Nov 7, 2021

I use swaylock to display a random image while locked:

swaylock --daemonize --image "$IMAGE" &

Is there any way to have nwg-wrapper display some text 'on top of' that image. I tried --layer=2 but it does not display (until I unlock!).

@nwg-piotr
Copy link
Owner

nwg-piotr commented Nov 7, 2021

The -l 3 argument seems to display the wrapper content over swaylock. I'm not sure ATM how switching layers with a signal is going to behave.

@bhepple
Copy link
Contributor Author

bhepple commented Nov 7, 2021

You're right! Thanks for that and BTW thanks for all your sway/wl-roots contributions!!

@bhepple bhepple closed this as completed Nov 7, 2021
@nwg-piotr
Copy link
Owner

You're welcome! Thanks for featuring them on your and sway Wiki.

@bhepple
Copy link
Contributor Author

bhepple commented Nov 7, 2021

I spoke too soon! It seems that the very first time an image is used with swaylock, nwg-wrapper is able to display on top of it. Subsequent runs (using the same image) are not able - although when swaylock terminates (on password entry) the nwg-wrapper window is visible. The effect is preserved even after the sway session is exited and restarted. Each image can be displayed exactly once before nwg-wrapper fails!!! Quite weird.

swaylock --image '/home/bhepple/media/backgrounds/Evening at Bilbos-X3.jpg' & 
nwg-wrapper -s timezones.sh -r 10000 -c timezones.css -p right -mr 50 -a start -mt 50 -j right --layer 3

@bhepple
Copy link
Contributor Author

bhepple commented Nov 7, 2021

BTW - hitting a running nwg-wrapper with USR1 or USR2 signals does not fix things, nor does using a different offset eg -mr 100 instead of 50. Nor does alternating 2 different images; nor does running swaylock without an image.

Rebooting resets the counter so that nwg-wrapper succeeds for a previously used image - but for only one time.

@bhepple bhepple reopened this Nov 7, 2021
@nwg-piotr
Copy link
Owner

nwg-piotr commented Nov 7, 2021

Inverted command order and sleep 1 && seem to help here:

#!/usr/bin/env bash

nwg-wrapper -s timezones.sh -r 10000 -c swaylock-time.css -p right -mr 50 -a start -mt 50 -j right --layer 3 &
sleep 1 && swaylock --image /home/piotr/Obrazy/Wallpapers/wallhaven-kwxjl6-1920x1080.jpg && pkill -f -2 nwg-wrapper

Don't use the --daemonize argument. If you need the wrapper content on the lock screen only, you'll probably want to kill it later. Use SIGINT (2) or SIGTERM (15) for it to terminate safely.

lockscreen1

@bhepple
Copy link
Contributor Author

bhepple commented Nov 7, 2021

That worked! although I need 2s sleep to be reliable. Maybe my system is slow (10yo laptop). Thank you again!!

EDIT no, I'm wrong again - I was slowing nwg-wrapper by having a curl in the script. Removed that and sleep 0.5 was enough

@bhepple bhepple closed this as completed Nov 7, 2021
@nwg-piotr
Copy link
Owner

nwg-piotr commented Nov 8, 2021

Tomorrow, when I'm bored enough at the office, I'll check it out on my old, testing laptop. For now only tested on my main machine and dwl compositor. I'm glad that it works for you.

@nwg-piotr
Copy link
Owner

One more thing: killing the process with signal 2 or 15 terminates all the wrapper instances. I think we need one more argument, like -sq | --sig_quit to choose a custom signal for a certain instance.

nwg-piotr added a commit that referenced this issue Nov 8, 2021
@10b14224cc
Copy link

I can't get it to work.

I have:

#!/usr/bin/env bash
nwg-wrapper --script $(pwd)/mydate.sh --css "$(pwd)/mydate.css" --layer 3 --refresh 500 --alignment start 1>/dev/null 2>&1 &
sleep 2 && swaylock && pkill -f -2 nwg-wrapper

but swaylock keeps overlaying nwg-wrapper :(

@10b14224cc
Copy link

10b14224cc commented Jan 11, 2024

I found this here:

Swaylock used to be rendered on the same layer (overlay), which is why your results depend on the surface creation order. Nowadays (sway 1.8) it uses ext-session-lock-v1 protocol and it's no longer possible to draw anything above the lockscreen at all.

@bhepple
Copy link
Contributor Author

bhepple commented Jan 11, 2024

I gave up on nwg-wrapper for use on the lockscreen (although I still use it on normal sway sessions to overlay help information eg in resize or move modes).

Instead I wrote some add-on modules for gtklock that provide the same information. It's all documented at https://github.com/jovanlanik/gtklock including the wiki there.

@10b14224cc
Copy link

I gave up on nwg-wrapper for use on the lockscreen (although I still use it on normal sway sessions to overlay help information eg in resize or move modes).

Instead I wrote some add-on modules for gtklock that provide the same information. It's all documented at https://github.com/jovanlanik/gtklock including the wiki there.

It looks like gtklock is based on wlr-layer-shell and wlr-input-inhibitor instead of ext-session-lock, thus is more insecure.

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

No branches or pull requests

3 participants