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 SpaceHammer a Hammerspoon Spoon? #124

Open
jaidetree opened this issue Sep 14, 2021 · 3 comments
Open

Make SpaceHammer a Hammerspoon Spoon? #124

jaidetree opened this issue Sep 14, 2021 · 3 comments

Comments

@jaidetree
Copy link
Collaborator

Currently, Spacehammer is intended to own the ~/.hammerspoon directory. This suits people who first discover Spacehammer but this setup might be alienating to existing Hammerspoon users who don't want to start over again or move their years worth of Hammerspoon config over.

It seems more than possible to put Spacehammer into a spoon. It will need to match the Spoon API so that it exports an object with a SPOON:start() function that would handle what our init.lua does now.

The problem is this would be a breaking change, so we would need to decide carefully how to best roll that out.

Off the top of my head, I am thinking it might be wise to create a separate organization like Spacehammer/spacehammer.git and the version of that repo can exist as a spoon so it doesn't break everyone's config. This version of the repo can remain unchanged, add a link and deprecation notice to the README.org, and direct issues to the new repo.

Additionally, looking at https://www.hammerspoon.org/Spoons/SpoonInstall.html, we could even have our own repository for spoons written in fennel.

The other anticipated change will likely be updating the fennel search paths to include *.spoon/init.fnl which is pretty trivial.

This is not a high priority but is a direction we can go if we're interested.

@jaidetree
Copy link
Collaborator Author

One question that comes to mind though:

Would doing this inhibit our ability to make a brew formula?

Should still work but the setup script would be different.

Other notes:

https://github.com/Hammerspoon/hammerspoon/blob/c31c2aeaa32dd2e3379340af14eec4a116f476d9/extensions/_coresetup/init.lua#L312-L317

Uses package.path to resolve the spoon path. My current value looks like:

/Users/j/.hammerspoon/?.lua;/Users/j/.hammerspoon/?/init.lua;/Users/j/.hammerspoon/Spoons/?.spoon/init.lua;/usr/local/share/lua/5.4/?.lua;/usr/local/share/lua/5.4/?/init.lua;/usr/local/lib/lua/5.4/?.lua;/usr/local/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua;/Applications/Hammerspoon.app/Contents/Resources/extensions/?.lua;/Applications/Hammerspoon.app/Contents/Resources/extensions/?/init.lua;/Users/j/.luarocks/share/lua/5.4/?.lua;/Users/j/.luarocks/share/lua/5.4/?/init.lua;/Users/j/.luarocks/share/lua/5.3/?.lua;/Users/j/.luarocks/share/lua/5.3/?/init.lua"

Might be able to insert something like $HOME/.spacehammer/Spoons/?.spoon/init.fnl but will need to experiment to confirm.

@Grazfather
Copy link
Collaborator

Yes, I think at the very least a v1.0 release would do the trick. Maybe we can finagle it so that even if one were to pull in the 1.0 changes as their .hammerspoon it would still work as expected. Maybe even warn them that they should install it as a spoon.

Do we want a brew formula if we want a spoon? Brew for hammerspoon makes sense, but then it's just a matter of:

hs.loadSpoon("SpoonInstall") -- Maybe they have to install this manually
spoon.SpoonInstall("spacehammer")

@jaidetree
Copy link
Collaborator Author

How would fennel be installed there?

I think the goal for the brew formula is to make it a 1 liner to install hammerspoon, luarocks, and fennel. In addition to supporting autoupdates

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

No branches or pull requests

2 participants