The problem: I have a Mac keyboard where the Alt/Win (i.e. Option/Command) keys are inverted compared to a regular PC keyboard, and I'd like to swap them.
The answer:
# clear all options
setxkbmap -model "pc105" -layout "us,se" -option ""
# set the Apple keyboard
setxkbmap -rules "evdev" -model "pc105" -layout "us,se" -option "terminate:ctrl_alt_bksp,lv3:rwin_switch,grp:shifts_toggle,altwin:swap_lalt_lwin"
And another one which I call when I'm back on a normal keyboard:
# clear settings
setxkbmap -model "pc105" -layout "us,se" -option ""
# pc keyobard
setxkbmap -rules "evdev" -model "pc105" -layout "us,se" -option "terminate:ctrl_alt_bksp,lv3:rwin_switch,grp:shifts_toggle"