6

I'm running 16.04 with LXDE on an old server. Graphics are obviously not awesome (8MB onboard graphics), so I am using x2go to forward my xsession over 10 100 1000. The problem is that the keystrokes (such as alt+tab, ctrl+alt+right, etc.) don't bind to the application, so instead of switching applications within x2go, it switches from the x2go application to the next open program on the client machine.

How could I bind all keystrokes (even nicer, one keystroke excluded) to a single application?

The client computer is running Unity. The host (the computer whose session I am sending through x2go) is running LXDE.

anonymous2
  • 4,268
  • 7
  • 33
  • 61

1 Answers1

2

Disable Unity shortcuts

  1. Install ccsm

     sudo apt-get install compizconfig-settings-manager
    
  2. Go to Desktop category → Ubuntu Unity plugin → Switcher tab

    Click on each shortcut, uncheck Enable, then OK

  3. Go to Desktop category → Desktop Wall → Bindings tab

    Same way, disable the shortcuts that you want.

  4. Close ccsm, It is effective right after closing.

ccsm shortcuts have priority on custom one from system settings. You can use dconf to see the underlying setting changed when you make the above steps using GUI.

$ dconf watch /
/org/compiz/profiles/unity/plugins/unityshell/alt-tab-prev
  'Disabled'

/org/compiz/profiles/unity/plugins/unityshell/alt-tab-prev
  'Disabled'

/org/compiz/profiles/unity/plugins/unityshell/alt-tab-forward
  unset

/org/compiz/profiles/unity/plugins/unityshell/alt-tab-forward
  unset

So better to make a wrapper script to disable unity switcher shortcuts, launch x2goclient, then enable them back after closing x2goclient.

dconf write /org/compiz/profiles/unity/plugins/unityshell/alt-tab-prev "'Disabled'"
dconf write /org/compiz/profiles/unity/plugins/unityshell/alt-tab-forward "'Disabled'"
...
x2goclient
dconf reset /org/compiz/profiles/unity/plugins/unityshell/alt-tab-prev
dconf reset /org/compiz/profiles/unity/plugins/unityshell/alt-tab-forward
...

Disable LXDE shortcuts

Old answer that could be useful for some.

The shortcut you mention belong to OpenBox. Which is launched with predefine settings for Lubuntu. (At least this is the case for Lubuntu 14.04).

~$ pgrep -a openbox
4772 openbox --config-file /home/lubuntu/.config/openbox/lubuntu-rc.xml

We should unbind them from OpenBox or any tools already binded them.

  1. Open its configuration file for editing

     leafpad ~/.config/openbox/lubuntu-rc.xml
    
  2. Then comment the shortcuts you want using XML comment tags <!-- --> or delete them.


New customized shortcut forwarded to x2goclient

After that setup global shortcuts to forward shortcut to x2goclient window using wmctrl & xvkbd.

  1. System Settings → Keyboard → Shortcuts tab

  2. Add new custom shortcut with command

     bash -c 'wid=$(wmctrl -l | awk "/X2Go Client/ {print $1; exit}"); echo $wid; if [ "$wid" ] ; then xvkbd -window $wid -xsentevent -text "\A\t"; fi'
    

    for AltTab

user.dz
  • 47,137
  • 13
  • 140
  • 258
  • Looks like you're on to something... Only problem is that the **client** computer isn't running LXDE; it's running Unity. – anonymous2 Jul 04 '16 at 15:03
  • @anonymous2 then LXDE is misleading, Could you edit question and add that you are running Unity. It is important & the answer with depend on it – user.dz Jul 04 '16 at 15:07
  • Done. Sorry about that, I'm not sure how I overlooked that. – anonymous2 Jul 04 '16 at 15:12
  • 1
    And if this is the best I can get, I'll take it, but as the title implies, my preferred solution would actually bind the keystrokes to a particular application, such that I can still use them in the client's operating system. – anonymous2 Jul 04 '16 at 15:15
  • @anonymous2, I added kind of workaround, please see if it works. – user.dz Jul 07 '16 at 22:16
  • I'm to run that command on the client computer while x2goclient is running? If so, is there a way to undo it when I start using the computer normally? – anonymous2 Jul 08 '16 at 13:20
  • Btw, because of some odd dependency issues, the first suggestion for Unity worked beautifully. Installing ccsm totally crashed compiz such that it doesn't start anymore, so the keybindings work perfectly. ;) – anonymous2 Jul 08 '16 at 13:40
  • :) `ccsm` could be harmful sometimes as it does apply setting directly when changed, either they are good or bad it does not care, user is the master mind. so it's more practical to make a backup ccsm > preferences > export. updated answer with cmdline option to let you make that setup. – user.dz Jul 08 '16 at 13:57
  • Sure, great, and thanks for your help. I was really starting to despair of an answer... :) – anonymous2 Jul 08 '16 at 13:58
  • @anonymous2, I look at it as workaround. The real solution should be from x2goclient or another client that support global shortcut binding. May be someone can come up with such solution even using additional plugins for a client. I don't use these tools regularly. – user.dz Jul 08 '16 at 14:04
  • I absolutely agree. That was kind of what I was hoping for. Either that or an application that can bind keystrokes to itself and run another application inside itself (ie, x2goclient). Hence the general title on my post, rather than "Bind all keystrokes to x2goclient." – anonymous2 Jul 08 '16 at 14:06