X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=hammerspoon%2Finit.lua;h=0d0eb8303d584d852aed308703833aae9294b92b;hb=3f12b4886baec121b2cf2da2a0aabf152542bed4;hp=3263c590bd38680b274fca99340a5819065d9c69;hpb=937131850a4324bbf8bbf2cf108375ce124f3bd1;p=dotfiles.git diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index 3263c59..0d0eb83 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -10,6 +10,21 @@ hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function() end) hs.alert.show("Config loaded") +---- Right click +--hs.hotkey.bind({"cmd,", "alt", "ctrl"}, "l", function() +-- hs.eventtap.rightClick(hs.mouse.getAbsolutePosition()) +--end) + +-- Donw : For firefox vimperator +hs.hotkey.bind({"cmd,", "ctrl"}, "n", function() + hs.eventtap.keyStroke({}, 'down') +end) + +-- Up +hs.hotkey.bind({"cmd,", "ctrl"}, "p", function() + hs.eventtap.keyStroke({}, 'up') +end) + -- Reacting to application events -- Move all Finder in front function applicationWatcher(appName, eventType, appObject) @@ -176,3 +191,26 @@ INSTALL:andUse("Seal", start = true, } ) +-------------------------------------------------------------------------------- +-- Focus the last used window. +local function focusLastFocused() + local wf = hs.window.filter + local lastFocused = wf.defaultCurrentSpace:getWindows(wf.sortByFocusedLast) + if #lastFocused > 0 then lastFocused[1]:focus() end +end + +-- Create the chooser. +-- On selection, copy the emoji and type it into the focused application. +local chooser = hs.chooser.new(function(choice) + if not choice then focusLastFocused(); return end + hs.pasteboard.setContents(choice["chars"]) + focusLastFocused() + hs.eventtap.keyStrokes(hs.pasteboard.getContents()) +end) + +chooser:searchSubText(true) +chooser:choices(choices) + +chooser:rows(5) +chooser:bgDark(true) +hs.hotkey.bind({"cmd", "alt"}, "E", function() chooser:show() end)