Sample Header Ad - 728x90

Karabiner not repeating shell command in "to_if_held_down" block

1 vote
1 answer
508 views
I want to map my mouse button 5 such that option + button 5 skips to the next track if pressed once, and if held down it continuously skips forward by 10 seconds. I've added the following rule to Karabiner:
{
  "title": "Mouse Button Remapping",
  "rules": [
    {
      "description": "Maps option + button 5 to next track",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "pointing_button": "button5",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to_if_alone": [
            {
              "key_code": "rewind"
            }
          ],
          "to_if_held_down": [
            {
              "shell_command": "osascript -e 'tell application \"Spotify\" to player position' | awk '{ print $1 - 10 }' | xargs -I {} osascript -e 'tell application \"Spotify\" to set player position to {}'",
              "repeat": true
            }
          ]
        }
      ]
    }
  ]
}
For some reason though, when I hold down option + button 5, the track will skip forward 10 seconds just *once*. The weird thing is, if I replace the shell_command in the to_if_held_down block to just be "key_code" : "rewind", then a *ton* of rewind events are sent to Spotify. Is there a configuration option I'm missing? FWIW I'm also running bearded spice such that all media key events are sent solely to Spotify.
Asked by rcplusplus (141 rep)
Jun 25, 2020, 10:02 PM
Last activity: Nov 5, 2023, 11:05 AM