[pivotal][hammerspoon][chunkwm]

pull/28/head
Alpha Chen 6 years ago
parent 4a0c239267
commit 699f4bb411

@ -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"
}
]

@ -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

@ -1,76 +1,30 @@
local mash = {"cmd", "alt", "ctrl"} local mash = {"cmd", "alt", "ctrl"}
local smash = {"cmd", "alt", "ctrl", "shift"} local smash = {"cmd", "alt", "ctrl", "shift"}
function current_app()
return hs.application.frontmostApplication()
end
-- Application shortcuts
-- local safari_esc = hs.hotkey.new({}, "escape", function() end, function()
-- if current_app():name() == "Safari" then
-- hs.eventtap.keyStroke({"alt"}, "escape")
-- end
-- end)
-- local safari_close_tab = hs.hotkey.new({"cmd"}, "w", function() end, function()
-- if current_app():name() == "Safari" then
-- current_app():selectMenuItem({"File", "Close Tab"})
-- end
-- end)
-- local wf = hs.window.filter
-- wf.new("Safari"):subscribe(wf.windowFocused, function()
-- -- safari_esc:enable()
-- safari_close_tab:enable()
-- end):subscribe(wf.windowUnfocused, function()
-- -- safari_esc:disable()
-- safari_close_tab:disable()
-- end)
-- hs.hotkey.bind({"cmd", "shift"}, "[", function()
-- current_app():selectMenuItem({"Window", "Select Previous Tab"})
-- end)
-- hs.hotkey.bind({"cmd", "shift"}, "]", function()
-- current_app():selectMenuItem({"Window", "Select Next Tab"})
-- end)
-- Window management -- Window management
local throw_left = function() function chunkc (args)
local win = hs.window.focusedWindow() hs.task.new("/usr/local/bin/chunkc", nil, args)
local f = win:frame() :start()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end
local throw_right = function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x + (max.w / 2)
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end end
hs.hotkey.bind(mash, "h", throw_left) hs.hotkey.bind(mash, "left", function()
hs.hotkey.bind(mash, "left", throw_left) chunkc({"tiling::window", "--warp", "west"})
hs.hotkey.bind(mash, "l", throw_right) end)
hs.hotkey.bind(mash, "right", throw_right) hs.hotkey.bind(mash, "right", function()
chunkc({"tiling::window", "--warp", "east"})
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", function() end)
hs.reload() hs.hotkey.bind(mash, "up", function()
end):start() chunkc({"tiling::window", "--warp", "north"})
end)
hs.hotkey.bind(mash, "down", function()
chunkc({"tiling::window", "--warp", "south"})
end)
hs.hotkey.bind(mash, "z", function()
chunkc({"tiling::window", "--toggle", "fullscreen"})
end)
hs.loadSpoon("ReloadConfiguration")
spoon.ReloadConfiguration:start()
hs.alert.show("Config loaded") hs.alert.show("Config loaded")

@ -1,5 +1,4 @@
" https://github.com/vim-ruby/vim-ruby/issues/243 " https://github.com/vim-ruby/vim-ruby/issues/243
set regexpengine=1 set regexpengine=1
highlight rubyDefine ctermbg=235
set foldmethod=syntax set foldmethod=syntax

@ -72,7 +72,7 @@
- fantastical - fantastical
- firefox-developer-edition - firefox-developer-edition
- google-chrome - google-chrome
- hammerspoon # - hammerspoon
- night-owl - night-owl
- qlmarkdown - qlmarkdown
- qlstephen - qlstephen

@ -0,0 +1,10 @@
# Extra configuration for work
- hosts: all
tasks:
- name: update
homebrew: update_homebrew=yes
- name: install hammerspoon
homebrew_cask:
name: hammerspoon
Loading…
Cancel
Save