jpochyla / psst

Fast and multi-platform Spotify client with native GUI
MIT License
8.52k stars 218 forks source link

Feature request: Kiosk Mode on Raspberry Pi #528

Open Tilogorn opened 1 month ago

Tilogorn commented 1 month ago

Is your feature request related to a problem? Please describe. As per my research Psst is currently the best (if not only) solution that provides a stable Spotify GUI on ARM-based systems. Unfortunately, Psst does not support a "kiosk" mode, which would allow many makers to create Spotify-based media centers without the hazzle of Desktop UI around the Psst window.

My specific use case is my 5 year old son who likes to listen to his audio books on Spotify. I am creating an embedded "Spotify Player" based on a battery-powered Raspberry Pi 5 in a custom housing with built-in speakers. He is able to learn to use the Psst GUI (thanks to album image support!), but he can't do anything with the system menus. And if he were to close the Psst window by mistake, he wouldn't know what to do.

Describe the solution you'd like I'd like to have a psst-gui --kiosk flag that opens the GUI in fullscreen, as e.g. Chromium and Firefox offer it. Closing the Psst window or accessing the Desktop UI should not be possible anymore. See this official tutorial to get an idea, if this is new to you.

Describe alternatives you've considered Of course I stumbled upon Volumio, but their audio board compatibility lacks of newer boards (my WM8960 is not supported) and their system image is still based on Debian Buster, which is end-of-support since a while.

The second best option would be to run Spotify in a native browser in kiosk mode, but Psst is of course a lot more performant.

Additional context

SO9010 commented 1 month ago

Hello, I am happy to have a look at this 👍

Tilogorn commented 1 month ago

Glad to hear! Let me know if I can do anything to support you. I'll be available for hardware testing of course. Feel free to contact me regarding the compensation.

SO9010 commented 1 month ago

@Tilogorn I've had a crack at it; you are welcome to go to my branch: https://github.com/SO9010/psst/tree/kiosk-mode, where you can download it and try it yourself and give me some feedback. I have also mentioned what I have done in PR #533, which I encourage you to look at. After you are happy with the implementation, I'll message you about compensation :)

Tilogorn commented 1 month ago

@SO9010 Wow, that was quick! Sorry for the dumb question, but can you specify "download"? The links in the README certainly point to the official (master) binaries and I cannot find any compiled versions in the source itself. Do you think I should compile the source code myself under ARM? Then I will give the Building section in the README a try.

jacksongoode commented 1 month ago

I'll review the changes tomorrow and it will become apart of the official binaries, which arm Linux is one of them. However, I think you might need to build it for the Pi architecture as it's typically different.

SO9010 commented 1 month ago

@Tilogorn, sorry, my bad for not specifying; yes, you need to compile it yourself if you want to test it before @jacksongoode merges it. If you have rust and cargo installed, all you have to run is: cargo run --bin psst-gui -- --KIOSK and that should be it. If you have any issues with that just ask me :)

Also, @jacksongoode, the Aarch64 architecture is the arm, which is the processor that the Pi runs, so it should be fine.

Tilogorn commented 1 month ago

I was able to compile it on my Pi. Thanks to your instructions, @SO9010!

To get this running on ARM, one library was missing though: libc6-dev-arm64-cross (hint from SO). You might want to add this to your build instructions.

Unfortunately, there is no Kiosk behaviour noticeable.

Sorry, terminal output is German, but the last line is saying "unknown option: --kiosk". I tried uppercase (your last reply), lowercase (your PR), and --k; its always unknown.

$ cargo run --bin psst-gui -- --kiosk
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.36s
     Running `target/debug/psst-gui --kiosk`
[2024-09-26T19:30:09Z INFO  psst_gui::data::config] loading config: "/home/daniel/.config/Psst/config.json"
[2024-09-26T19:30:09Z ERROR psst_gui::webapi::client] failed to read local tracks: No such file or directory (os error 2)
[2024-09-26T19:30:09Z INFO  psst_core::audio::output::cpal] using audio device: "default"
[2024-09-26T19:30:09Z INFO  psst_core::cache] using cache: "/home/daniel/.cache/Psst"
[2024-09-26T19:30:09Z INFO  psst_core::audio::output::cpal] opening output stream: StreamConfig { channels: 2, sample_rate: SampleRate(44100), buffer_size: Default }
[2024-09-26T19:30:09Z INFO  psst_core::session::access_token] access token expired, requesting
[2024-09-26T19:30:09Z WARN  psst_gui::controller::on_command_async] async action pending
[2024-09-26T19:30:09Z INFO  psst_core::session::access_token] access token expired, requesting
Unbekannte Option --kiosk

Let me know if I can help with troubleshooting.

SO9010 commented 1 month ago

Heya, I suspect you didn't switch to the correct branch.

Try git checkout kiosk-mode

Then git pull

If you used the jpochyla repository you need to install it from from my repository

git clone -b kiosk-mode https://github.com/SO9010/psst

I'll give this a better look through on Linux tomorrow.

Tilogorn commented 1 month ago

I am used to git (software engineer myself) and I def cloned your repo and directly switched to the kiosk-mode branch. I‘ll have a look at the git hash tomorrow in Psst settings, that should clear things out. Am 26.09.2024 um 22:09 schrieb Samuel Oldham @.***>: Heya, I suspect you didn't switch to the correct branch. Try git checkout kiosk-mode Then git pull If you used the jpochyla repository you need to install it from from my repository git clone -b kiosk-mode https://github.com/SO9010/psst I'll give this a better look through on Linux tomorrow.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

SO9010 commented 1 month ago

Ok so I just looked at it, the value is still being passed through so I'm not sure why the error is there.

There is still an issue where it doesn't maximise and show the preferences window when on initial set up in kiosk mode.

@Tilogorn when it's being run with -- --kiosk does the log in screen have a title bar?

SO9010 commented 1 month ago

Im just setting up my own raspberry pi so I can properly test and troubleshoot it my self :)

Tilogorn commented 1 month ago

Hi, sorry, I have just the evenings (CET) for my side projects. If you have a Pi that will easify debugging a lot probably.

I just pulled, build and made pictures with and without config.json. Its maximized, but not full screen. Title bars shown, settings cog is gone.

IMG_9026

IMG_9027

Regarding the „unknown option“. I am not sure, but is --help showing the paramter? Is there maybe some command line args library involved that builds the help and must know every parameter?

Tbh I would not spend to much effort into the settings. Everyone will setup the application in „normal“ mode and change to Kiosk once everything is set up.

SO9010 commented 1 month ago

Thank you for this. I have looked into this and took your advice about putting a little effort into the settings. I even made it simpler. If not set up yet, the settings and log-in page start small and not maximised but are set to be always on top.

I had a deeper look into Druid (the UI framework being used), and unfortunately, it cannot go full screen like Firefox.

Because of this, there will be more steps to set up on devices such as the PI. You have to remove the top bar by right-clicking it and clicking "Delete this panel" do be warned that this cannot be easily un-done.

I'm pretty sure that the title bar should be removed now. However, my Raspberry Pi is number 2b, so it's a bit old, so I couldn't test it there. But I did test on LXDE, so it should be alright.

Do let me know if this didn't sort it :)

SO9010 commented 1 month ago

@jacksongoode after this feature has been resolved I think the README is need of an update, notably the credits section says no async is being used, then I'll go through the build instructions and improve it and also explain how to use kiosk mode.

What do you think?

jacksongoode commented 1 month ago

I definitely agree, with the many improvements and changes we should do a comprehensive refresh of the Psst readme, with new screenshots, and detailing functionality and cleanup the roadmap!

Tilogorn commented 1 month ago

@SO9010 Thank you for your detailed explanation. It is a pity that it is currently not possible. I will try to hide the system menu, but of course this is not a real kiosk mode. It doesn't start over the whole screen without OS modifications and the window title bar is still visible. This is more like --start-maximized or something similar.

Hiding the settings doesn't really make sense in this context in my opinion, as this is not a kiosk mode, but that is up to you.

However, updating the README in context of this MR is of course never a bad idea

SO9010 commented 1 month ago

@Tilogorn I'm sorry that I couldn't help more, it's very weird that the PI keeps the window title.

If you wanted an alternative desktop environment which would probably work you could try i3 tiling manager and that with minimal modification removes the title bar and you can very easily customise all of the keybindings.

However, I understand that this is not ideal.

https://i3wm.org/

Do let me know if I can help in any way.

Edit: you may actually want to use sway as that uses Wayland: https://swaywm.org/

Tilogorn commented 1 month ago

Thank you for your recommendations! I will have a look at them.

bbb651 commented 3 weeks ago

You might also want to look at cage, it's a wayland compositor specifically designed for kiosk modes