Skip to content

Add option for hiding the menubar on Windows/Linux desktop - #13978

Merged
gtritchie merged 20 commits into
mainfrom
feature/autohide-electron-menubar
Dec 1, 2023
Merged

gtritchie merged 20 commits into
mainfrom
feature/autohide-electron-menubar

Conversation

@gtritchie

@gtritchie gtritchie commented Nov 22, 2023 •

Copy link
Copy Markdown
Member

Intent

Addresses #8932 and #13973

Approach

Added a new checkbox option to autohide the menubar (at the bottom of Tools / Global Options / General).

When enabled, the menu is hidden by default but is revealed by tapping the Alt key or using a shortcut such as Alt+F for the File menu.

Also fixed a glitch where you could make the menubar appear on secondary windows if you tapped the Alt key (e.g. editors, git, help, zoomed plots, and so forth). The menu isn't intended to be on those windows and may do weird things.

This was tougher to fix than it sounds. All windows in an Electron app automatically inherit the main menu from the main window. We remove it when we create those windows, but anytime RStudio updates the main menu (e.g. if you open a file in the editor) the menus get recreated and put back on all windows. So we have to remove the menu again from all but the main window anytime the menu updates. Fun. This is done via a broadcast message anytime we set a new main menu.

Automated Tests

None

QA Notes

Autohiding the menu is specific to Desktop (Electron) for Windows and Linux. Confirm that when this option is enabled, the main menu is hidden until you tap the Alt key. Also checked that shortcuts work (e.g.Alt+Ffor File menu).

To check that menus don't appear on the secondary windows, click on the window and tap Alt and make sure no menu appears.

Be sure to test at least one instance of each class of windows (these have different code paths):

Diagnostic Windows

Used by the "Show GPU Diagnostics" and "Show Accessibility Diagnostics" commands. The issue is only partially fixed on these windows. If you bring up one of these and then go back to the main window and do something that triggers a rebuild of the main menu (e.g. open a file), the menu will reappear on these windows. I didn't think this was worth fixing given the nature of these windows.

Minimal Windows

Use the Zoom button on the plots pane or the viewer pane to see a "minimal window".

Secondary Windows

Use the "Show in new window" button in the Help Pane to see an instance of a Secondary Window.

Satellite Windows

These are used by "popped-out" editors and the Version Control window (possibly others, but testing these two will be sufficient).

Documentation

N/A

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

@gtritchie gtritchie added this to the Chocolate Cosmos milestone Nov 22, 2023

@sharon-wang sharon-wang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@gtritchie
gtritchie marked this pull request as ready for review December 1, 2023 16:49
@gtritchie
gtritchie merged commit 5183307 into main Dec 1, 2023
@gtritchie
gtritchie deleted the feature/autohide-electron-menubar branch December 1, 2023 16:53
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

Successfully merging this pull request may close these issues.

4 participants