The Duckypad autoswitcher seems to have some issues on OS X, where the autoswitcher will not switch profiles.
The issue seems to be that on Mac the autoswitcher keeps a long lived HID connection, and that OS X doesn’t get key presses from the pad while that connection is open. It could be that an OS X update changed how HID works, but is not clear.
There is a branch with some substantial changes to the autoswitcher that doesn’t do this on Mac, though it’s definitely imperfect. On that branch the autoswitcher occasionally crashes, or stops working if the pad is disconnected and reconnected: but easily fixed by restarting the autoswitcher. There also seems an issue that the first keypress is ignored when the pad wakes up from sleep. But on the whole, it does fix the issue!
The instructions and code below are provided without warranty, under the MIT license. Use at own risk!
Your terminal program will need to have the following permissions enabled under System Preferences -> Security & Privacy -> Privacy:
- Input Monitoring (required to talk to Duckypad)
- Screen Recording (required to get window titles)
If having any issues, it may also be worth trying enabling Accessibility as well.
- Go to https://github.com/harryjubb/duckyPad-profile-autoswitcher/tree/os-x-open-close-hid
- Click on the green "Code" button
- Download ZIP
- Extract the zip file. The unzipped folder can be placed wherever you prefer
- Open a Terminal window and change into the unzipped folder
- Create a Python virtual environment to avoid installing dependencies into your system Python:
python3 -m venv venv
- Activate the virtual environment (has your terminal session use the virtual environment Python):
source venv/bin/activate
- Install requirements for the autoswitcher:
pip3 install -r requirements.txt
- Run the autoswitcher. Has to be run as root to work, so requires a password:
sudo python3 src/duckypad_autoprofile.py
- When finished, the virtual environment can be deactivated with
deactivate
(only necessary if you needed to use a different Python install in the same terminal window)
2021-12-01
With thanks to Daedalus#3131
On OS X Monterey (12.x.x) there's an issue with Tk in Python where the GUI window ends up completely black and unusable.
If anyone else runs into this problem with Tk/python being finicky, it can be fixed by using the latest official Python 3.10 distribution, which includes a patch for the issue:
- Uninstall python3 from homebrew and any version of python3 from python.org
- Install pyenv and download Python 3.10.0 from python.org
- Create a virtualenv using pyenv-virtualenv plugin specific to the autoswitcher directory
- Install the requirements, and run the script as above