Skip to content

Instantly share code, notes, and snippets.

@dmohs
dmohs / init.lua
Created May 10, 2022 17:22
Hammerspoon function to set default browser
function setDefaultBrowser(appFileName, notify)
local logger = hs.logger.new('defbr', 5)
local app = hs.application.open('com.apple.systempreferences')
local axapp = hs.axuielement.applicationElement(app)
-- Attempt to open the menu until it successfully opens (returns true)
hs.timer.waitUntil(function()
return app:selectMenuItem({'View', 'General'})
end, function()
print('General group opened.')
@dmohs
dmohs / error
Last active July 26, 2022 18:10
Executable to run extensionless scripts as a Node module
#!nodem
// vim: set syntax=javascript :
foo // undefined, check reported line number