Skip to content

Instantly share code, notes, and snippets.

@dobrovolsky
Last active August 31, 2020 17:43
Show Gist options
  • Save dobrovolsky/5196a88930ca803d8c3b1df35e6d4ee9 to your computer and use it in GitHub Desktop.
Save dobrovolsky/5196a88930ca803d8c3b1df35e6d4ee9 to your computer and use it in GitHub Desktop.
{
:templates {
:launch-app "open -a %s"
:toggle-theme "osascript -e 'tell application \"System Events\"' -e 'tell appearance preferences' -e 'set dark mode to not dark mode' -e 'end tell' -e 'end tell'"
}
:layers {
:modal_mode {:key :caps_lock :alone {:key :escape}}
}
:applications {
:iterm ["^com\\.googlecode\\.iterm2$"]
}
; https://github.com/yqrashawn/GokuRakuJoudo/blob/master/tutorial.md
;; ! | means mandatory
;; # | means optional
;; C | left_command
;; T | left_control
;; O | left_option
;; S | left_shift
;; F | fn
;; Q | right_command
;; W | right_control
;; E | right_option
;; R | right_shift
;; !! | mandatory command + control + optional + shift (hyper)
;; ## | optional any
:tos {
:select_us {
:select_input_source {
:input_source_id "^com\\.apple\\.keylayout\\.US$"
}
}
}
:main [
{:des "modal_mode + key"
:rules [
:modal_mode
[:1 [:select_us]]
[:2 [:launch-app "Spotify"]]
[:3 [:launch-app "Telegram"]]
[:4 [:launch-app "Brave\\ Browser"]]
[:5 [:launch-app "Iterm"]]
[:6 [:launch-app "Pycharm"]]
[:7 [:launch-app "Visual\\ Studio\\ Code"]]
[:a :!Ta]
[:e :!Te]
[:c :!Tc]
[:d :!Td]
[:z :!Tz]
[:q :!Tf2] ; show menu bar
[:semicolon :!Tl]
[:r :!Tr]
[:t :!Tt]
[:grave_accent_and_tilde :!CTOSf12] ; track time with toggl
; arrows
[:#Ch :left_arrow]
[:#Cj :down_arrow]
[:#Ck :up_arrow]
[:#Cl :right_arrow]
; delete button is too far away
[:o :delete_or_backspace]
[:p :delete_forward]
[:return_or_enter :!TOreturn_or_enter] ; maximize window with ractangel
]}
{:des "Iterm to tmux mapping"
:rules [
:iterm
[:!CSd [:!Tb :hyphen]]
[:!Cd [:!Tb :backslash]]
[:!Ct [:!Tb :c]]
[:!Cn [:!Tb :n]]
[:b :!Tb [:modal_mode]]
]}
{:des "Build new habbit by changing default behavior"
:rules [
; window manipulation with ractangel
[:left_arrow :!TOleft_arrow]
[:down_arrow :!TOdown_arrow]
[:up_arrow :!TOup_arrow]
[:right_arrow :!TOright_arrow]
; disable keys
[:delete_or_backspace :vk_none]
[:escape :vk_none]
]}
{ :des "Quit application only when tapping command-q twice"
:rules [
[:!Cq [:!Cq ["command-q" 0]] ["command-q" 1]]
[:!Cq ["command-q" 1] nil {:delayed {:invoked ["command-q" 0] :canceled ["command-q" 0]}}]
]}
]
}
{:des "switch input method"
:rules [{:from {:key_code :left_shift}
:to [{:key_code :left_shift}]
:to_if_alone [{:select_input_source {:input_source_id "^com\\.apple\\.keylayout\\.ABC$"}}]
:type :basic}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment