Skip to content

Allow Electron to zoom with CommandOrControl+=#8381

Merged
jryans merged 2 commits intoelement-hq:developfrom
aaronraimist:electron-browser-zoom+
Feb 7, 2019
Merged

Allow Electron to zoom with CommandOrControl+=#8381
jryans merged 2 commits intoelement-hq:developfrom
aaronraimist:electron-browser-zoom+

Conversation

@aaronraimist
Copy link
Copy Markdown
Collaborator

@aaronraimist aaronraimist commented Feb 2, 2019

Fixes #7721

This creates two menu items which looks bad but setting the second one to visible: false seems to disable it too. 😡

screen shot 2019-02-02 at 3 55 48 pm

Hopefully someone will actually solve electron/electron#15496 upstream

Signed-off-by: Aaron Raimist <aaron@raim.ist>
Copy link
Copy Markdown
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

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

I agree it's a bit sad that this is needed... Would it be a bit cleaner to listen for the other shortcut manually without a menu item?

@aaronraimist
Copy link
Copy Markdown
Collaborator Author

aaronraimist commented Feb 5, 2019

I don't know a lot about Electron but it seems like you can't do this very well. I guess you can do
electron/electron#1334 (comment) but I can't get it to work. electron-localshortcut also exists but also doesn't seem great. Electron itself only really supports creating global (affects the app even when the user isn't using the app) shortcuts without a menu item.

Given the workarounds above, we believe this module is better implemented in userland (ex. the excellent electron-localshortcut and thus i'm going to label this a wontfix.

electron/electron#1334 (comment)

@aaronraimist
Copy link
Copy Markdown
Collaborator Author

aaronraimist commented Feb 5, 2019

The other alternative is to get rid of the Shift+Command+Plus shortcut, the menu item will still look "wrong" but at least there will only be one

@jryans
Copy link
Copy Markdown
Collaborator

jryans commented Feb 6, 2019

I'd prefer to find a way to have only one menu item with ⌘+ displayed, while still accepting both Cmd-Plus and Cmd-Shift-Plus, as that's how most other native apps appear to handle this issue.

Looking at Atom, that's what they seem to do, but of course their version is much more complex since they support user remappable shortcuts.

It's a bit sad that this is so hard to solve with Electron... 😓

@jryans
Copy link
Copy Markdown
Collaborator

jryans commented Feb 6, 2019

The other alternative is to get rid of the Shift+Command+Plus shortcut, the menu item will still look "wrong" but at least there will only be one

Maybe that's an okay compromise, since it seems unreasonably hard to do the right thing in Electron.

I don't think anyone ever types Shift-Command-Plus anyway, so at least that would reflect reality.

Signed-off-by: Aaron Raimist <aaron@raim.ist>
Copy link
Copy Markdown
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good to me! 😁

@aishahsofea
Copy link
Copy Markdown

Use CmdOrCtrl+Plus to make sure that the shortcut icon is displayed correctly

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.

Electron: additionally map ctrl (or cmd) + '=' to zoom in

3 participants