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

URLs should open in system browser #149

Closed
g000m opened this issue Aug 19, 2023 · 6 comments
Closed

URLs should open in system browser #149

g000m opened this issue Aug 19, 2023 · 6 comments

Comments

@g000m
Copy link

g000m commented Aug 19, 2023

Current Behavior: Clicking links within GodMode opens the links within the Electron application itself.
Desired Behavior: Links should be opened by the system's default web browser.

I've never worked on an electron app, but Bard suggests the following as a fix.

"This feature can be implemented by registering a window open handler on the application's BrowserWindow. The window open handler can be used to intercept links that are clicked by the user and open them in the system browser instead."

import { shell } from "electron";

const mainWindow = new BrowserWindow();

mainWindow.webContents.on('new-window', function(event, url) {
  event.preventDefault();
  shell.openExternal(url);
});
@swyxio
Copy link
Contributor

swyxio commented Aug 20, 2023

yeah we should offer that option. i'm worried about opening ALL links in the system browser, but we can add the filters later

@swyxio
Copy link
Contributor

swyxio commented Aug 21, 2023

@codingnninja
Copy link
Contributor

codingnninja commented Aug 22, 2023

this is better https://stackoverflow.com/questions/31749625/make-a-link-from-electron-open-in-browser

I am currently working on this and I realized we have to bind the solution you referenced to the DOM so that it can handle links generated on the fly.

Quick one, I just fixed dependency conflicts while installing it, so I want to know if I should make a PR before fixing the actual issue or I should ignore the dependency conflicts entirely and focus on fixing the main issue?

@swyxio
Copy link
Contributor

swyxio commented Aug 22, 2023

@codingnninja ignore the dep conflicts, i am fixing in #180 thanks!

@codingnninja
Copy link
Contributor

@swyxio I have fixed it but I am a bit confused by the contribution guideline. I forked the repo and pull the forked version but the guideline suggests I should pull from the main repo.

I could have followed the guideline but it seems incomplete. Please I need your input on the expected way before I do it my way.

Thanks.

@swyxio
Copy link
Contributor

swyxio commented Aug 25, 2023

@codingnninja the contribution docs are a bit out of date unfortunately. you did a great job!

@swyxio swyxio closed this as completed Aug 25, 2023
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

No branches or pull requests

3 participants