yqrashawn / GokuRakuJoudo

config karabiner with ease
GNU General Public License v3.0
1.14k stars 121 forks source link

How to make caps_lock as hyper and work with other keys and modifier keys? #162

Closed suliveevil closed 2 years ago

suliveevil commented 2 years ago

I read some code of others, some are very beautifully organized, I still find it difficult to convert my current config to edn.

My brain is in a mess, would you please help me out? Thank you very much.

I want caps_lock+hjkl=⬅️⬇️⬆️➡️ while keep caps_lock as hyper modifier work with other modifier keys.

This is where I'm so far:

{
;; :modi {
;;        :hyper [:C :T :O :S]
;;        :hyper-rcommand [:C :T :O :S :]
;;        :hyper-rcontrol [:C :T :O :S :]
;;        :hyper-roption  [:C :T :O :S :]
;;        :hyper-rshift   [:C :T :O :S :]
;;        }
 :main[
       {:des   "CapsLock to Hyper/Escape"
        :rules [[:##caps_lock :!CTOS nil {:alone :escape}]]}
       {:des "Hyper Arrow"
        :rules [[:!!h :left_arrow][:!!j :down_arrow][!!k :up_arrow][:!!l :right_arrow]]}]
}
}

This is my json(part of)

        {
   44             "description": "Hyper Navigation: 0 4($) HJKL UIOP",
   45             "manipulators": [
   46                 {
   47                     "type": "basic",
   48                     "from": {
   49                         "key_code": "0",
   50                         "modifiers": {
   51                             "mandatory": [
   52                                 "left_command",
   53                                 "right_command",
   54                                 "right_control",
   55                                 "right_shift",
   56                                 "right_option"
   57                             ]
   58                         }
   59                     },
   60                     "to": [
   61                         {
   62                             "key_code": "left_arrow",
   63                             "modifiers": [
   64                                 "left_command"
   65                             ]
   66                         }
   67                     ]
   68                 },
   69                 {
   70                     "type": "basic",
   71                     "from": {
   72                         "key_code": "4",
   73                         "modifiers": {
   74                             "mandatory": [
   75                                 "left_command",
   76                                 "right_command",
   77                                 "right_control",
   78                                 "right_shift",
   79                                 "right_option"
   80                             ]
   81                         }
   82                     },
   83                     "to": [
   84                         {
   85                             "key_code": "right_arrow",
   86                             "modifiers": [
   87                                 "left_command"
   88                             ]
   89                         }
   90                     ]
   91                 },
   92                 {
   93                     "type": "basic",
   94                     "from": {
   95                         "key_code": "h",
   96                         "modifiers": {
   97                             "mandatory": [
   98                                 "right_command",
   99                                 "right_control",
  100                                 "right_shift",
  101                                 "right_option"
  102                             ]
  103                         }
  104                     },
  105                     "to": [
  106                         {
  107                             "key_code": "left_arrow"
  108                         }
  109                     ]
  110                 },
  111                 {
  112                     "type": "basic",
  113                     "from": {
  114                         "key_code": "h",
  115                         "modifiers": {
  116                             "mandatory": [
  117                                 "left_command",
  118                                 "right_command",
  119                                 "right_control",
  120                                 "right_shift",
  121                                 "right_option"
  122                             ]
  123                         }
  124                     },
  125                     "to": [
  126                         {
  127                             "key_code": "left_arrow",
  128                             "modifiers": [
  129                                 "left_shift"
  130                             ]
  131                         }
  132                     ]
  133                 },
  134                 {
  135                     "type": "basic",
  136                     "from": {
  137                         "key_code": "h",
  138                         "modifiers": {
  139                             "mandatory": [
  140                                 "left_option",
  141                                 "right_command",
  142                                 "right_control",
  143                                 "right_shift",
  144                                 "right_option"
  145                             ]
  146                         }
  147                     },
  148                     "to": [
  149                         {
  150                             "key_code": "left_arrow",
  151                             "modifiers": [
  152                                 "left_option"
  153                             ]
  154                         }
  155                     ]
  156                 },
  157                 {
  158                     "type": "basic",
  159                     "from": {
  160                         "key_code": "h",
  161                         "modifiers": {
  162                             "mandatory": [
  163                                 "left_control",
  164                                 "right_command",
  165                                 "right_control",
  166                                 "right_shift",
  167                                 "right_option"
  168                             ]
  169                         }
  170                     },
  171                     "to": [
  172                         {
  173                             "key_code": "left_arrow",
  174                             "modifiers": [
  175                                 "left_control"
  176                             ]
  177                         }
  178                     ]
  179                 },
  180                 {
  181                     "type": "basic",
  182                     "from": {
  183                         "key_code": "h",
  184                         "modifiers": {
  185                             "mandatory": [
  186                                 "left_shift",
  187                                 "right_command",
  188                                 "right_control",
  189                                 "right_shift",
  190                                 "right_option"
  191                             ]
  192                         }
  193                     },
  194                     "to": [
  195                         {
  196                             "key_code": "tab",
  197                             "modifiers": [
  198                                 "left_control",
  199                                 "left_shift"
  200                             ]
  201                         }
  202                     ]
  203                 },
  204                 {
  205                     "type": "basic",
  206                     "from": {
  207                         "key_code": "j",
  208                         "modifiers": {
  209                             "mandatory": [
  210                                 "right_command",
  211                                 "right_control",
  212                                 "right_shift",
  213                                 "right_option"
  214                             ]
  215                         }
  216                     },
  217                     "to": [
  218                         {
  219                             "key_code": "down_arrow"
  220                         }
  221                     ]
  222                 },
  223                 {
  224                     "type": "basic",
  225                     "from": {
  226                         "key_code": "j",
  227                         "modifiers": {
  228                             "mandatory": [
  229                                 "left_command",
  230                                 "right_command",
  231                                 "right_control",
  232                                 "right_shift",
  233                                 "right_option"
  234                             ]
  235                         }
  236                     },
  237                     "to": [
  238                         {
  239                             "key_code": "down_arrow",
  240                             "modifiers": [
  241                                 "left_shift"
  242                             ]
  243                         }
  244                     ]
  245                 },
  246                 {
  247                     "type": "basic",
  248                     "from": {
  249                         "key_code": "j",
  250                         "modifiers": {
  251                             "mandatory": [
  252                                 "left_option",
  253                                 "right_command",
  254                                 "right_control",
  255                                 "right_shift",
  256                                 "right_option"
  257                             ]
  258                         }
  259                     },
  260                     "to": [
  261                         {
  262                             "key_code": "down_arrow",
  263                             "modifiers": [
  264                                 "left_option"
  265                             ]
  266                         }
  267                     ]
  268                 },
  269                 {
  270                     "type": "basic",
  271                     "from": {
  272                         "key_code": "j",
  273                         "modifiers": {
  274                             "mandatory": [
  275                                 "left_control",
  276                                 "right_command",
  277                                 "right_control",
  278                                 "right_shift",
  279                                 "right_option"
  280                             ]
  281                         }
  282                     },
  283                     "to": [
  284                         {
  285                             "key_code": "down_arrow",
  286                             "modifiers": [
  287                                 "left_control"
  288                             ]
  289                         }
  290                     ]
  291                 },
  292                 {
  293                     "type": "basic",
  294                     "from": {
  295                         "key_code": "j",
  296                         "modifiers": {
  297                             "mandatory": [
  298                                 "left_shift",
  299                                 "right_command",
  300                                 "right_control",
  301                                 "right_shift",
  302                                 "right_option"
  303                             ]
  304                         }
  305                     },
  306                     "to": [
  307                         {
  308                             "key_code": "tab",
  309                             "modifiers": [
  310                                 "left_command"
  311                             ]
  312                         }
  313                     ]
  314                 },
  315                 {
  316                     "type": "basic",
  317                     "from": {
  318                         "key_code": "k",
  319                         "modifiers": {
  320                             "mandatory": [
  321                                 "right_command",
  322                                 "right_control",
  323                                 "right_shift",
  324                                 "right_option"
  325                             ]
  326                         }
  327                     },
  328                     "to": [
  329                         {
  330                             "key_code": "up_arrow"
  331                         }
  332                     ]
  333                 },
  334                 {
  335                     "type": "basic",
  336                     "from": {
  337                         "key_code": "k",
  338                         "modifiers": {
  339                             "mandatory": [
  340                                 "left_command",
  341                                 "right_command",
  342                                 "right_control",
  343                                 "right_shift",
  344                                 "right_option"
  345                             ]
  346                         }
  347                     },
  348                     "to": [
  349                         {
  350                             "key_code": "up_arrow",
  351                             "modifiers": [
  352                                 "left_shift"
  353                             ]
  354                         }
  355                     ]
  356                 },
  357                 {
  358                     "type": "basic",
  359                     "from": {
  360                         "key_code": "k",
  361                         "modifiers": {
  362                             "mandatory": [
  363                                 "left_option",
  364                                 "right_command",
  365                                 "right_control",
  366                                 "right_shift",
  367                                 "right_option"
  368                             ]
  369                         }
  370                     },
  371                     "to": [
  372                         {
  373                             "key_code": "up_arrow",
  374                             "modifiers": [
  375                                 "left_option"
  376                             ]
  377                         }
  378                     ]
  379                 },
  380                 {
  381                     "type": "basic",
  382                     "from": {
  383                         "key_code": "k",
  384                         "modifiers": {
  385                             "mandatory": [
  386                                 "left_control",
  387                                 "right_command",
  388                                 "right_control",
  389                                 "right_shift",
  390                                 "right_option"
  391                             ]
  392                         }
  393                     },
  394                     "to": [
  395                         {
  396                             "key_code": "up_arrow",
  397                             "modifiers": [
  398                                 "left_control"
  399                             ]
  400                         }
  401                     ]
  402                 },
  403                 {
  404                     "type": "basic",
  405                     "from": {
  406                         "key_code": "k",
  407                         "modifiers": {
  408                             "mandatory": [
  409                                 "left_shift",
  410                                 "right_command",
  411                                 "right_control",
  412                                 "right_shift",
  413                                 "right_option"
  414                             ]
  415                         }
  416                     },
  417                     "to": [
  418                         {
  419                             "key_code": "tab",
  420                             "modifiers": [
  421                                 "left_command",
  422                                 "left_shift"
  423                             ]
  424                         }
  425                     ]
  426                 },
  427                 {
  428                     "type": "basic",
  429                     "from": {
  430                         "key_code": "l",
  431                         "modifiers": {
  432                             "mandatory": [
  433                                 "right_command",
  434                                 "right_control",
  435                                 "right_shift",
  436                                 "right_option"
  437                             ]
  438                         }
  439                     },
  440                     "to": [
  441                         {
  442                             "key_code": "right_arrow"
  443                         }
  444                     ]
  445                 },
  446                 {
  447                     "type": "basic",
  448                     "from": {
  449                         "key_code": "l",
  450                         "modifiers": {
  451                             "mandatory": [
  452                                 "left_command",
  453                                 "right_command",
  454                                 "right_control",
  455                                 "right_shift",
  456                                 "right_option"
  457                             ]
  458                         }
  459                     },
  460                     "to": [
  461                         {
  462                             "key_code": "right_arrow",
  463                             "modifiers": [
  464                                 "left_shift"
  465                             ]
  466                         }
  467                     ]
  468                 },
  469                 {
  470                     "type": "basic",
  471                     "from": {
  472                         "key_code": "l",
  473                         "modifiers": {
  474                             "mandatory": [
  475                                 "left_option",
  476                                 "right_command",
  477                                 "right_control",
  478                                 "right_shift",
  479                                 "right_option"
  480                             ]
  481                         }
  482                     },
  483                     "to": [
  484                         {
  485                             "key_code": "right_arrow",
  486                             "modifiers": [
  487                                 "left_option"
  488                             ]
  489                         }
  490                     ]
  491                 },
  492                 {
  493                     "type": "basic",
  494                     "from": {
  495                         "key_code": "l",
  496                         "modifiers": {
  497                             "mandatory": [
  498                                 "left_control",
  499                                 "right_command",
  500                                 "right_control",
  501                                 "right_shift",
  502                                 "right_option"
  503                             ]
  504                         }
  505                     },
  506                     "to": [
  507                         {
  508                             "key_code": "right_arrow",
  509                             "modifiers": [
  510                                 "left_control"
  511                             ]
  512                         }
  513                     ]
  514                 },
  515                 {
  516                     "type": "basic",
  517                     "from": {
  518                         "key_code": "l",
  519                         "modifiers": {
  520                             "mandatory": [
  521                                 "left_shift",
  522                                 "right_command",
  523                                 "right_control",
  524                                 "right_shift",
  525                                 "right_option"
  526                             ]
  527                         }
  528                     },
  529                     "to": [
  530                         {
  531                             "key_code": "tab",
  532                             "modifiers": [
  533                                 "left_control"
  534                             ]
  535                         }
  536                     ]
  537                 },
  538                 {
  539                     "type": "basic",
  540                     "from": {
  541                         "key_code": "u",
  542                         "modifiers": {
  543                             "mandatory": [
  544                                 "right_command",
  545                                 "right_control",
  546                                 "right_shift",
  547                                 "right_option"
  548                             ]
  549                         }
  550                     },
  551                     "to": [
  552                         {
  553                             "key_code": "page_up"
  554                         }
  555                     ]
  556                 },
  557                 {
  558                     "type": "basic",
  559                     "from": {
  560                         "key_code": "i",
  561                         "modifiers": {
  562                             "mandatory": [
  563                                 "right_command",
  564                                 "right_control",
  565                                 "right_shift",
  566                                 "right_option"
  567                             ]
  568                         }
  569                     },
  570                     "to": [
  571                         {
  572                             "key_code": "home"
  573                         }
  574                     ]
  575                 },
  576                 {
  577                     "type": "basic",
  578                     "from": {
  579                         "key_code": "o",
  580                         "modifiers": {
  581                             "mandatory": [
  582                                 "right_command",
  583                                 "right_control",
  584                                 "right_shift",
  585                                 "right_option"
  586                             ]
  587                         }
  588                     },
  589                     "to": [
  590                         {
  591                             "key_code": "end"
  592                         }
  593                     ]
  594                 },
  595                 {
  596                     "type": "basic",
  597                     "from": {
  598                         "key_code": "p",
  599                         "modifiers": {
  600                             "mandatory": [
  601                                 "right_command",
  602                                 "right_control",
  603                                 "right_shift",
  604                                 "right_option"
  605                             ]
  606                         }
  607                     },
  608                     "to": [
  609                         {
  610                             "key_code": "page_down"
  611                         }
  612                     ]
  613                 }
  614             ]
  615         }
suliveevil commented 2 years ago

I just made a list, may helpful to someone.

;; :modi {
;;        :co    [:command :option]
;;        :cos   [:command :option :shift]
;;        :cot   [:command :option :control]
;;        :cs    [:command :shift]
;;        :cst   [:command :shift :control]
;;        :ct    [:command :control]
;;        :os    [:option :shift]
;;        :ost   [:option :shift :control]
;;        :ot    [:option :control]
;;        :st    [:shift :control]
;;        :hyper [:C :T :O :S]
;;        :hyper-co    [:command :option]
;;        :hyper-cos   [:command :option :shift]
;;        :hyper-cot   [:command :option :control]
;;        :hyper-cs    [:command :shift]
;;        :hyper-cst   [:command :shift :control]
;;        :hyper-ct    [:command :control]
;;        :hyper-os    [:option :shift]
;;        :hyper-ost   [:option :shift :control]
;;        :hyper-ot    [:option :control]
;;        :hyper-st    [:shift :control]
;;        :hyper-lcommand [:C :O :S :T :]
;;        :hyper-lcontrol [:C :O :S :T :]
;;        :hyper-loption  [:C :O :S :T :]
;;        :hyper-lshift   [:C :O :S :T :]
;;        :hyper-rcommand [:C :O :S :T :]
;;        :hyper-rcontrol [:C :O :S :T :]
;;        :hyper-roption  [:C :O :S :T :]
;;        :hyper-rshift   [:C :O :S :T :]