Earlier today I became the owner of a usb based kvm switch which replaced an older model that used ps/2 connectors. In any case, I noticed almost instantly that switching from my windows PC to my linux pc using the keyboard shortcut (scroll lock&scroll lock&up/down arrow) worked but did NOT do so from the linux PC. There are apparently a lot of threads on a great many websites detailing how to do workarounds, but none of them worked particularly well for me.
One popular and simple workaround which worked for me was to switch to console (alt+ctrl+F1) before trying to switch between machines. When you switch back you should be able to get back into X by pressing alt+F7 (F6 for some distributions.) I didn't like it however since it requires I switch to console and back again, adding another step.
One which did not work, but I'm going to list it anyway due to it working for other people and being less intrusive than what I eventually did is to modify the keyboard map into lighting the scroll lock LED when you press the scroll lock key.
(workaround copypasted from https://bugs.launchpad.net/ubuntu/+s...ev/+bug/912044
Find an unused mapping:
$ xmodmap -pm
Use the "modX" which has nothing applied to it, then try (assuming modX = mod3 from xmodmap -pm output):
$ xmodmap -e "add mod3 = Scroll_Lock"
If this works for you note that you will need to modify your startup script for the user (usually ~/.xinitrc) to execute the second xmodmap line
To be clear, this did not work for me. Inexplicably however, I noticed that lighting the LED's quickly and turning them off using xset, pausing, then doing it again caused it to switch. Even better yet, I was able to figure out how to use a keyboard shortcut in fluxbox to trigger a script.
My workaround, which triggers when I press scroll lock twice:
edit ~/.fluxbox/keys and append to the end as the last line:
Scroll_Lock Scroll_Lock :Exec ~/local/bin/switchcomputers
mkdir -p ~/local/bin
and create the file ~/local/bin/switchcomputers with the contents:
xset led 3 && sleep 0.2 && xset -led 3 && sleep 2 && xset led 3 && sleep 0.2 && xset -led 3
save and quit, then
chmod +x ~/local/bin/switchcomputers
Note that this will create the script in a subdirectory of your user's homedir, this may not be what you want. Also, you can probably modify other window managers (eg, kde/gnome) keyboard shortcuts to run the script or an equivalent.
I cannot guarantee success, but I thought that since I had discovered something that worked well for me that I should inform others about it.