- end)
- end
- -- Hotkey definitions (created disabled, activated by the app watcher below).
- -- hs.hotkey.new() registers a hotkey without enabling it — unlike hs.hotkey.bind() which immediately activates the binding globally.
- --
- -- The downPresses count depends on the order of models in Cursor's dropdown.
- -- Adjust these numbers if the model list changes.
- local cursorHotkeys = {}
- cursorHotkeys.autorun = hs.hotkey.new({"cmd", "ctrl"}, "f8", function() adjustCursorAutoRun() end)
- cursorHotkeys.codex = hs.hotkey.new({"cmd", "ctrl"}, "f9", function() switchCursorModel(6) end)
- cursorHotkeys.sonnet = hs.hotkey.new({"cmd", "ctrl"}, "f10", function() switchCursorModel(5) end)
- cursorHotkeys.opus = hs.hotkey.new({"cmd", "ctrl"}, "f11", function() switchCursorModel(4) end)
- cursorHotkeys.composer = hs.hotkey.new({"cmd", "ctrl"}, "f12", function() switchCursorModel(3) end)
- -- hs.application.watcher fires callbacks when apps are activated, deactivated, launched, or terminated. We use `activated` to know when Cursor gains focus. Storing the watcher in M (the module table) prevents it from being garbage-collected, which would silently stop the watcher.
- local function appWatcherCallback(appName, eventType, _appObject)
- if eventType == hs.application.watcher.activated then
- if appName == "Cursor" then