Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to use jasonrudolph/keyboard in combination with other Hammerspoon customizations #25

Merged
merged 4 commits into from
Jun 3, 2017

Conversation

jasonrudolph
Copy link
Owner

Prior to this change, jasonrudolph/keyboard essentially assumed that you had no use for Hammerspoon outside of the features provided by jasonrudolph/keyboard. 🙈 But Hammerspoon is awesome, and you ought to be able to use it however you like in addition to the Hammerspoon-powered features in jasonrudolph/keyboard.

Specifically, prior to this change, running ./script/setup would use the init.lua file in this repository as the init.lua file for your Mac (i.e., ~/.hammerspoon/init.lua). If you wanted to use additional Hammerspoon functionality, you had to edit ~/.hammerspoon/init.lua, which made it unnecessarily difficult to pull in the latest changes from this repository without overwriting your local customizations.

With the change in this PR, running ./script/setup will instead symlink this repository's Hammerspoon bits to ~/.hammerspoon/keyboard/, and it will idempotently update your ~/.hammerspoon/init.lua to load this repository's Hammerspoon bits. As a result, you're free to update your local ~/.hammerspoon/init.lua with additional Hammerspoon customizations [example], and you'll be able to pull in the latest changes from this repository without any fear of it overwriting your local customizations.

@adamyonk
Copy link
Contributor

adamyonk commented Jun 3, 2017

👏

@jasonrudolph jasonrudolph merged commit 7bc82ff into master Jun 3, 2017
@jasonrudolph jasonrudolph deleted the improve-hammerspoon-setup branch June 3, 2017 14:18
@jasonrudolph
Copy link
Owner Author

⚠️ Manual upgrade required for existing users ⚠️

Now that these changes are merged, if you want to upgrade an existing installation of jasonrudolph/keyboard, you'll need to follow the one-time manual upgrade process described in the v3.0.0 release notes.

If you don't manually upgrade ...

If you only run git pull and reload your Hammerspoon config, you'll probably see errors like this:

2017-06-03 09:33:59: *** ERROR: ...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: module 'keyboard.control-escape' not found:
	no field package.preload['keyboard.control-escape']
	no file '/Users/j/.hammerspoon/keyboard/control-escape.lua'
	no file '/Users/j/.hammerspoon/keyboard/control-escape/init.lua'
	no file '/Users/j/.hammerspoon/Spoons/keyboard/control-escape.spoon/init.lua'
	no file '/usr/local/share/lua/5.3/keyboard/control-escape.lua'
	no file '/usr/local/share/lua/5.3/keyboard/control-escape/init.lua'
	no file '/usr/local/lib/lua/5.3/keyboard/control-escape.lua'
	no file '/usr/local/lib/lua/5.3/keyboard/control-escape/init.lua'
	no file './keyboard/control-escape.lua'
	no file './keyboard/control-escape/init.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/keyboard/control-escape.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/keyboard/control-escape/init.lua'
	no file '/Users/j/.hammerspoon/keyboard/control-escape.so'
	no file '/usr/local/lib/lua/5.3/keyboard/control-escape.so'
	no file '/usr/local/lib/lua/5.3/loadall.so'
	no file './keyboard/control-escape.so'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/keyboard/control-escape.so'
	no file '/Users/j/.hammerspoon/keyboard.so'
	no file '/usr/local/lib/lua/5.3/keyboard.so'
	no file '/usr/local/lib/lua/5.3/loadall.so'
	no file './keyboard.so'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/keyboard.so'
stack traceback:
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: in function 'require'
	/Users/j/.hammerspoon/init.lua:33: in main chunk
	[C]: in function 'xpcall'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:561: in function 'hs._coresetup.setup'
	(...tail calls...)

If you only run git pull and script/setup, you'll probably see errors like this:

2017-06-03 09:35:01: *** ERROR: error loading module 'keyboard' from file '/Users/j/.hammerspoon/keyboard/init.lua':
	/Users/j/.hammerspoon/keyboard/init.lua:25: too many C levels (limit is 200) in function at line 24 near 'hotkey'
stack traceback:
	[C]: in ?
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: in function 'require'
	/Users/j/.hammerspoon/keyboard/init.lua:43: in main chunk
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: in function 'require'
	/Users/j/.hammerspoon/keyboard/init.lua:43: in main chunk
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: in function 'require'
	/Users/j/.hammerspoon/keyboard/init.lua:43: in main chunk
	...
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: in function 'require'
	/Users/j/.hammerspoon/keyboard/init.lua:43: in main chunk
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: in function 'require'
	/Users/j/.hammerspoon/keyboard/init.lua:43: in main chunk
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:529: in function 'require'
	/Users/j/.hammerspoon/init.lua:43: in main chunk
	[C]: in function 'xpcall'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:561: in function 'hs._coresetup.setup'
	(...tail calls...)

To avoid those errors, be sure to follow the upgrade process described in the v3.0.0 release notes. 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants