From 6a0a954e7ed1d990e1f7ebf7bd6a687f3d552c32 Mon Sep 17 00:00:00 2001 From: Franco Pellicciotti Date: Sat, 16 May 2026 01:21:57 -0400 Subject: [PATCH] Initial Version --- FocusMode.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 FocusMode.lua 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