Last active
August 9, 2022 05:12
-
-
Save braddevelop/c12d37d64ce75b83a195666317a10aa2 to your computer and use it in GitHub Desktop.
Hellfred Basics: hellfirepack-applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ... hellfred/extend/basics/hellfirepack-applications.lua | |
--- | |
--- A convenience method to create Subscriber objects | |
--- | |
--- @param trigger any A key or key sequence | |
--- @param app any Name of the app to launch | |
--- @return table Subscriber object | |
local _factory = function(trigger, app) | |
return { | |
trigger = trigger, | |
fireIfModeIs = nil, | |
callback = function() hs.application.launchOrFocus(app) end | |
} | |
end | |
-- The collection of subscribers to return. | |
-- Assign a key to the name of an application to be opened. | |
-- Notice for now that we do not pass an argument for `mode`. This is | |
-- fine and will indicate that these triggers fire under the Default | |
-- mode only. | |
local pack = { | |
_factory({'f'}, 'Finder'), | |
_factory({'t'}, 'Terminal'), | |
_factory({'n'}, 'Notes'), | |
} | |
return pack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment