From 58bf029a4aae624c506c4633afcaa7839c771ad9 Mon Sep 17 00:00:00 2001 From: Peng Li Date: Sat, 30 Dec 2017 01:29:38 +0800 Subject: [PATCH] Commit for new branch --- config/karabiner/karabiner.json | 5 ++--- hammerspoon/init.lua | 23 +++++++++++++++++++++++ zsh/zshrc | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/config/karabiner/karabiner.json b/config/karabiner/karabiner.json index 1f2d672..46b2852 100644 --- a/config/karabiner/karabiner.json +++ b/config/karabiner/karabiner.json @@ -30,9 +30,8 @@ "right_command": "right_option" }, "standalone_keys": { - "caps_lock": "escape", - "right_command": "escape", - "left_control": "escape" + "_comment": "caps_lock: escape", + "right_command": "escape" }, "virtual_hid_keyboard": { "caps_lock_delay_milliseconds": 0, diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index f30a5b6..0d0eb83 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -191,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) diff --git a/zsh/zshrc b/zsh/zshrc index 6056f55..df74454 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -309,7 +309,7 @@ if [[ $OSNAME == 'Darwin' ]]; then export ANDROID_TOOLCHAIN="$ANDROID_NDK_HOME/standalone-toolchain-api14/" export ANDROID_HOME="$HOME/android/android-sdk-macosx/" export PATH=$PATH:"${ANDROID_TOOLCHAIN}/bin/":"${ANDROID_HOME}/platform-tools/" - export PATH="$HOME/bin":"/usr/local/bin":$PATH + export PATH="$HOME/bin":"/usr/local/bin":"/usr/local/sbin":$PATH ## appended by cpan initializaion -- 2.11.0