X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=hammerspoon%2Finit.lua;h=c163548739e9772dd59726dfb66f3bb0016b0ec3;hb=2b15905600b261fc878b5852f71d6f04f926e347;hp=2386e5820e3dd3ad6fb34a350a35791a1347bc90;hpb=0996b97bedd0c3260837a4e388c7e6fae9601939;p=dotfiles.git diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index 2386e58..c163548 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -47,53 +47,6 @@ hs.hotkey.bind({"cmd", "alt", "ctrl"}, "H", function() win:setFrame(f) end) ------- multi-window layout ---local laptopScreen = "Color LCD" ---local windowLayout = { --- {"Safari", nil, laptopScreen, hs.layout.left50, nil, nil}, --- {"Mail", nil, laptopScreen, hs.layout.right50, nil, nil}, --- {"iTunes", "iTunes", laptopScreen, hs.layout.maximized, nil, nil}, --- {"iTunes", "MiniPlayer", laptopScreen, nil, nil, hs.geometry.rect(0, -48, 400, 48)}, ---} ---hs.layout.apply(windowLayout) - ----- Creating a simple menubar item ---caffeine = hs.menubar.new() ---function setCaffeineDisplay(state) --- if state then --- caffeine:setTitle("AWAKE") --- else --- caffeine:setTitle("SLEEPY") --- end ---end --- ---function caffeineClicked() --- setCaffeineDisplay(hs.caffeinate.toggle("displayIdle")) ---end --- ---if caffeine then --- caffeine:setClickCallback(caffeineClicked) --- setCaffeineDisplay(hs.caffeinate.get("displayIdle")) ---end - --- Reacting to application events --- wheny active the Finder applications, all of its windows --- will be brought to the front of the display. -function applicationWatcher(appName, eventType, appObject) - if (eventType == hs.application.watcher.activated) then - if (appName == "Finder") then - -- Bring all Finder windows forward when one gets activated - appObject:selectMenuItem({"Window", "Bring All to Front"}) - end - end -end -appWatcher = hs.application.watcher.new(applicationWatcher) -appWatcher:start() - - - - --- -- Window Movement -- https://andrich.blog/2016/11/20/hammerspoon-an-awesome-tool-to-automate-your-mac/ -- CTRL + ALT + Left - Move current window to the left half of the screen. @@ -156,3 +109,91 @@ hs.hotkey.bind(hyper, "k", move_window("up")) hs.hotkey.bind(hyper, "j", move_window("down")) hs.hotkey.bind(hyper, "m", move_window("max")) hs.hotkey.bind(hyper, "c", move_window("center")) + +-- Search and dictionary +-- Past and copy +-- App quick startup + +-- Use SpoonInstall, +-- http://zzamboni.org/post/using-spoons-in-hammerspoon/ +-- https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpoonInstall.spoon.zip +if hs.spoons == nil then + hs.spoons=require('hs.spoons') +end + + +hs.loadSpoon ("SpoonInstall") +spoon.SpoonInstall.use_syncinstall = true +INSTALL = spoon.SpoonInstall + +-------------------------------------------------------------------------------- +-- MouseCircle http://www.hammerspoon.org/Spoons/MouseCircle.html +INSTALL:andUse("MouseCircle", + { + disable = false, + config = { + color = hs.drawing.color.x11.rebeccapurple + }, + hotkeys = { + show = { {"cmd", "alt", "ctrl"}, "m"} + } + } +) + +-------------------------------------------------------------------------------- +-- TextClipboardHistory +INSTALL:andUse("TextClipboardHistory", + { + config = { + show_in_menubar = false, + }, + hotkeys = { + toggle_clipboard = { { "cmd", "shift" }, "v"} + }, + start = true; + } +) + + +-------------------------------------------------------------------------------- +-- Seal -- http://www.hammerspoon.org/Spoons/Seal.html +INSTALL:andUse("Seal", + { + hotkeys = { show = { {"cmd", "ctrl", "alt"}, "space" } }, + fn = function(s) + s:loadPlugins({"apps", "calc", "safari_bookmarks", "screencapture", "useractions"}) + s.plugins.safari_bookmarks.always_open_with_safari = false + s.plugins.useractions.actions = + { + ["Hammerspoon docs webpage"] = { + url = "http://hammerspoon.org/docs/", + icon = hs.image.imageFromName(hs.image.systemImageNames.ApplicationIcon), + hotkey = { hyper, "h" } + }, + ["Leave corpnet"] = { + fn = function() + spoon.WiFiTransitions:processTransition('foo', 'corpnet01') + end, + icon = swisscom_logo, + }, + ["Arrive in corpnet"] = { + fn = function() + spoon.WiFiTransitions:processTransition('corpnet01', 'foo') + end, + icon = swisscom_logo, + }, + ["Translate using Leo"] = { + url = "http://dict.leo.org/ende/index_de.html#/search=${query}", + icon = 'favicon', + keyword = "leo", + }, + ["Tell me something"] = { + keyword = "tellme", + fn = function(str) hs.alert.show(str) end, + } + } + s:refreshAllCommands() + end, + start = true, + } +)