diff --git a/FocusMode.lua b/FocusMode.lua new file mode 100644 index 0000000..5becb03 --- /dev/null +++ b/FocusMode.lua @@ -0,0 +1,38 @@ +-- 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 \ No newline at end of file