Skip to content

evantravers/Hyper.spoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hyper

Hammerspoon has a module for custom keyboard shortcuts called hs.hotkey.modal. Hyper is a modern space cadet inspired wrapper on hs.hotkey.modal that changes one feature and adds another:

  • changes the "toggle" style of hs.hotkey.modal to a "momentary hold" style
  • adds an optional bindPassThrough that drops out of Lua to send a "Hyper chord" to an OSX application.

I chiefly use it to launch applications quickly from a single press, although I also use it to create "universal" local bindings inspired by Shawn Blanc's OopsieThings.

A simple example:

hs.loadSpoon('Hyper')

App = hs.application Hyper = spoon.Hyper
Hyper:bindHotKeys({hyperKey = {{}, 'F19'}})

Hyper:bind({}, 'j', function()
    App.launchOrFocusByBundleID('net.kovidgoyal.kitty')
end)
Hyper:bind({}, 'return', nil, autolayout.autoLayout)
Hyper:bindPassThrough('.', 'com.culturedcode.ThingsMac')

📦 Installation

Just download the latest release, double click to unzip and double-click the resulting Hyper.spoon. It will be installed automatically by hammerspoon.

⚠ Migration from 1.0

2.0 no longer requires using exact same configuration table that I specified in 1.0, you are free to use whatever scheme you want!

If you have a 1.0 style configuration table, you can use a quick transformation function to keep your setup working with 2.0:

hs.loadSpoon('Hyper')

Config = {
    applications = {
        ['com.culturedcode.ThingsMac'] = {
            bundleID = 'com.culturedcode.ThingsMac',
            hyperKey = 't',
            localBindings = {',', '.'},
        }
    }
}
Hyper = spoon.Hyper Hyper:bindHotKeys({hyperKey = {{}, 'F19'}})

hs.fnutils.each(Config.applications, function(appConfig)
    if appConfig.hyperKey then 
        Hyper:bind({}, appConfig.hyperKey, function()
            hs.application.launchOrFocusByBundleID(appConfig.bundleID)
        end)
    end
    if appConfig.localBindings then
        hs.fnutils.each(appConfig.localBindings, function(key)
            Hyper:bindPassThrough(key, appConfig.bundleID)
        end)
    end
end)

Resources

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages