I can get the application name after the user switches focus with the following code:
function applicationWatcher(appName, eventType, appObject)
if (eventType == hs.application.watcher.activated) then
print(appName)
end
end
local appWatcher = hs.application.watcher.new(applicationWatcher)
But I'd like this appName
right after hammerspoon initializes.