Created
February 24, 2026 13:58
-
-
Save clovelt/557c1d806d4e891d48289a2b08242734 to your computer and use it in GitHub Desktop.
Finder -> Bloom (Multi-Monitor) - Hammerspoon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Finder -> Bloom (Multi-Monitor) | |
| -- Hammerspoon init.lua script so when clicking or alt-tabbing to Finder, it will open Bloom instead. | |
| local bloomName = "Bloom" | |
| local function doRedirect() | |
| local finder = hs.application.get("Finder") | |
| -- If Finder isn't even active anymore, stop | |
| if not finder or not finder:isFrontmost() then return end | |
| local win = finder:focusedWindow() | |
| if win then | |
| local role = win:subrole() | |
| -- Allow: Get Info (AXInspector), Dialogs, Preferences, etc. | |
| -- Standard windows we want to block are "AXStandardWindow" | |
| if role ~= "AXStandardWindow" then | |
| return | |
| end | |
| end | |
| -- THE TRICK: launchOrFocus is better for cross-monitor jumps than activate() | |
| hs.application.launchOrFocus(bloomName) | |
| -- THE HAMMER: Keep forcing Bloom for 1 second until the OS gives in | |
| local start = hs.timer.secondsSinceEpoch() | |
| hs.timer.doUntil(function() | |
| local frontApp = hs.application.frontmostApplication() | |
| return (frontApp and frontApp:name() == bloomName) or (hs.timer.secondsSinceEpoch() - start > 1.0) | |
| end, function() | |
| -- Only hide Finder once Bloom is confirmed as the boss | |
| local f = hs.application.get("Finder") | |
| if f then f:hide() end | |
| end, 0.05) -- Check every 50ms | |
| end | |
| -- 1. Watch for Cmd+Tab / App Activation | |
| finderWatcher = hs.application.watcher.new(function(name, event) | |
| if name == "Finder" and event == hs.application.watcher.activated then | |
| -- Run immediately, then again in 200ms to catch the monitor-switch lag | |
| doRedirect() | |
| hs.timer.doAfter(0.2, doRedirect) | |
| end | |
| end):start() | |
| -- 2. Watch for window focus (Dock clicks) | |
| finderFilter = hs.window.filter.new('Finder') | |
| finderFilter:subscribe(hs.window.filter.windowFocused, function() | |
| doRedirect() | |
| end) | |
| hs.printf("!!! Aggressive Finder -> %s Redirect Active", bloomName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment