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

Is it possible to play radio after screen lock ? #187

Open
marekmosiewicz opened this issue Apr 6, 2022 · 10 comments
Open

Is it possible to play radio after screen lock ? #187

marekmosiewicz opened this issue Apr 6, 2022 · 10 comments

Comments

@marekmosiewicz
Copy link
Contributor

I use this radio all the time and one thing I miss is behavior when screen locks.
It seems that shell is calling disable() when screen goes black and radio turns off :
https://stackoverflow.com/questions/23724392/my-gnome-shell-extension-stops-working-after-a-lock-unlock-screen-cycle
So it would be great if there would be preference option "Continue playing after screen lock" (I do not know how to detect difference between disabling and screen lock)
It seems also that after enabling it there is need to restart Gst stream (currently when you log on radio continues with old buffer
and gives stream error when it ends)

@hslbck
Copy link
Owner

hslbck commented Apr 8, 2022

Hi,

As far as I know this is still not possible with current implementation of extensions. And not properly cleaning up on the disable call will not pass the extension review.
A solution for this could be that the streaming is not handled by the extension itself, but another script which could run in a separate process. But I don't have any plans to change the current extension behaviour

@hslbck hslbck closed this as completed Apr 8, 2022
@marekmosiewicz
Copy link
Contributor Author

Hi,

As far as I know this is still not possible with current implementation of extensions. And not properly cleaning up on the disable call will not pass the extension review. A solution for this could be that the streaming is not handled by the extension itself, but another script which could run in a separate process. But I don't have any plans to change the current extension behaviour

Maybe someday in future I will play with this. Assuming it is bug free, would you consider accept my pull request ?

@hslbck
Copy link
Owner

hslbck commented Apr 12, 2022

Seems that support for lock screen was added in GNOME Shell 42, see https://gjs.guide/extensions/upgrading/gnome-shell-42.html#metadata-json

I added following line to metadata.json "session-modes":["unlock-dialog", "user"] . Extension afterwards was present in lock screen, but start/stop of playback was only possible when unlocked. But I didn't check it further, so it could break something

@hslbck hslbck reopened this Apr 12, 2022
@freddyw
Copy link

freddyw commented Apr 14, 2022

I added the "session-modes" line to metadata.json as well on Fedora 36 and the radio keeps playing after locking the screen!

So it appears to really make a difference. Haven't tried to start/stop the playback ....

@marekmosiewicz
Copy link
Contributor Author

I added it too and it works. What is however tricky would be make it configurable as it is metadata. Think it would require add session-modes to metadata and subscribe (it should exist) dbus event for lock screen taking stream close if configuration is set to stop playing on user lock screen.

@ludenticus
Copy link

Beware that «Lock Screen Notifications» must be enabled.

@coxackie
Copy link

I confirm that adding "session-modes": ["unlock-dialog", "user"] to metadata.json does the trick, as long as you have "Lock Screen Notifications" enabled in gnome settings. @hslbck you may consider adding this to metadata.

@hslbck
Copy link
Owner

hslbck commented Dec 21, 2022

In this state I don't consider adding it yet. First review guidelines for extension page must be addressed https://gjs.guide/extensions/review-guidelines/review-guidelines.html#session-modes. Likely whole indicator needs to be removed in lock screen, which needs some rework as well. And if this is going to be added it should be configurable in the extension settings to enable/disable

@marekmosiewicz
Copy link
Contributor Author

I made lock screen behaviour configurable https://github.com/marekmosiewicz/gnome-shell-extension-radio . Added option to prefs if radio should be played or not after lock. I changed session mode and subscribe to lock event. If radio should be turn off I disable extension. I also try to add another option "resume after unlock". This however does not work for some reason. I'm not sure if it is possible with function based extension, but to subscribe for event I changed extension to be class.

@hslbck
Copy link
Owner

hslbck commented May 16, 2023

Thank you! I haven't checked it yet, but when extension gets disabled usually the signal gets disconnected. Do you start the player when you try to "resume"?

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

5 participants