Skip to content

Instantly share code, notes, and snippets.

@p-fruck
Last active May 2, 2025 13:23
Show Gist options
  • Select an option

  • Save p-fruck/c262aebba3be5debe23f656680dce2db to your computer and use it in GitHub Desktop.

Select an option

Save p-fruck/c262aebba3be5debe23f656680dce2db to your computer and use it in GitHub Desktop.
Toggle swap_alt_win on gnome desktop (MX Keys for Mac on Linux with EurKEY US Layout)
#!/bin/sh
set -e
regular="@as []"
swapped="['altwin:swap_lalt_lwin', 'lv3:rwin_switch']"
current=$(gsettings get org.gnome.desktop.input-sources xkb-options)
if [ "${current}" == "${regular}" ]; then
echo "Switching to Mac keyboard"
gsettings set org.gnome.desktop.input-sources xkb-options "${swapped}"
elif [ "${current}" == "${swapped}" ]; then
echo "Switching to normal keyboard"
gsettings set org.gnome.desktop.input-sources xkb-options "${regular}"
else
echo "WTF is the current config?"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment