This configuration provide a lot of hotkeys for productivity without change established habits.
- $ brew cask install hammerspoon
- $ git clone https://github.com/cxdongjack/hammerspoon.git ~/.hammerspoon
Make the window hints to fixed hotkey
Hotkey generation algorithm as below:
- try to find char in user specific dict, like { ['com.sublimetext.3'] = 'S' }
- parse the bundleID to single char, like com.apple.Terminal -> 'T', bundleID is stable than title
- loop the charhints(i.e ABC..XYZ), find the nil char in 'dict'
This configuration heavily uses Emacs style hotkey binding, i.e., using the prefix to activate hotkeys.
The default prefix is ctrl+,
, e.g., prefix - w
= press and release ctrl+,
first, then press w
.
prefix - ?
: help.prefix - g
: show a 3x3 grid for resizing window.prefix - w
: switcher for windows(while system switcher for application).prefix - c
: toggle caffeinate (disable sleep).prefix - s
: sleep.prefix - n
: toggle night shift.prefix - r
: reload Hammerspoon config.prefix - d
: toggle Hammerspoon console for debug.prefix - m
: enter mouse mode, then you can usehjkl
to move the mouse, usecmd+hjkl
to move slowly, useshift+hjkl
to scroll, useu
,i
,o
to perform left, right, middle button click.
The option key is used for inputing special characters, may mapping option key be a better offer.
option [ + shift ] + tab
: switch windows.option + npfb
: arrow keys.option + ctrl + npfb
: option + arrow keys (move faster).option + a
: home.option + e
: end.option + u
: page_up.option + d
: page_down.option + [/]
: cmd [+ shift] + tab (switch tabs).option + q
: esc.option + m
/option + 1
: play.option + <
/option + 2
: previous track.option + >
/option + 3
: next track.option + /
/option + f1
: mute.option + ,
/option + f2
: volume down.option + .
/option + f3
: volume up.press ctrl twice
: escapepress cmd Q twice
: quit app, in order to prevent accidentally quitting an app when pressingcmd+q
.
https://github.com/Hammerspoon/hammerspoon/wiki/Sample-Configurations https://github.com/raulchen/dotfiles/tree/master/hammerspoon https://github.com/agzam/spacehammer https://github.com/SeanXP/dotfiles/tree/master/hammerspoon