Zen Browser – Detect Glance vs Normal Tab and Run Different BTT Actions
I created this BetterTouchTool trigger for Zen Browser.
The trigger detects whether the currently active Zen tab is:
GLANCE
or a normal browser tab:
NORMAL
It does not use screenshots, image recognition, Accessibility UI detection, or another helper app.
Instead, BTT connects directly to Zen's Firefox Remote Debugging interface and checks the active browser tab.
The important Zen UI selector is:
tab[zen-glance-tab][selected]
This means the trigger only detects a Glance that is currently active/selected.
So if you have a Glance open in another tab but you're currently using a normal tab, the result is still:
NORMAL
Example use
My current setup uses:
If Glance is active
→ Command + Click
Else
→ Option + Click
But you can replace these with any BTT actions you want.
The trigger also stores the result in a BetterTouchTool variable:
zen_tab_type
The value will be either:
GLANCE
or:
NORMAL
So the same detection can also be reused in other BTT triggers.
Zen setup required
Before using the trigger, Zen needs to allow Remote Debugging.
Open:
about:config
Set these preferences:
devtools.debugger.remote-enabled = true
devtools.chrome.enabled = true
devtools.debugger.prompt-connection = false
Then fully quit Zen.
Zen must be launched with its debugging server enabled on port 6000.
Run:
open -a "Zen" --args --start-debugger-server 6000
You can check that it is running with:
lsof -i :6000
You should see something similar to:
zen ... TCP localhost:6000 (LISTEN)
Once Zen is listening on port 6000, the BTT trigger can detect the current Glance state.
Important
If Zen is started normally without:
--start-debugger-server 6000
the trigger will not be able to connect.
So if you want this to work every time you start Zen, I recommend creating a BTT action or macOS launcher that always starts Zen using:
open -a "Zen" --args --start-debugger-server 6000
The setup only requires:
BetterTouchTool + Zen Browser
No Hammerspoon or other helper application is required.
Short description for the BTT preset
Zen Glance Detector
Detects whether the currently active Zen Browser tab is a Glance or a normal tab and allows different BTT actions for each state. Uses Zen's Firefox Remote Debugging interface rather than screenshots or Accessibility detection. Requires Zen to run with --start-debugger-server 6000.
2 finger click on link to open as Glance tab.bttpreset (6.9 KB)