The "right Alt key" is often (always ?) not the same as the "left Alt key", but corresponds to the AltGr, see for instance
and as such has a different-and-distinct function.
You may want to try to try using
xdotool to emulate certain key combination behaviour. Thus, you could set the
Left Alt +
Left Shift in the way described by Abdulkader in his answer, and
- the second combination as
Right AltGr +
Right Shift) with
For a detailed example of how this can be done in general, with screenshots, plz refer to izx's excellent answer here. Regarding your questions specifically, you could try
xdotool key --clearmodifiers alt+shift
and then assigning this command to the
Shift+Level3 Shift (don't type this, just press right_Shift + right_AltGr) shortcut in Custom Shortcuts. Again, plz refer to the relevant part of izx's answer.
Voilá, you're sorted.
Note that if you tried to do it "the other way around" like so
xdotool key --clearmodifiers ISO_Level3_Shift+Shift
(or alternatively, but less likely to work,
Alt_R+Shift_R), noting that AltGr is "equivalent to" ISO_Level3_Shift,
you'd probaly get stuck, because "Alt_R+Shift_R" does not seem to be offered in the standard layout switching key dialog.
Further reading: from the xdotool man page:
Generally, any valid X Keysym string will work. Multiple keys are
separated by '+'. Aliases exist for "alt", "ctrl", "shift",
"super", and "meta" which all map to Foo_L, such as Alt_L and
also Remapping the AltGr key to Control with setxkbmap may be of interest to you...
See https://bugs.launchpad.net/ubuntu/+source/xdotool/+bug/696247 and http://code.google.com/p/semicomplete/issues/detail?id=13 ... and the workaround suggested therein (and confirmed to be working as of Nov 2012) of "The workaround, for now, is to use setxkbmap to force your keymap in xmodmap (setxkbmap dvorak, etc)". Thusly, plz refer to my 2nd, separate answer.