Skip to content

Add view mode to hide away menu and status bars#1587

Merged
jotaen4tinypilot merged 6 commits intomasterfrom
focus-mode/3-standalone-mode
Aug 24, 2023
Merged

Add view mode to hide away menu and status bars#1587
jotaen4tinypilot merged 6 commits intomasterfrom
focus-mode/3-standalone-mode

Conversation

@jotaen4tinypilot
Copy link
Contributor

@jotaen4tinypilot jotaen4tinypilot commented Aug 23, 2023

Part of #728, stacked onto #1586.

As demonstrated and discussed in the original proof-of-concept branch, we want to hide the status bar and menu bar in the popup window via a query parameter. So by appending ?viewMode=standalone to the TinyPilot URL, this PR hides the status bar, the menu bar, and the on-screen keyboard.

We will use this in a later PR, when adding the menu item for opening a “real” popup window.

Screenshot 2023-08-23 at 18 38 09

The query parameter can also be used independent of the popup window, which e.g. allows for the iframe use-case.

Notes

  • prettier-ignore is needed above <remote-screen>, since Prettier cannot handle Jinja2 templates, and would enforce a pretty bulky formatting otherwise.
  • I had to pull out a --bar-padding CSS variable in the <remote-screen> component, so that we can dynamically override the value. I forgot that in the earlier PR.
  • In index.html, I injected the display: none via a plain <style> block to hide the elements from the page. Since index.html itself isn’t a web component, I’m not sure we can mimic our usual pattern with HTML attributes here (example), at least not without introducing more complexity and indirection. The <style> block is not super beautiful, but I thought it’s simple and straightforward at least.
  • Note sure standalone is the greatest name for the query parameter value. Potential alternatives: “screen-only”, “focus-mode”, “dedicated-screen”. (It’s maybe not that critical, however… 🤔) In any event, I found something like ?viewMode=standalone more descriptive and flexible than standaloneMode=true.
    Review on CodeApprove

Copy link
Contributor

@jdeanwallace jdeanwallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

⏳ Approval Pending (1 unresolved comments)
Approval will be granted automatically when all comments are resolved

LGTM!


In: app/templates/index.html:

> Line 20
    </style>

(optional) What do you think about controlling the remote-screen's padding from here too?

Something like:

#remote-screen {
  --menu-bar-height: 0;
  --status-bar-height: 0;
  --bar-padding: 0;
}

That way we can drop the the remote-screen's no-margins attribute and all the standalone-mode styling is grouped together.


👀 @jotaen4tinypilot it's your turn please take a look

Base automatically changed from focus-mode/2-html to master August 24, 2023 13:36
Copy link
Contributor Author

@jotaen4tinypilot jotaen4tinypilot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

In: app/templates/index.html:

> Line 26
    </style>

Yeah, that’s indeed simpler and more concise!

Copy link
Contributor

@jdeanwallace jdeanwallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

Approved: I have approved this change on CodeApprove and all of my comments have been resolved.

@jdeanwallace jdeanwallace dismissed their stale review August 24, 2023 13:42

Review approved on CodeApprove

@jotaen4tinypilot jotaen4tinypilot merged commit 2dd5354 into master Aug 24, 2023
@jotaen4tinypilot jotaen4tinypilot deleted the focus-mode/3-standalone-mode branch August 24, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants