1
0
Fork 0

hammerspoon: Set up Alacritty binding

This commit is contained in:
Jeremy Kaplan 2021-05-03 15:07:32 -07:00
commit 1a81af3dd5
4 changed files with 148 additions and 0 deletions

View file

@ -11,3 +11,4 @@
./neovim/os-plugins.vim: neovim/darwin-plugins.vim ./neovim/os-plugins.vim: neovim/darwin-plugins.vim
./zsh/os.zshrc: zsh/darwin.zshrc ./zsh/os.zshrc: zsh/darwin.zshrc
~/.config/karabiner: karabiner/ ~/.config/karabiner: karabiner/
~/.hammerspoon: hammerspoon/

View file

@ -0,0 +1,90 @@
[
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [
{
"def": "ReloadConfiguration:bindHotkeys(mapping)",
"desc": "Binds hotkeys for ReloadConfiguration",
"doc": "Binds hotkeys for ReloadConfiguration\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * reloadConfiguration - This will cause the configuration to be reloaded",
"name": "bindHotkeys",
"parameters": [
" * mapping - A table containing hotkey modifier/key details for the following items:",
" * reloadConfiguration - This will cause the configuration to be reloaded"
],
"signature": "ReloadConfiguration:bindHotkeys(mapping)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "ReloadConfiguration:start()",
"desc": "Start ReloadConfiguration",
"doc": "Start ReloadConfiguration\n\nParameters:\n * None",
"name": "start",
"parameters": [
" * None"
],
"signature": "ReloadConfiguration:start()",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [
{
"def": "ReloadConfiguration.watch_paths",
"desc": "List of directories to watch for changes, defaults to hs.configdir",
"doc": "List of directories to watch for changes, defaults to hs.configdir",
"name": "watch_paths",
"signature": "ReloadConfiguration.watch_paths",
"stripped_doc": "",
"type": "Variable"
}
],
"desc": "Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.",
"doc": "Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)",
"items": [
{
"def": "ReloadConfiguration:bindHotkeys(mapping)",
"desc": "Binds hotkeys for ReloadConfiguration",
"doc": "Binds hotkeys for ReloadConfiguration\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * reloadConfiguration - This will cause the configuration to be reloaded",
"name": "bindHotkeys",
"parameters": [
" * mapping - A table containing hotkey modifier/key details for the following items:",
" * reloadConfiguration - This will cause the configuration to be reloaded"
],
"signature": "ReloadConfiguration:bindHotkeys(mapping)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "ReloadConfiguration:start()",
"desc": "Start ReloadConfiguration",
"doc": "Start ReloadConfiguration\n\nParameters:\n * None",
"name": "start",
"parameters": [
" * None"
],
"signature": "ReloadConfiguration:start()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "ReloadConfiguration.watch_paths",
"desc": "List of directories to watch for changes, defaults to hs.configdir",
"doc": "List of directories to watch for changes, defaults to hs.configdir",
"name": "watch_paths",
"signature": "ReloadConfiguration.watch_paths",
"stripped_doc": "",
"type": "Variable"
}
],
"name": "ReloadConfiguration",
"stripped_doc": "\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)",
"submodules": [],
"type": "Module"
}
]

View file

@ -0,0 +1,49 @@
--- === ReloadConfiguration ===
---
--- Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.
---
--- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)
local obj = {}
obj.__index = obj
-- Metadata
obj.name = "ReloadConfiguration"
obj.version = "1.0"
obj.author = "Jon Lorusso <jonlorusso@gmail.com>"
obj.homepage = "https://github.com/Hammerspoon/Spoons"
obj.license = "MIT - https://opensource.org/licenses/MIT"
--- ReloadConfiguration.watch_paths
--- Variable
--- List of directories to watch for changes, defaults to hs.configdir
obj.watch_paths = { hs.configdir }
--- ReloadConfiguration:bindHotkeys(mapping)
--- Method
--- Binds hotkeys for ReloadConfiguration
---
--- Parameters:
--- * mapping - A table containing hotkey modifier/key details for the following items:
--- * reloadConfiguration - This will cause the configuration to be reloaded
function obj:bindHotkeys(mapping)
local def = { reloadConfiguration = hs.fnutils.partial(hs.reload, self) }
hs.spoons.bindHotkeysToSpec(def, mapping)
end
--- ReloadConfiguration:start()
--- Method
--- Start ReloadConfiguration
---
--- Parameters:
--- * None
function obj:start()
self.watchers = {}
for _,dir in pairs(self.watch_paths) do
self.watchers[dir] = hs.pathwatcher.new(dir, hs.reload):start()
end
return self
end
return obj

8
hammerspoon/init.lua Normal file
View file

@ -0,0 +1,8 @@
hs.loadSpoon("ReloadConfiguration")
spoon.ReloadConfiguration:start()
local mod = {"alt", "shift"}
hs.hotkey.bind(mod, "Return", function()
-- -n: Always open a new instance. I want it to open in my home directory.
hs.execute("open -n /Applications/Alacritty.app")
end)