Jump to content

Change "Select the next result in the list" hotkey from "↓" to "TAB"


Recommended Posts

When looking at search results in Alfred I'd like to be able to cycle through them with a Tab, instead of with the up and down arrows. (With TAB, my hand does not need to change position). Is there a way to achieve this? 

Thanks a lot!
Timon

Link to post

Quite likely not possible with just Alfred.

If you don't mind using https://karabiner-elements.pqrs.org/ which is free and open source, it is easy.

 

Note: for this to work, you'll have to set Alfred Preferences > Appearance > Options > Focusing to "Compatibility Mode"

 

Just add the following rule to ~/.config/karabiner/karabiner.json:

{
  "description": "Tab as down arrow in Alfred",
  "manipulators": [
    {
      "conditions": [
        {
          "bundle_identifiers": [
            "^com.runningwithcrayons.Alfred"
          ],
          "type": "frontmost_application_if"
        }
      ],
      "from": {
        "key_code": "tab"
      },
      "to": [
        {
          "key_code": "down_arrow"
        }
      ],
      "type": "basic"
    }
  ]
}

 

For reference, here's an example of how the entire file would look like:

{
  "global": {
    "check_for_updates_on_startup": true,
    "show_in_menu_bar": true,
    "show_profile_name_in_menu_bar": false
  },
  "profiles": [
    {
      "complex_modifications": {
        "parameters": {
          "basic.simultaneous_threshold_milliseconds": 50,
          "basic.to_delayed_action_delay_milliseconds": 500,
          "basic.to_if_alone_timeout_milliseconds": 1000,
          "basic.to_if_held_down_threshold_milliseconds": 500,
          "mouse_motion_to_scroll.speed": 100
        },
        "rules": [
          {
            "description": "Tab as down arrow in Alfred",
            "manipulators": [
              {
                "conditions": [
                  {
                    "bundle_identifiers": [
                      "^com.runningwithcrayons.Alfred"
                    ],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "tab"
                },
                "to": [
                  {
                    "key_code": "down_arrow"
                  }
                ],
                "type": "basic"
              }
            ]
          },
        ]
      },
      "devices": [],
      "fn_function_keys": [
        {
          "from": {
            "key_code": "f1"
          },
          "to": {
            "consumer_key_code": "display_brightness_decrement"
          }
        },
        {
          "from": {
            "key_code": "f2"
          },
          "to": {
            "consumer_key_code": "display_brightness_increment"
          }
        },
        {
          "from": {
            "key_code": "f3"
          },
          "to": {
            "key_code": "mission_control"
          }
        },
        {
          "from": {
            "key_code": "f4"
          },
          "to": {
            "key_code": "launchpad"
          }
        },
        {
          "from": {
            "key_code": "f5"
          },
          "to": {
            "key_code": "illumination_decrement"
          }
        },
        {
          "from": {
            "key_code": "f6"
          },
          "to": {
            "key_code": "illumination_increment"
          }
        },
        {
          "from": {
            "key_code": "f7"
          },
          "to": {
            "consumer_key_code": "rewind"
          }
        },
        {
          "from": {
            "key_code": "f8"
          },
          "to": {
            "consumer_key_code": "play_or_pause"
          }
        },
        {
          "from": {
            "key_code": "f9"
          },
          "to": {
            "consumer_key_code": "fastforward"
          }
        },
        {
          "from": {
            "key_code": "f10"
          },
          "to": {
            "consumer_key_code": "mute"
          }
        },
        {
          "from": {
            "key_code": "f11"
          },
          "to": {
            "consumer_key_code": "volume_decrement"
          }
        },
        {
          "from": {
            "key_code": "f12"
          },
          "to": {
            "consumer_key_code": "volume_increment"
          }
        }
      ],
      "name": "Default profile",
      "parameters": {
        "delay_milliseconds_before_open_device": 1000
      },
      "selected": true,
      "simple_modifications": [],
      "virtual_hid_keyboard": {
        "country_code": 0,
        "mouse_key_xy_scale": 100
      }
    }
  ]
}

 

Edited by Mr Pennyworth
Link to post
16 hours ago, timonbimon said:

Is there a way to achieve this?

 

TAB is already used for autocomplete or File Actions. If you re-assign it via a hack (as above), you'll break some of Alfred's functionality.

 

You can use ^P and ^N (previous and next) instead.

Link to post

Thanks for the answer! And yes I'm aware. Changing the autocomplete to instead looping through the results is exactly what I'd like to achieve :) (never really understood the point of the autocomplete?)

Edited by timonbimon
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...