38 lines
957 B
Lua
38 lines
957 B
Lua
-- FocusMode.lua
|
|
|
|
local obj = {}
|
|
obj.isActive = false
|
|
|
|
-- Load the native C-optimized window highlighting extension
|
|
local hl = require("hs.window.highlight")
|
|
|
|
-- Configure the native isolation overlay properties
|
|
-- 78% black mask for deep workspace distraction isolation
|
|
hl.ui.isolateColor = {0, 0, 0, 0.78}
|
|
|
|
-- Start the background layout tracking engine loop natively
|
|
hl.start()
|
|
|
|
function obj.toggle()
|
|
-- Native switch to toggle isolate highlight state instantly
|
|
hl.toggleIsolate()
|
|
|
|
obj.isActive = not obj.isActive
|
|
if obj.isActive then
|
|
hs.alert.show("Focus Mode Active", 1.5)
|
|
else
|
|
hs.alert.show("Focus Mode Disabled", 1.5)
|
|
end
|
|
end
|
|
|
|
-- Native Hotkey Binding (Maps to your global hyper + F layout configuration)
|
|
if hyper then
|
|
hs.hotkey.bind(hyper, "F", function()
|
|
obj.toggle()
|
|
end)
|
|
end
|
|
|
|
-- Export module instance globally for our external Raycast script runner triggers
|
|
FocusMode = obj
|
|
|
|
return obj |