Skip to content

Instantly share code, notes, and snippets.

@filviu
Last active July 11, 2023 14:13
Show Gist options
  • Save filviu/8fafaa311a02a2f4620540c23b54cd87 to your computer and use it in GitHub Desktop.
Save filviu/8fafaa311a02a2f4620540c23b54cd87 to your computer and use it in GitHub Desktop.
Karabiner / Synergy Integration
  • Add ~/bin/synergy-karabiner.sh to General -> Login Items

Do note that if you sleep and resume on a new wifi network the script is still running. I should really implement a python mini-daemon for this :)

The script calls on two profiles:

  • mac which has all my customizations
  • disabled a blank profile with no customizations

Notes:

  • My mac profile has most of changes skipping vscode as I use smcpeak.default-keys-windows for that one.
#!/bin/bash
WIFI=$(/Sy*/L*/Priv*/Apple8*/V*/C*/R*/airport -I | sed -n "s/^.*SSID: \(.*\)$/\1/p")
if [ $WIFI = "MY_HOME_WIFI" ]; then
tail -f /Users/silviu/Library/Logs/Synergy/synergy.log | awk '/leaving screen/{system("\"/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli\" --select-profile disabled")} /entering screen/ {system("\"/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli\" --select-profile mac")}' &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment