Acidham Posted November 27, 2015 Share Posted November 27, 2015 (edited) Safirechrome provides the ability to open an URL from current browser window in Safari, Chrome or Firefox. When URL is entered in Alfred Safirechrome uses the new URL. http://www.packal.org/workflow/safirechrome Edited November 27, 2015 by Acidham Link to comment
Acidham Posted February 18, 2016 Author Share Posted February 18, 2016 Update to v 1.1 Source browser windows will be closed after URL will be send to target browser. http://t.cn/RG6GcCG Link to comment
Acidham Posted March 4, 2016 Author Share Posted March 4, 2016 Safirechrome provides the ability to open an URL from current browser window in Safari, Chrome,Firefox or Opera. Only installed browsers will be listed as target browser. Update v 1.2: Opera added Only installed browsers will be listed Ability to type and search for a target browser Link to comment
robro Posted March 26, 2016 Share Posted March 26, 2016 Nice workflow, but one little problem: Safari opens always (with a blank tab), even when it´s not target or source browser. Link to comment
Acidham Posted March 27, 2016 Author Share Posted March 27, 2016 Oh wow, thx for the bug report! It seems that Safari will be opened wether applescript takes action on it or not. Fixed with version 1.3 http://www.packal.org/workflow/safirechrome Link to comment
robro Posted March 27, 2016 Share Posted March 27, 2016 Great. Works. Thanks a lot... Link to comment
Cameron B Posted September 26, 2019 Share Posted September 26, 2019 I'm trying to edit it so it just goes back and forth between safari and chrome - no stop in an Alfred window looking for a return along the way. Sadly I've got it down to 1 choice, but it still needs a return. set query to "{query}" set xml to "<?xml version=\"1.0\"?><items>" set browsers to {"Google Chrome"} set browsersID to {"com.google.Chrome"} set listCount to 0 repeat with browser in browsers set listCount to listCount + 1 set browserID to item listCount of browsersID if checkApp(browserID) and (query is equal to "" or browser contains query) then set xml to xml & "<item arg=\"" & browserID & "\" valid=\"yes\"> <title>" & browser & "</title> <subtitle>Open URL in " & browser & "</subtitle> <icon>" & browser & ".png</icon></item>" end if end repeat set xml to xml & "</items>" return xml on checkApp(theBundleId) try tell application "Finder" to get application file id theBundleId return true on error return false end try end checkApp Link to comment
Acidham Posted September 27, 2019 Author Share Posted September 27, 2019 @Cameron B not sure if I understand on wha you try to achieve. tell me... Link to comment
Cameron B Posted September 27, 2019 Share Posted September 27, 2019 I want it to work like firechrome, but for Chrome and Safari. If I'm in Safari, I want the hotkey to take me directly to the same page in Chrome. If I'm in Chrome, I want the hotkey to take me directly to the same page in Safari. Thanks for your help. Link to comment
deanishe Posted September 27, 2019 Share Posted September 27, 2019 (edited) 2 hours ago, Cameron B said: I want it to work like firechrome, but for Chrome and Safari. Then you're going about it the wrong way. You need a Run Script element instead of a Script Filter. If there's a Script Filter, Alfred will always appear. If you create your Hotkey with these settings: You can use this script in a Run Script action with Language = /usr/bin/osascript (JS): ObjC.import('stdlib'); const browser = $.getenv('focusedapp'), safariId = 'com.apple.Safari', chromeId = 'com.google.Chrome'; console.log(`active app = ${browser}`); var chrome = Application(chromeId), safari = Application(safariId); chrome.includeStandardAdditions = true; safari.includeStandardAdditions = true; function run() { switch(browser) { case safariId: var url = safari.documents[0].url(); chrome.openLocation(url); chrome.activate(); break; case chromeId: var url = chrome.windows[0].activeTab.url(); safari.openLocation(url); safari.activate(); break; default: throw(new Error(`unsupported browser: ${browser}`)); } } Edited September 27, 2019 by deanishe Link to comment
friedmilk Posted March 9, 2020 Share Posted March 9, 2020 Is there any way to get this to work with Brave? I've tried modifying the script without any luck. (I have no idea what I'm doing) Link to comment
deanishe Posted March 9, 2020 Share Posted March 9, 2020 27 minutes ago, friedmilk said: Is there any way to get this to work with Brave? If you mean the script I posted, change the line chromeId = 'com.google.Chrome'; to chromeId = 'com.brave.Browser'; Link to comment
friedmilk Posted March 10, 2020 Share Posted March 10, 2020 (edited) 18 hours ago, deanishe said: If you mean the script I posted, change the line chromeId = 'com.google.Chrome'; to chromeId = 'com.brave.Browser'; I'm thinking about the original workflow. Do you know what I'd have to change to achieve that? Edited March 10, 2020 by friedmilk Link to comment
Acidham Posted March 10, 2020 Author Share Posted March 10, 2020 (edited) Update to v2.1: http://www.packal.org/workflow/safirechrome Edited March 10, 2020 by Acidham Link to comment
friedmilk Posted March 10, 2020 Share Posted March 10, 2020 3 hours ago, Acidham said: Update to v2.1: http://www.packal.org/workflow/safirechrome Thank you very much. It's a bit glitchy when you're sending it to Brave when it's closed and it has to open the program. Sometimes Brave just starts up and is at a blank page. That might be a problem with Brave and not the workflow, I guess. Link to comment
Acidham Posted March 11, 2020 Author Share Posted March 11, 2020 @friedmilk Seems yes, I played around yesterday with Brave but it seems that Brave is not handling `make new tab` properly. For other browsers it works but for Brave not. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now