pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.65k stars 836 forks source link

Modifiers not working when XDG_CONFIG_HOME is overridden. #3522

Open rwz opened 1 year ago

rwz commented 1 year ago

Karabiner modifiers don't work if XDG_CONFIG_HOME is overridden on a system level.

I have a LaunchAgent startup shell script that overrides XDG_CONFIG_HOME env variable and some other stuff on system startup. This causes Karabiner modifiers to not work. The UI still works fine but adding modifiers does nothing.

Is there a way to have Karabiner working with custom $XDG_CONFIG_HOME?

Here's a repro:

1) Create a file under ~/Library/LaunchAgents/my.dotfiles.plist with the following content.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.dotfiles</string>
  <key>ProgramArguments</key>
  <array>
    <string>/Users/username/dotfiles.bootstrap.sh</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

2) Create a file ~/dotfiles.bootstrap.sh with content similar to this

#!/bin/sh

mkdir -p /Users/username/custom_xdg_config_home
launchctl setenv XDG_CONFIG_HOME /Users/username/custom_xdg_config_home

3) chmod +x ~/dotfiles.bootstrap.sh

4) Reboot, run printenv, verify that custom XDG_CONFIG_HOME took

5) Try adding some modifiers, verify they don't work anymore.

dlejay commented 1 year ago

What happens if you do :

  1. Restart Karabiner ?