Pennyworth Posted June 21, 2020 Share Posted June 21, 2020 I use various Google Chrome user profiles ("People", per Chrome's parlance) to keep my personal and work browser environments separate. This means that if I open a Google Docs link tied to work on my personal Chrome user profile, then it will say "You don't have access". I therefore have to always make sure my active Chrome window is of the profile for which I'm logged into an account of. At the same time, I have many simple Keyword --> Open URL workflows. How can I have an 'Open URL' action open not just in a specific browser, but a specific user profile of that browser? Is there a way to accomplish this? Link to comment
deanishe Posted June 21, 2020 Share Posted June 21, 2020 4 minutes ago, Pennyworth said: Is there a way to accomplish this? Instead of using Alfred's Open URL action, you use a Run Script with Language = "/bin/bash" and put whatever command-line command is necessary to open a URL in your preferred profile. Link to comment
Pennyworth Posted June 21, 2020 Author Share Posted June 21, 2020 Thank you @deanishe, this solved my issue! The formula is: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome {URL} --profile-directory={profile_ID} Unfortunately the simpler 'open -a' command won't work when using the 'profile-directory' arg, hence the long application file path. Link to comment
Pennyworth Posted June 21, 2020 Author Share Posted June 21, 2020 I should also add that using a scripting language to accomplish this is noticeably slower than Alfred's "native" 'Open URL' action. I wonder if this could be sped up somehow... Link to comment
deanishe Posted June 21, 2020 Share Posted June 21, 2020 What does "noticeably slower" mean? It is, of course, slower. If it's a lot slower, then you may have misconfigured your shell. Link to comment
Pennyworth Posted June 21, 2020 Author Share Posted June 21, 2020 (edited) 2 minutes ago, deanishe said: What does "noticeably slower" mean? It is, of course, slower. If it's a lot slower, then you may have misconfigured your shell. "Noticeably" is probably an overstatement, but there's definitely a 1-2 second lag when opening URLs via /bin/bash instead of Alfred's native URL Opener (basically instantaneous). Edited June 21, 2020 by Pennyworth Link to comment
deanishe Posted June 21, 2020 Share Posted June 21, 2020 Is it much faster if you use /usr/bin/open URL or leave off the --profile-directory argument? Link to comment
Pennyworth Posted June 21, 2020 Author Share Posted June 21, 2020 3 minutes ago, deanishe said: Is it much faster if you use /usr/bin/open URL or leave off the --profile-directory argument? I tried removing the '--profile-directory' argument from the bash script and it still lags by 2 seconds more than Alfred's Open URL action. Link to comment
deanishe Posted June 21, 2020 Share Posted June 21, 2020 And is it also slow from your shell? Link to comment
Pennyworth Posted June 22, 2020 Author Share Posted June 22, 2020 5 hours ago, deanishe said: And is it also slow from your shell? It takes about the same if I open a URL through the shell/Terminal directly or through the Alfred workflow/keyword. Link to comment
deanishe Posted June 22, 2020 Share Posted June 22, 2020 Then the slowness is in the system–Chrome communication, and there's nothing you can do to speed it up. Link to comment
Pennyworth Posted June 22, 2020 Author Share Posted June 22, 2020 7 hours ago, deanishe said: Then the slowness is in the system–Chrome communication, and there's nothing you can do to speed it up. Yes, seems that way. Makes me wonder how Alfred's workflow action can get the job done faster than the system. Link to comment
deanishe Posted June 22, 2020 Share Posted June 22, 2020 4 hours ago, Pennyworth said: Yes, seems that way. Makes me wonder how Alfred's workflow action can get the job done faster than the system. I suspect it’s because Alfred already has a persistent connection to the shared NSWorkspace, whereas your command/script needs to establish a new one every time it's run. I don’t understand much about the way the whole macOS application runtime works, but when scripting applications, establishing the initial connection typically takes quite a long time, and the subsequent commands execute very quickly in comparison. Perhaps @Andrew could explain it better/correct me if I'm wrong. Pennyworth 1 Link to comment
Just Alex Posted September 17, 2020 Share Posted September 17, 2020 You will probably like/support this wider request: 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