netbymatt / ws4kp

WeatherStar 4000+
https://weatherstar.netbymatt.com
MIT License
263 stars 44 forks source link

Specify parameters in query args for kiosk/ambient display #33

Closed zandr closed 5 months ago

zandr commented 9 months ago

My apologies if this is already there and I just couldn't find it, but I'd love to be able to specify a location, views, and full screen in query arguments. This would let me slot it into a rotation on an ambient display, kiosk, or WebViewScreensaver on my Mac.

netbymatt commented 9 months ago

Before I explore adding querystring parameters as described I'd like to discuss the full screen issue. MDN in the Fullscreen API Guide states the following:

Note: Fullscreen requests need to be called from within an event handler or otherwise they will be denied.

And it is explained further in requestFullScreen:

Transient user activation is required. The user has to interact with the page or a UI element in order for this feature to work.

What all of this means is that someone has to click, tap or use the keyboard to trigger an event that can then start full screen. And while unfortunate for the kiosk application, it makes sense in the general web browsing world. I wouldn't want any web site that I just simply open to be able to take over my screen.

So before I explore this further, is the full screen issue a deal killer?

zandr commented 9 months ago

it shouldn't be. I believe that Chrom[ium]'s --kiosk command line option handles launching a full-screen window with no chrome, so the "full screen" switch would really just request a page that contains only the WeatherStar display.

netbymatt commented 9 months ago

I'm working on this one.

Here's what I currently have: There's a new "share" button on the page that generates a url like this: http://localhost:8080/?hazards-checkbox=true&current-weather-checkbox=true&latest-observations-checkbox=true&hourly-checkbox=false&hourly-graph-checkbox=true&travel-checkbox=false&regional-forecast-checkbox=true&local-forecast-checkbox=true&extended-forecast-checkbox=true&almanac-checkbox=true&radar-checkbox=true&settings-wide-checkbox=false&chkAutoRefresh=true&txtAddress=Orlando%2C+FL%2C+USA

I went this route so to save everyone the trouble of having to generate the string manually which removes the chance for spelling errors. And I don't have to document and update everything if I ever add a checkbox because the code just reads out all the checkboxes.

But for kiosk mode, you'll still have to add that as one more parameter by hand or change the page to something like kiosk.html, I'm still working on how to handle that in either CSS or a separate page.

Nothing is up yet, I just want to get any feedback on the workflow.

zandr commented 8 months ago

Sorry, missed a notification on this. Yes, this would be excellent for configuration. A checkbox for 'share as kiosk display' next to the share button would work, or modifying the URL. (For an example of this interaction, see the 'Start at:' checkbox in YouTube's Share dialog.)