{ :devices {:adv2    [{:vendor_id 10730 :product_id 258}]
            :pedals  [{:vendor_id 10730 :product_id 256}]}
  :profiles {:Default {:default true
                       :alone   350
                       :delay   500
                       :held    1500
                       :sim     50}}


  :applications {:keykey ["^com\\.chekazuja\\.keykey$"]
                 :kitty ["^net\\.kovidgoyal\\.kitty$"]
                 :wezterm ["^com.github.wez.wezterm$"]
                 :webapp ["^com\\.apple\\.Safari\\.WebApp\\..+$"]
                 :perplexity ["^com\\.apple\\.Safari\\.WebApp\\.F9855FA5-EDE4-4A23-A3BD-BC8ACE1CD430$"]
                 :gemini ["^com\\.apple\\.Safari\\.WebApp\\.1550A740-0D4C-4C62-BA9B-438AA340471C$"]
                 :copilot ["^com\\.apple\\.Safari\\.WebApp\\.8693C89E-9B7E-4E3D-A8E1-C2EB22E28784$"]
                 :webui ["^com\\.apple\\.Safari\\.WebApp\\.2455BCD9-4CA6-415F-80D8-2FA98F05FC97$"]
                 :openai ["^com\\.Unite\\.openai$"]
                 :librechat ["^com\\.Unite\\.LibreChat$"]
                 :claude ["^com\\.Unite\\.Claude$"]
                 :jupyter ["^org\\.jupyter\\.jupyterlab-desktop$"]
                 :dataspell ["^com\\.jetbrains\\.dataspell$"]
                 :vikunja ["^com\\.Unite\\.Vikunja$"]}

  :input-sources {:en {:language "en"}
                  :ru {:language "ru"}}

  :templates {:open "open -a '%s'"}

 :froms {
         :left_pedal {:key :f18}
         :middle_pedal {:key :f19}
         :right_pedal {:key :f20}
         }

  :main [
         
         {:des "pedals default"
           :rules [:pedals  [:left_pedal   :!Tleft_command]
                            [:middle_pedal :!TSleft_option]
                            [:right_pedal  :ru nil {:afterdown :ru 
                                                :afterup :en}]
                            ]}

         {:des "Backslash<->Open_Bracket on Advantage2"
          :rules [:adv2 [:open_bracket :!R5 [:ru :keykey]]
                        [:##open_bracket :!R8 [:ru :keykey]]
                        [:##open_bracket :backslash [:ru :!keykey]]
                        [:##backslash :open_bracket :ru]]}
         {:des "Delete->Control on Advantage2"
          :rules [:adv2 [:##delete_forward :left_control]
                        [:##equal_sign :grave_accent_and_tilde :ru]
                        [:##grave_accent_and_tilde :equal_sign :ru]]}




         {:des "Alternative language switches: Lcmd->English, Rcmd->Russian, Rshift-> Russian"
          :rules [[:left_command :left_command nil {:alone {:input :en}}]
                  [:right_command :right_command nil {:alone {:input :ru}}]
;;                  [:right_shift :right_shift nil {:alone {:input :ru}}]
                  [:!Qt [:!Qt {:input :en}]]
                  [:!Ql [:!Ql {:input :en}]]
                  [:!Ct [:!Ct {:input :en}]]
                  [:!Cl [:!Cl {:input :en}]]
;;                  [:!Ctab [:!Ctab {:input :en}]]
]}

         {:des "Caps->Russian, LShift->English"
          :rules [[:##left_shift :left_shift nil {:alone {:input :en}}]
                  [:##caps_lock ["capskey" 1] :ru {:alone {:input :en}
                                                   :afterup ["capskey" 0]}]
                  [:##caps_lock ["capskey" 1] :en {:alone {:input :ru}
                                                   :afterup ["capskey" 0]}]
                  ]}

         {:des "Tab as Hyper(⌘+⌥+^+⇧)"
          :rules [[:tab [:!!left_shift] [:!left_command] {:alone :tab}]]}

        {:des "Caps+↑, Caps+↓ to Control+Opt+arrow"
         :rules [[:##up_arrow :!TOup_arrow :capskey]
                 [:##down_arrow :!TOdown_arrow :capskey]
                 [:##1 :!!1 :capskey]
                 [:##2 :!!2 :capskey]
                 [:##3 :!!3 :capskey]
                 [:##left_arrow :!!1 :capskey]
                 [:##right_arrow :!!2 :capskey]]}


         {:des "Caps+T to start Kitty, Caps+B->Bing, Caps+G->Bard, Caps+O->Poe, Caps+P->ChatGPT4, Caps+␣->AllGPT"
          :rules [:capskey 
                  [:t [[:open "/Applications/kitty.app"] {:input :en}] :!kitty]
                  [:t [:!Ct {:input :en}] :kitty]
                  [:r [[:open "/Applications/WezTerm.app"] {:input :en}] :!wezterm]
                  [:r [:!Ct {:input :en}] :wezterm]
                  [:a [[:open "/Applications/Arc.app"] {:input :en}]]
                  [:g [:open "/Users/anton/Applications/Gemini.app"] :!gemini]
                  [:g :!Ch :gemini]
                  [:m [:open "/Users/anton/Applications/Copilot.app"] :!copilot]
                  [:m :!Ch :copilot]
                  [:c [:open "/Applications/Claude.app"] :!claude]
                  [:c :!Ch :claude]
                  [:w [:open "/Users/anton/Applications/Setia.wiki.app"]]
                  [:o [:open "/Applications/openai.app"] :!openai]
                  [:o :!Ch :openai]
                  [:p [:open "/Users/anton/Applications/webui.app"] :!webui]
                  [:p :!Ch :webui]
                  [:i [:open "/Users/anton/Applications/Perplexity.app"] :!perplexity]
                  [:i :!Ch :perplexity]
                  [:l [:open "/Applications/LibreChat.app"] :!librechat]
                  [:l :!Ch :librechat]
                  [:j [:open "/Applications/JupyterLab.app"] :!jupyter]
                  [:j :!Ch :jupyter]
                  [:d [:open "/Users/anton/Applications/DataSpell.app"] :!dataspell]
                  [:d :!Ch :dataspell]
                  [:v [:open "/Applications/Vikunja.app"] :!vikunja]
                  [:v :!Ch :vikunja]
                           ]}

         {:des "⌘W->⌘H in Safari ChatGPT app"
          :rules [:webapp [:!Cw :!Ch]]}
         

         {:des "Ropt->Comma"
          :rules [[:##right_option :right_shift :ru {:alone :!R6}]
                  [:##right_option :right_shift :en {:alone :comma}]]}
  
         {:des "Rshift->Comma"
          :rules [[:##right_shift :right_shift :ru {:alone :!R6
                                                    :held :caps_lock}]
                  [:##right_shift :right_shift :en {:alone :comma
                                                    :held :caps_lock}]]}

         {:des "Rcommand -> comma, but not on advantage"
          :rules [[:##right_command :right_command [:ru :!adv2] {:alone :!R6}]]}]

  }


    ;; this is a little bit weird, but it's convenient
    ;; the rule [:!Ca :!T1]
    ;; means from command a to control 1
    ;; :!Ca is keycode :a and prefix a with !C

    ;; here's the definition

    ;; !  | 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
    ;; P  | caps_lock
    ;; !! | mandatory command + control + optional + shift (hyper)
    ;; ## | optional any

