-
-
Save miketaylr/5969656 to your computer and use it in GitHub Desktop.
#/usr/bin/env python | |
from LaunchServices import LSSetDefaultHandlerForURLScheme | |
from LaunchServices import LSSetDefaultRoleHandlerForContentType | |
# 0x00000002 = kLSRolesViewer | |
# see https://developer.apple.com/library/mac/#documentation/Carbon/Reference/LaunchServicesReference/Reference/reference.html#//apple_ref/c/tdef/LSRolesMask | |
LSSetDefaultRoleHandlerForContentType("public.html", 0x00000002, "com.operasoftware.operanext") | |
LSSetDefaultRoleHandlerForContentType("public.xhtml", 0x00000002, "com.operasoftware.operanext") | |
LSSetDefaultHandlerForURLScheme("http", "com.operasoftware.operanext") | |
LSSetDefaultHandlerForURLScheme("https", "com.operasoftware.operanext") |
is there any way to make your python program work as a default browser and whenever there is a specific URL lunches chrome or firefox
@wolfpat01 You have probably found out this already, but for other people who might be interested in the same thing: this can be achieved by using Hammerspoon with URLDispatcher extension. Not related to a Python script, but might be useful for some people to know. In addition to that, URLs there can be configured in a flexible manner with the help of regular expressions. Please pay attention that once configures you will need to set Hammerspoon as your default browser for using the aforementioned extension properly.
if you are getting "module not found" run this in your terminal:
pip install pyobjc-framework-LaunchServices
is there any way to make your python program work as a default browser and whenever there is a specific URL lunches chrome or firefox