Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu item to copy URL addition #80

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

ding-ma
Copy link

@ding-ma ding-ma commented May 30, 2020

Status Type Env Vars Change
Ready Feature No

Problem

Removed .idea and .vscode folder. Those are user specific and should not be share through git since it contains their own personalized settings.
Resolves #79 .

Solution

How did you solve the problem?
added 5 lines of code to copy the url onto the clipboard.

Before & After Screenshots

BEFORE:
[insert screenshot here]

AFTER:
[insert screenshot here]

Other changes (e.g. bug fixes, UI tweaks, small refactors)

Deploy Notes

Notes regarding deployment of the contained body of work. These should note any
new dependencies, new scripts, etc.

New environment variables:

  • env var : env var details

New scripts:

  • script : script details

New dependencies:

  • dependency : dependency details

New dev dependencies:

  • dependency : dependency details

childview.webContents.loadURL(windowSettings.url);
});

electronLocalshortcut.register(childwin, ["F8"], () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there only be one of these blocks?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, can we add it to the menu? It looks like we could add it to menu.js, but I'm not sure how to access the window from there. If we put it in the menu, then Mac users will be able to override the keyboard shortcut.

Copy link
Owner

Choose a reason for hiding this comment

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

The way that the app is laid out, where a browser view (containing the website) is encapsulated inside of a larger window (containing the titlebar) requires the shortcut to be registered to both the view and the window. This ensures that the keyboard shortcut is capture regardless of whether the user is focused on the titlebar or the view.

However, I agree that adding listeners twice adds unnecessary bloat. It would be optimal if there is a way to move this to menu.js to make it a global shortcut or refactor it.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, good points and thanks for feedback! I thought that adding it in childwindow.js was more logical since the file would open in a child window. Thus, you would only like the link of the child window. I'll take a look next weekend as I have a final coming up Thursday!

Copy link
Owner

@alexkim205 alexkim205 left a comment

Choose a reason for hiding this comment

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

Do you think there is a way to use define these shortcuts in menu.js instead of using electronLocalShortcut?

childview.webContents.loadURL(windowSettings.url);
});

electronLocalshortcut.register(childwin, ["F8"], () => {
Copy link
Owner

Choose a reason for hiding this comment

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

The way that the app is laid out, where a browser view (containing the website) is encapsulated inside of a larger window (containing the titlebar) requires the shortcut to be registered to both the view and the window. This ensures that the keyboard shortcut is capture regardless of whether the user is focused on the titlebar or the view.

However, I agree that adding listeners twice adds unnecessary bloat. It would be optimal if there is a way to move this to menu.js to make it a global shortcut or refactor it.

@mwean
Copy link
Contributor

mwean commented May 30, 2020

Do you think there is a way to use define these shortcuts in menu.js instead of using electronLocalShortcut?

It looks like you can add shortcuts to the menu items, like accelerator: "CmdOrCtrl+T" for "Toggle Dark Mode". I'm just not sure how to communicate from there to the active window to get the URL.

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.

[💡 FEATURE] - Menu item to copy URL
3 participants