Jump to content

Please make Google Chrome open search results in new window


blgentry

Recommended Posts

I did a bunch of research on this and found several old threads about it.  Most of these threads seemed to indicate that "this is a Chrome feature problem."

 

Well, I've discovered that Chrome absolutely has the ability to open URLs in new windows.  From the command line, this works to open in a new window with a URL:

 

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --new-window www.youtube.com

 

It would be wonderful if this could be incorporated into Alfred.  It's driving me nuts to have to break out every Alfred result from a tab to a new window.

 

Thanks,

Brian.

Link to comment
Share on other sites

Hi @blgentry, welcome to the forum.

 

6 hours ago, blgentry said:

Well, I've discovered that Chrome absolutely has the ability to open URLs in new windows.

 

There are multiple ways to do it.

 

What people mean is that the standard on macOS is that it's up to the target application how documents or URLs are opened. It's Chrome's job to provide an "open links in tabs/windows" option, the way Safari and Firefox do (or to obey the "Prefer tabs when opening documents" setting in System Preferences > Dock). In particular, the standard macOS APIs for opening stuff, which every well-behaved Mac app is expected to use, don't allow you to tell the target app how to open something, so getting Chrome to do it would essentially require a parallel implementation of all the parts of Alfred that launch URLs just for Chrome.

 

That’s a hell of a request to work around a lacking Chrome feature, especially when it can be achieved in a few minutes with a shim application that translates standard macOS open location messages into “open in a new Chrome window” commands.

Link to comment
Share on other sites

Are you suggesting that I write some AppleScript (or maybe some other language) to register a fake browser named something like "Chrome New Window Opener".  ... have that be a script that then does the --new-window call to the existing Chrome, so that new Chrome windows will open from Alfred?  I am technical and I do a little bit of programming.  I'm not educated on how I would go about this.  I'm not a Mac developer.  I'd be happy to install such a thing if it existed.

 

Thanks,

Brian.

Link to comment
Share on other sites

41 minutes ago, blgentry said:

Are you suggesting that I write some AppleScript (or maybe some other language) to register a fake browser named something like "Chrome New Window Opener".  ... have that be a script that then does the --new-window call to the existing Chrome, so that new Chrome windows will open from Alfred?

 

That's probably how I would do it if I wanted all URLs to open in a new Chrome window, yes. It's also possible that an app like Choosy or OpenIn (which are designed for people with bespoke URL-opening requirements) has the feature built in.

 

Here's a simple application that opens URLs in a new Chrome window. I used Platypus to turn the following AppleScript into an app with HTTP handlers.

 

on run argv
	tell application "Google Chrome"
		repeat with _url in argv
			make new window
			set URL of active tab of window 1 to _url
		end repeat
	end tell
end run

 

Link to comment
Share on other sites

I spent a good bit of time on this and...

 

Platypus main web site is down, but you can get a binary from MacUpdate or similar sites, which I did.  Created a new app using your script above.  It works.  However, it does not register itself as a web browser with MacOS.  I tried a bunch of things inside of the "accepts dropped items" area as per this StackExchange post:

 

https://stackoverflow.com/questions/42605571/how-to-register-a-python-script-with-mac-osx-as-a-web-browser

 

I tried using "http", "http://", etc as the URI handler and none seemed to make any difference in terms of registering the script as a system wide web browser.

 

So I did more research and found a free program called Finicky:

 

Finicky registers itself as a browser and then has a config file that lets you tell it what browser to use under what circumstances.  Like maybe you want youtube to open in Safari, but Twitter to open in Chrome, and Instagram to open in Brave.  But I just made a simple default that points to my Chrome shim (cleverly named ChromeNewWindowOpen).   

 

So now when I do a default search in Alfred, it gets sent to my "default browser" named Finicky.  Finicky then sends it to ChromeNewWindowOpen, which is just a script/exe that opens a new window in Google Chrome.  This is a long roundabout way of getting there, but it works!  I would really like to just register the shim as a system available web browser, but I couldn't figure it out in an hour of trying.

 

If anyone has suggestions on that front, I'd like to hear them.

 

Thanks for the help so far.  I appreciate it.

 

Brian.

Link to comment
Share on other sites

12 minutes ago, blgentry said:

I couldn't figure it out in an hour of trying

 

You need to add URI handlers for http and https.


At least, that’s what I did with the Platypus app I linked above, and that works. Also put the app in an Applications folder, or run it, so the system notices it and registers it as a handler.

Edited by deanishe
Link to comment
Share on other sites

2 minutes ago, deanishe said:

 

You need to add URI handlers for http and https.

 

Is that as simple as just typing those words (http, https) into the name of the handlers that appear  in the URI area?  See screen shot.

 

I did that, created the app in /Applications, launched it, but still see no new entries in Preferences > General > Default Web Browser.  I feel like I'm missing something simple.

 

Thanks again,

Brian.

Screen Shot 2021-12-31 at 10.55.18 AM.png

Link to comment
Share on other sites

After more testing, I've determined that Alfred still opens Bookmarks in a new tab as opposed to a new window.  This is understandable from a technical perspective.  But it's undesirable from a interface consistency perspective.

 

I've been meaning to give Safari a real try for a while.  I might just take this as the reason to do it and switch to Safari and see if I miss anything from Chrome.

 

Brian.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...