auto-toggle-vertical-horizontal-tabs.lua (946B)
1 -- AUTOMATICALLY SWITCH BETWEEN VERTICAL AND HORIZONTAL TABS (IN BRAVE) 2 -- Caveat: does not work when opening tabs in the background though, since the 3 -- window title does not change then :/ 4 PrevTabCount = 0 5 Wf_braveWindowTitle = hs.window.filter 6 .new({ "Brave Browser" }) 7 :setOverrideFilter({ allowRoles = "AXStandardWindow" }) 8 :subscribe(hs.window.filter.windowTitleChanged, function() 9 local success, tabCount = hs.osascript.applescript('tell application "Brave Browser" to count tab in first window') 10 if not success then 11 return 12 end 13 local threshold = 9 14 if (tabCount > threshold and PrevTabCount <= threshold) or (tabCount <= threshold and PrevTabCount > threshold) then 15 -- ctrl-alt-shift-9 bound to Vertical Tab Toggling in Brave Settings 16 -- brave://settings/system/shortcuts 17 hs.eventtap.keyStroke({ "ctrl", "alt", "shift" }, "9", 0, "Brave Browser") 18 end 19 PrevTabCount = tabCount 20 end)