Hamerspoon run script by cli/terminal

161 views Asked by At

I am writing in the init.lua script.

function openObsidianAndSearch()
    -- Open Obsidian
    hs.application.launchOrFocus("Obsidian")
    
    -- Wait for a moment to ensure Obsidian has focus
    hs.timer.doAfter(1, function()
        -- Send Cmd+Shift+F to Obsidian
        hs.eventtap.keyStroke({"cmd", "shift"}, "F")
    end)
end

I want to run it from the terminal.

hs -c 'openObsidianAndSearch()'
fish: Unknown command: hs

I installed Hammerspoon by brew install --cask hammerspoon.

0

There are 0 answers