Jump to content

URL Scheme (or other method) to open Alfred's Preferences e.g. to the "Features → Clipboard History" section?


Recommended Posts

Posted

Is there any way to programmatically open Alfred's preferences app to specific areas? For example directly to the "Features → Clipboard History" section? Via URL Scheme perhaps?

Posted (edited)

Until there's a better way, I came up with this poor man's solution... 

🤷

 

#!/usr/bin/env bash

# quits Alfred Prefs (if open) and then opens it to the Features -> Clipboard tab

bid='com.runningwithcrayons.Alfred-Preferences'

osascript <<EOS &>/dev/null
with timeout of 5 seconds
  tell application id "$bid" to quit
end timeout
EOS

defaults write $bid lastFeature clipboard
defaults write $bid lastTab features
open -b $bid

 

Edited by luckman212
Posted (edited)

Hi @vitor !

 

The use case is I have a script that does some processing on recent files that are in the clipboard history. For the script filter to work, that feature needs to be enabled. I was able to figure out how to programmatically check for that, but to close the loop I'd like the "action" item from that script filter to directly open Alfred Prefs to the page so the user can enable the checkbox.

 

Indeed, ?clipboard does take me to the correct place! But I was hoping the script could open this for the user automatically. I assume there's probably an undocumented URL scheme available, since I guess that might be how Alfred gets the separate Alfred Preferences.app to open directly to that specific page.

Edited by luckman212
  • 5 weeks later...
Posted (edited)

@Andrew This is great! Exactly what I was hoping for. Thank you!

 

For reference, here's the URL I used (updated to the new scheme Andrew posted below)

 

open 'alfredpreferences://navigateto/features>clipboard>{history}'

Edited by luckman212
Posted

@luckman212 good good :)

 

If you update to 5.1 b2132, I've actually tweaked the URL scheme to be alfredpreferences://navigateto/... but it'll be backwards compatible with the link you're using (for now). If this URL scheme is ever officially supported, it'll certainly use navigateto/

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...