From 75200ff66448a4601d403069914aa072a9f16ea3 Mon Sep 17 00:00:00 2001 From: Franco Pellicciotti Date: Sat, 16 May 2026 22:42:29 -0400 Subject: [PATCH] Updated to reflect module changes --- focus_profiles.json | 17 ++++++++ init.lua | 100 ++++++++++---------------------------------- 2 files changed, 38 insertions(+), 79 deletions(-) create mode 100644 focus_profiles.json diff --git a/focus_profiles.json b/focus_profiles.json new file mode 100644 index 0000000..8e7fa0f --- /dev/null +++ b/focus_profiles.json @@ -0,0 +1,17 @@ +{ + "Work": { + "keepOpen": ["Slack", "Microsoft Teams", "Visual Studio Code", "Terminal", "Google Chrome"], + "close": ["Discord", "Steam", "Komga", "Kavita"], + "dimAlpha": 0.3 + }, + "Home": { + "keepOpen": ["Discord", "Steam", "Komga", "Kavita", "Plex"], + "close": ["Slack", "Microsoft Teams"], + "dimAlpha": 0.1 + }, + "Study": { + "keepOpen": ["AFFiNE", "Obsidian", "Anki", "Preview", "Safari"], + "close": ["Slack", "Microsoft Teams", "Discord", "Steam", "Instagram"], + "dimAlpha": 0.5 + } +} \ No newline at end of file diff --git a/init.lua b/init.lua index 23db670..26ddfef 100644 --- a/init.lua +++ b/init.lua @@ -1,111 +1,53 @@ --- Allow external apps like Raycast to execute custom Hammerspoon Lua functions -hs.allowAppleScript(true) -- ======================================================================== -- HEADLESS WORKSPACE BACKGROUND ENGINE (FORCED AT BOOT) -- ======================================================================== +hs.allowAppleScript(true) hs.menuIcon(false) hs.dockIcon(false) hs.ipc.cliInstall("/opt/homebrew") hs.alert.show("Hammerspoon Headless Daemon Active", 2) --- ~/.hammerspoon/init.lua --- Load Config First --- config = require("Config") --- --- Load your HyperKey +-- Core Subsystems and Global Bindings require("HyperKey") - require('SearchWindows') require('Caffeine') require('AppBorders') --- CRITICAL FOR RAYCAST INTERACTION: Bind the return value to a global variable +-- IPC Bridges & Trackers LayoutSelector = require('LayoutSelector') --- require('System_Tweaks') -- Used for Time Machine Throttle Disable --- require("Focus") -- Does not work with layout saver - Not needed if using Monocle - Focusdim is better than Monocle --- require("FocusMode") -- Removed since I am using Focusdim --- --- Network Center is currently disabled since menus are not working in Hammerspoon - Will re-enable once I can fix the menu issues --- Network = require("NetworkCenter") --- -require("modules.mouseJiggle").start() -- used to trigger Focusdim - --- Load the window management module +-- Active Modules +require("modules.mouseJiggle").start() local windowMgr = require("WindowManager") local productivity = require("productivity") --- For Affine +-- DEEP FOCUS MODULE (New Integration) +local focus = require("modules.focus") + +-- Affine Note Engine Integration local quickNote = require("affine_quick_note") quickNote.init() require("affine_clipper"):init() --- Load Spoon Files +-- Spoons Engine & External Tool Integrations hs.loadSpoon('SpoonInstall') hs.loadSpoon('SpeedMenu') hs.loadSpoon('BrewInfo') --- ========================================== --- SPOON CONFIGURATION --- ========================================== +-- Run isolated Spoon setup configurations +require("modules.spoon_config") ----- SpeedMenu Config -if spoon.SpeedMenu then - -- Define the Fix Function (includes MAC and IPv6) - local function applyFullMenuFix() - local interface = spoon.SpeedMenu.interface or "en0" - local ssid = hs.wifi.currentNetwork() or "Disconnected" - local details = hs.network.interfaceDetails(interface) - - local ipv4 = (details and details.IPv4) and details.IPv4.Addresses[1] or "N/A" - local ipv6 = (details and details.IPv6) and details.IPv6.Addresses[1] or "N/A" - - -- Get MAC Address via shell - local macaddr = hs.execute('ifconfig ' .. interface .. ' | grep ether | awk \'{print $2}\''):gsub("%s+", "") - - local menuitems = { - { title = "SSID: " .. ssid, fn = function() hs.pasteboard.setContents(ssid) end }, - { title = "IPv4: " .. ipv4, fn = function() hs.pasteboard.setContents(ipv4) end }, - { title = "IPv6: " .. ipv6, fn = function() hs.pasteboard.setContents(ipv6) end }, - { title = "MAC: " .. macaddr, fn = function() hs.pasteboard.setContents(macaddr) end }, - { title = "-" }, - { title = "Rescan Network Interfaces", fn = function() spoon.SpeedMenu:rescan() end } - } - spoon.SpeedMenu.menubar:setMenu(menuitems) - end - - -- Hook the rescan method - local oldRescan = spoon.SpeedMenu.rescan - spoon.SpeedMenu.rescan = function(self) - oldRescan(self) - applyFullMenuFix() - end - - -- Toggle Logic (Starts as OFF) - local speedMenuRunning = false - hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function() - if speedMenuRunning then - spoon.SpeedMenu:stop() - hs.alert.show("SpeedMenu Stopped") - else - spoon.SpeedMenu:start() -- This puts it in the menu bar - applyFullMenuFix() -- This populates the data - hs.alert.show("SpeedMenu Started") - end - speedMenuRunning = not speedMenuRunning - end) +-- ======================================================================== +-- RAYCAST / INTER-PROCESS COMMUNICATION (IPC) BRIDGE BINDINGS +-- ======================================================================== +-- Expose the focus module methods globally so the hs CLI tool can call them +function ActivateDeepFocus(profileName) + return focus.activate(profileName) end ----- SpeedMenu Config END ----- BrewInfo -if spoon.BrewInfo then - hs.hotkey.bind({"cmd", "alt", "ctrl"}, "I", function() - spoon.BrewInfo:showBrewInfo() - end) - hs.hotkey.bind({"cmd", "alt", "ctrl"}, "J", function() - spoon.BrewInfo:showBrewInfoCurSel() - end) +function ClearDeepFocus() + return focus.clear() end ----- BrewInfo END +-- Boot Confirmation hs.alert.show("Hammerspoon Config Reloaded") \ No newline at end of file