Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functinality to open application; wait n seconds; submit key events #75

Closed
alexey-danilov opened this issue Aug 21, 2020 · 7 comments
Closed

Comments

@alexey-danilov
Copy link

I want to replicate the setting, which I had in json karabiner config: open browser, wait 2 seconds, open new tab -> for quicker access to search.

So far I've come up with a configuration to open the browser:

{:des "hypr + e -> firefox" :rules [[:!!e "open '/Applications/Firefox.app'"]]}

It is possible to achieve the rest in goku?

@yqrashawn
Copy link
Owner

How do you implement the wait 2s in karabiner?

@MuhammedZakir
Copy link
Contributor

MuhammedZakir commented Aug 22, 2020

https://github.com/yqrashawn/GokuRakuJoudo/blob/master/src/karabiner_configurator/rules.clj#L191

{:main [{:des "hypr + e -> firefox"
         :rules [[:!!e ["open '/Applications/Firefox.app'"]
                  nil
                  {:delayed {:invoked [:!Ct]}
                   :params {:delay 2000}}
                ]]
       }]
}

I am not familiar with EDN. So if I formatted this wrongly, please do tell! That would be helpful!

@yqrashawn
Copy link
Owner

There's nothing wrong in this config. Although it's not work on my mac, it opens firefox and insert a t in the location bar. Does it have the same behavior on your side?

@MuhammedZakir
Copy link
Contributor

MuhammedZakir commented Sep 1, 2020

There's nothing wrong in this config. Although it's not work on my mac, it opens firefox and insert a t in the location bar. Does it have the same behavior on your side?

I am getting this now! IIRC, I didn't encounter this issue earlier because I didn't use hyper key.

After fiddling with this, I found that

  1. For some reason, using the same key in from and to_delayed_action is not working.
  2. Key up event is not send for delayed action.

This is what I came up with

{
  "to_delayed_action": {
    "to_if_invoked": [
      {
        "key_code": "t",
        "modifiers": [
          "right_command"
        ]
      },
      {
        "key_code": "right_command"
      }
    ]
  },
  "parameters": {
    "basic.to_delayed_action_delay_milliseconds": 2000
  },
  "from": {
    "key_code": "e",
    "modifiers": {
      "mandatory": [
        "left_command",
        "left_control",
        "left_option",
        "left_shift"
      ]
    }
  },
  "to": [
    {
      "shell_command": "open '/Applications/Firefox.app'"
    }
  ],
  "type": "basic"
}

How can I write this in EDN? I modified delayed to {:delayed {:invoked [:!Qt [:Q]]}. But, I got null for second event instead of right_command. This maybe a bug in Goku because I got an error when I tried to use modifier key as normal key in to event.

P.S. to_delayed_action and parameters should be after to event in generated JSON. Currently, Goku puts it before from event.

@yqrashawn
Copy link
Owner

@MuhammedZakir :invoked [:!Qt [:Q]] need to be changed to :invoked [:!Qt :right_command]

@MuhammedZakir
Copy link
Contributor

Thanks! It's working now! So you can only use abbreviations such as Q or C, in from events?

@yqrashawn
Copy link
Owner

Thanks! It's working now! So you can only use abbreviations such as Q or C, in from events?

it can be used in :main section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants