Never mind, I have it working now! I accidentally missed out including the following at the top of my script: local log = hs.logger.new('hammerspoon','debug') 😬
Hey Cristian, I'm very interested in the app launcher you've implemented here. The automatic hiding is genius!
I've ran into an issue though and am getting an error. Hoping you might be able to spare a moment to take a look?
This is the contents of AppLauncher.lua, which I am successfully loading into Hammerspoon via AppLauncher = require('AppLauncher') in my init.lua
-- open hide app
function openApp(name)
local app = hs.application.get(name)
log.i("open App")
log.i(name)
log.i(app)
if app then
if app:isFrontmost() then
log.i("app hiding")
app:hide()
else
log.i("app focusing ")
app:mainWindow():focus()
end
else
log.i("app launch ")
hs.application.launchOrFocus(name)
end
end
function reminders()
openApp("Reminders")
end
hs.hotkey.bind({}, 'F14', reminders)
But when I issue the shortcut key, I get the following error
ERROR: LuaSkin: hs.hotkey callback: /Users/nathan/.hammerspoon/AppL2.lua:5: attempt to index a nil value (global 'log')
stack traceback:
/Users/nathan/.hammerspoon/AppL2.lua:5: in function 'openApp'
/Users/nathan/.hammerspoon/AppL2.lua:25: in function 'reminders'
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Update:
Never mind, I have it working now! I accidentally missed out including the following at the top of my script:
local log = hs.logger.new('hammerspoon','debug')
😬Hey Cristian, I'm very interested in the app launcher you've implemented here. The automatic hiding is genius!
I've ran into an issue though and am getting an error. Hoping you might be able to spare a moment to take a look?
This is the contents of AppLauncher.lua, which I am successfully loading into Hammerspoon via
AppLauncher = require('AppLauncher')
in my init.luaBut when I issue the shortcut key, I get the following error