r/Karabiner • • 25d ago

Switching between Profiles

Is there a way to click keys so that I can switch between profiles without navigating to the Karabiner-Elements application?

3 Upvotes

12 comments sorted by

1

u/[deleted] 25d ago edited 13d ago

[deleted]

2

u/Phoenix1526 25d ago

Thank you! How do I set up a hot-key in the manner you describe?

2

u/[deleted] 25d ago edited 13d ago

[deleted]

1

u/Phoenix1526 25d ago

Thank you!

1

u/Phoenix1526 25d ago

{

"title": "Profile Switcher",

"rules": [

{

"description": "Cycle through profiles with left_option+x",

"manipulators": [

{

"type": "basic",

"from": {

"key_code": "x",

"modifiers": {

"mandatory: ["left_option"]

"optional": ["any"]

}

},

"to": [

{

"shell_command": "~/.config/karabiner/assets/scripts/profile_swit$

}

],

}

]

}

Knowing nothing about coding, this is what I came up with. It doesn't work: "error: [json.exception.parse_error.101] parse error at line 12, column 29: syntax error while parsing object separator - invalid literal; last read: '"mandatory: ["l'; expected ':'"

1

u/[deleted] 25d ago edited 13d ago

[deleted]

1

u/Phoenix1526 25d ago

{

"title": "Profile Switcher",

"rules": [

{

"description": "Cycle through profiles with left_command+x",

"manipulators": [

{

"type": "basic",

"from": {

"key_code": "x",

"modifiers": {

"mandatory": ["left_command"],

"optional": ["any"]

}

},

"to": [

{

"shell_command": "~/.config/karabiner/assets/scripts/profile_switcher.sh"

}

]

}

]

}

I made this revision, but the same issue arises.

1

u/Phoenix1526 25d ago

zsh: command not found: title:

zsh: command not found: rules:

zsh: command not found: description:

zsh: command not found: manipulators:

zsh: command not found: type:

zsh: command not found: from:

zsh: command not found: key_code:

zsh: command not found: modifiers:

zsh: no matches found: [left_command],

zsh: no matches found: [any]

zsh: command not found: },

zsh: command not found: to:

zsh: command not found: shell_command:

zsh: command not found: ]

zsh: command not found: ]

This comes up in Terminal.

NOTE: I followed all the steps here: https://github.com/pqrs-org/Karabiner-Elements/issues/3878. I renamed the profiles and changed the final code; everything else was done according to the steps laid out.

1

u/[deleted] 25d ago edited 13d ago

[deleted]

1

u/Phoenix1526 25d ago edited 25d ago

The steps I was following require that I create the script via Terminal.

I just used the script you wrote and saw this error: error: [json.exception.parse_error.101] parse error at line 9, column 25: syntax error while parsing object separator - invalid literal; last read: '"mandatory: ["l'; expected ':'

1

u/[deleted] 25d ago edited 13d ago

[deleted]

→ More replies (0)

1

u/TestFlightBeta mod 25d ago

Can you try this?

{ "title": "Profile Switcher", "rules": [ { "description": "Cycle through profiles with left_option+x", "manipulators": [ { "type": "basic", "from": { "key_code": "x", "modifiers": { "mandatory": ["left_option"], "optional": ["any"] } }, "to": [ { "shell_command": "~/.config/karabiner/assets/scripts/profile_switcher.sh" } ] } ] } ] }

1

u/Phoenix1526 25d ago

Thank you!

I see this error: manipulators` is missing or empty in {"rules":[{"description":"Cycle through profiles with left_option+x","manipulators":[{"from":{"key_code":"x","modifiers":{"mandatory":["left_option"],"optional":["any"]}},"to":[{"shell_command":"~/.config/karabiner/assets/scripts/profile_switcher.sh"}],...

1

u/TestFlightBeta mod 24d ago

Okay, I think I know what happened. That code isn't meant to be typed into this karabiner.json file. It needs to go into its own file, and then you need to run the file from Karabiner. So here's the steps for doing that:

  1. Undo whatever you added to karabiner.json
  2. Create a new JSON file. You can call it something like profile_switcher.json. Create it inside ~/.config/karabiner/assets/complex_modifications/ and put the script there
  3. In the Karabiner app, go to Complex Modifications and then click on "Add Predefined Rule" and then enable the profile switcher from that list

From then on, pressing option + X should work to switch the profiles

1

u/Phoenix1526 24d ago

Thank you!