The following shell script works to make the Search key another Control key on a Samsung Chromebook when swapping the Search key and the Control key is activated under ChromeOS. In addition, on the system where this worked, the "keyboard" target of crouton was not loaded. (And, yongzhy's solution above doesn't work --- the Search key still expresses "mod4" in addition to "control", and ".xinitrc" doesn't seem to be executed.)
#! /bin/bash -f
xmodmap -e 'remove mod4 = Super_L'
xmodmap -e 'remove control = Control_L'
xmodmap -e 'keycode 133 = Control_L'
xmodmap -e 'add control = Control_L'
xmodmap -e 'keycode 134 = Control_L'
xmodmap -e 'remove mod4 = Control_L'
xmodmap -e 'keycode 207 = Control_L'
xmodmap -e 'remove mod4 = Control_L'
Note that running "xmodmap" once on a file containing all of these commands did not work, for some reason. (Something which might point to a race condition between some ChromeOS keyboard driver weirdness and "xmodmap", which might mean that other systems might need "sleep" commands inserted in this script in auspicious places.)
In addition, if you are running Xfce as your desktop, and want to add this to the automatically started programs in the session settings, you should add a "sleep X" to the start of the file, where X = 3 worked for me, but I assume it could vary depending on the speed of your system and what other processes are run by Xfce at startup.
Based on my experience, if this doesn't work, I suggest trying the following pseudo-code:
<Do what you would ordinarily do to switch the keys>
while "xmodmap -pm" shows that "mod4" includes keys:
for key in <keys assigned to mod4>:
xmodmap -e 'keycode <keycode(key)> = Control_L'
xmodmap -e 'remove mod4 = Control_L'
(This obviously won't work if you want to have some key expressing "mod4".)
[
and before]
at least inbash
. – nitishch Jun 26 '15 at 05:09