Alex M
-
Posts
12 -
Joined
-
Last visited
Reputation Activity
-
Alex M got a reaction from ctbeiser in Command for update
There should really be an Alfred command for updating Alfred. Like if the search bar shows "There's an Alfred update available", I feel like I should be able to type "update" and have it just do it instead of requiring me to open preferences and do it through there.
-
Alex M reacted to deanishe in Any way to open a URL with a particular browser?
If you're pasting URLs into Alfred, here's a workflow that shows you a bunch of browsers when you paste a URL into Alfred.
It uses the keyword "http", so when you paste a URL into Alfred, it shows you "Open in Safari", "Open in Chrome" ... options. The browsers are configured in the browsers.py file in the workflow:
"""Open a URL in different browsers.""" from __future__ import print_function, absolute_import from collections import namedtuple import json import sys Browser = namedtuple('Browser', 'name path') BROWSERS = [ Browser(u'Safari', u'/Applications/Safari.app'), Browser(u'Chrome', u'/Applications/Google Chrome.app'), Browser(u'Firefox', u'/Applications/FirefoxDeveloperEdition.app'), ] def log(s, *args): """Simple STDERR logger.""" if args: s = s % args print(s, file=sys.stderr) def main(): """Run Script Filter.""" url = sys.argv[1].decode('utf-8') log('url=%r', url) items = [] for b in BROWSERS: items.append(dict( title='Open in ' + b.name, subtitle=b.path, arg=url, icon=dict( path=b.path, type='fileicon', ), valid=True, variables=dict( browser=b.path, url=url, ), )) json.dump(dict(items=items), sys.stdout) if __name__ == '__main__': main()
-
Alex M reacted to Andrew in Any way to open a URL with a particular browser?
There are a few things you can do in Alfred's workflows which help with this.
Firstly, you could have two separate Open URL actions configured as appropriate, then use modifiers on the connections... e.g. return on the result will open the first Open URL object in the default browser, alt+return will open in the second Open URL object with a specified browser. A simple workflow could be:
Keyword to take a URL as argument -> two Open URL actions, one with a modifier.
Another option is to dynamically configure the Open URL object. This is a more advanced workflow technique, but allows for significant flexibility using the JSON utility:
https://www.alfredapp.com/help/workflows/utilities/json/
It's probably best to take the simple approach first.