diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index d6ef2a37..cf7b64c2 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -30,13 +30,13 @@ enableHotkeyForWindowsMatchingFilter = function(windowFilter, hotkey) end) end -require('control-escape') -require('delete-words') -require('hyper') -require('markdown') -require('microphone') -require('panes') -require('super') -require('windows') +require('keyboard.control-escape') +require('keyboard.delete-words') +require('keyboard.hyper') +require('keyboard.markdown') +require('keyboard.microphone') +require('keyboard.panes') +require('keyboard.super') +require('keyboard.windows') hs.notify.new({title='Hammerspoon', informativeText='Ready to rock 🤘'}):send() diff --git a/hammerspoon/markdown.lua b/hammerspoon/markdown.lua index 5b32a2bf..124ff27b 100644 --- a/hammerspoon/markdown.lua +++ b/hammerspoon/markdown.lua @@ -66,7 +66,7 @@ end markdownMode = hs.hotkey.modal.new({}, 'F20') -local message = require('status-message') +local message = require('keyboard.status-message') markdownMode.statusMessage = message.new('Markdown Mode (control-m)') markdownMode.entered = function() markdownMode.statusMessage:show() diff --git a/hammerspoon/microphone.lua b/hammerspoon/microphone.lua index 654be1cc..f04c282a 100644 --- a/hammerspoon/microphone.lua +++ b/hammerspoon/microphone.lua @@ -1,4 +1,4 @@ -local message = require('status-message') +local message = require('keyboard.status-message') local messageMuting = message.new('muted 🎤') local messageHot = message.new('hot 🎤') diff --git a/hammerspoon/super.lua b/hammerspoon/super.lua index b17df4b2..1f41cd4e 100644 --- a/hammerspoon/super.lua +++ b/hammerspoon/super.lua @@ -1,6 +1,6 @@ local eventtap = hs.eventtap local eventTypes = hs.eventtap.event.types -local message = require('status-message') +local message = require('keyboard.status-message') -- If 's' and 'd' are *both* pressed within this time period, consider this to -- mean that they've been pressed simultaneously, and therefore we should enter diff --git a/hammerspoon/windows.lua b/hammerspoon/windows.lua index 880c5319..c22cbaf2 100644 --- a/hammerspoon/windows.lua +++ b/hammerspoon/windows.lua @@ -189,7 +189,7 @@ end windowLayoutMode = hs.hotkey.modal.new({}, 'F16') -local message = require('status-message') +local message = require('keyboard.status-message') windowLayoutMode.statusMessage = message.new('Window Layout Mode (control-s)') windowLayoutMode.entered = function() windowLayoutMode.statusMessage:show() diff --git a/script/setup b/script/setup index 3e224010..276d6402 100755 --- a/script/setup +++ b/script/setup @@ -11,7 +11,11 @@ brew bundle check || brew bundle ln -sfn $PWD/karabiner ~/.config/ # Prepare custom settings for Hammerspoon -ln -sfn $PWD/hammerspoon ~/.hammerspoon +mkdir -p ~/.hammerspoon +if ! grep -sq "require('keyboard')" ~/.hammerspoon/init.lua; then + echo "require('keyboard') -- Load Hammerspoon bits from https://github.com/jasonrudolph/keyboard" >> ~/.hammerspoon/init.lua +fi +ln -sfn $PWD/hammerspoon ~/.hammerspoon/keyboard # Prepare custom settings for navigating between words in iTerm2 grep -sq forward-word ~/.inputrc || cat $PWD/inputrc >> ~/.inputrc @@ -19,6 +23,10 @@ grep -sq forward-word ~/.inputrc || cat $PWD/inputrc >> ~/.inputrc # Disable Dock icon for Hammerspoon defaults write org.hammerspoon.Hammerspoon MJShowDockIconKey -bool FALSE +# If Hammerspoon is already running, kill it so we can pick up the new config +# when opening Hammerspoon below +killall Hammerspoon || true + # Open Apps open /Applications/Hammerspoon.app open /Applications/Karabiner-Elements.app