CentBrowser Forum

Full Version: [Beta] Closing tabs causes the browser to lose focus
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What the title says. I keep seeing the inactive titlebar background when tabs are closed by any method.
Thanks for your feedback.
We will fix it in stable version.
Here's an AutoHotkey script that circumvents the bug by refocusing the browser window on Ctrl-W and Wheel-click at the top area:

Code:
setTitleMatchMode regex

#ifwinactive ahk_exe \\Cent\s*Browser\\
 ~^w::
   winWaitNotActive,,,1
   ifWinNotActive
     winActivate
   return
 ~MButton up::
   mouseGetPos mx, my
   winGetPos x, y, w, h
   if (mx > x && mx < x + w && my > y && my < y + 64) {
     winWaitNotActive,,,1
     ifWinNotActive
       winActivate
   }
   return
Appreciate it, but I've gotten pretty accustomed to double-click to close, so I'm up shit's creek. It's pretty annoying, but probably a simple fix. Hopefully the security issue will expedite the stable release.
This seems to work with double-clicking:
Code:
setTitleMatchMode regex
#installMouseHook
#keyHistory 20

#ifwinactive ahk_exe \\Cent\s*Browser\\
~^w::
  winWaitNotActive,,,1
  ifWinNotActive
    winActivate
  return
~LButton::
~MButton up::
  mouseGetPos mx, my
  winGetPos x, y, w, h
  if (mx > x && mx < x + w && my > y && my < y + 64
  && (A_ThisHotkey != "~LButton" || A_PriorKey = "LButton" && A_TimeSincePriorHotkey < 500)) {
    winWaitNotActive,,,1
    ifWinNotActive
      winActivate
  }
  return
I can't get it working, as much as I want it to. Wasn't gonna ask because I figured double-click was a PITA. This is narco btw. Maybe you knew, but it feels weird having a conversation without saying so if you don't.

Works if I lose 'setTitleMatchMode regex' and switch to '#ifwinactive ahk_exe chrome.exe'. Weird that the regex title match works for you and not for me though. Regex would be preferable to limit it to Cent, but at least it's working. If you don't know why, I can probably play around with it and get regex title matching working later. I gotta take off now though. Thanks wOxxOm!
Yeah, for whatever reason, that regex wasn't working. Since I'm not really sure about the syntax you were using, I went with a super simplified version which seems to work well. Also added RButton, since I occasionally use that also. Not only is it a decent stopgap, but I'm sure I'll reuse some of this script for things in the future. Good stuff. This is what I ended up with:

Code:
setTitleMatchMode RegEx
#installMouseHook
#keyHistory 20

#ifwinactive .* - Cent Browser
~^w::
 winWaitNotActive,,,1
 ifWinNotActive
   winActivate
 return
~LButton::
~RButton::
~MButton up::
 mouseGetPos mx, my
 winGetPos x, y, w, h
 if (mx > x && mx < x + w && my > y && my < y + 64
 && (A_ThisHotkey != "~LButton" || A_PriorKey = "LButton" && A_TimeSincePriorHotkey < 500)) {
   winWaitNotActive,,,1
   ifWinNotActive
     winActivate
 }
 return