remove mod1 = Alt_L Meta_L
remove mod5 = ISO_Level3_Shift
keycode 113 = Alt_L Meta_L
keycode 64 = ISO_Level3_Shift
add mod1 = Alt_L Meta_L
add mod5 = ISO_Level3_Shift
You can put these six line into a plain text file (adapting "64" and
"113" if necessary) and then run
xmodmap name-of-the-file-with-the-commands
to swap Alt and AltGr. This means that you have to use CTRL + ALT(right)
for all the special functions, and ALT(left) + g should give you "@".
Depending on how you start X it might be enough to put the six commands
into a file called ".Xmodmap" in your home directory to have them
executed automatically at every start of X. If that does not work then
you have to find an "autostart" folder of your desktop environment and
put the "xmodmap ~/.Xmodmap" command in a script there.