Replies: 1 comment
-
I ended up accomplishing this with AHK script that tells bt to change the default browser profile to open links with. This works, but it'd be cool if there was a bt only solution. chromeId := "chrome.Profile 2" ; Professional
firefoxId := "firefox.Profile0" ; Personal
btExe := "bt.exe"
lastSet := ""
; create a hidden gui (needed for shell hook registration)
myGui := Gui()
myGui.Opt("+AlwaysOnTop +ToolWindow -Caption")
myGui.Show("Hide") ; start hidden
myGui.Move(0, 0, 0, 0) ; set size to 0x0 at (0,0)
; shell hook registration
WM_SHELLHOOK := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK", "UInt")
DllCall("RegisterShellHookWindow", "Ptr", myGui.Hwnd)
OnMessage(WM_SHELLHOOK, ShellProc)
ShellProc(wParam, lParam, msg, hwnd) {
global btExe, chromeId, firefoxId, lastSet
if (wParam = 4) { ; HSHELL_WINDOWACTIVATED
try {
pid := WinGetPID("ahk_id " lParam)
proc := ProcessGetName(pid)
} catch {
return
}
target := ""
if (proc = "chrome.exe") {
target := chromeId
} else if (proc = "firefox.exe") {
target := firefoxId
}
if (target != "" && target != lastSet) {
command := Format("{1} browser set default {2}", btExe, target)
Run(command, "", "Hide")
lastSet := target
}
}
}
while true
Sleep 100000 Above is chatgpt slop that I hacked to get it working, but it works and is completely in the background. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I just want the last used browser to handle links. This ends up being the correct/desired browser 98% of the time, good enough for me.
Need this because now I'm trying to use firefox + chrome at same time
Beta Was this translation helpful? Give feedback.
All reactions