xpra icon
Bug tracker and wiki

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#50 closed enhancement (fixed)

a trick for transferring keyboard modifiers to xpra server

Reported by: Heroxbd Owned by: Antoine Martin
Priority: minor Milestone: 0.0.7.x
Component: client Version:
Keywords: Cc:


at present xpra client only transfers the output of "xmodmap -pke" to xpra server. this is enough for simple cases.

However if xmodmap_data contains modifications of keyboard modifiers like Shift_L Control_R, xmodmap in xpra server usually screws up.

We'd better clear the relavent modifiers and readd them after applying keymap table from "xmodmap -pke".

Unfortunately xmodmap do not have a "-pme" feature. I came up with a quick hack by make a wrapper of xmodmap to print "clear" and "add" clauses around keymap table.

Attachments (1)

xmodmap (425 bytes) - added by Heroxbd 9 years ago.
xmodmap wrapper

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Heroxbd

Attachment: xmodmap added

xmodmap wrapper

comment:1 Changed 9 years ago by Antoine Martin

Owner: changed from Antoine Martin to Antoine Martin
Status: newaccepted

Will do some thorough testing and assuming all goes well, merge it.
(too late for though... building as we speak)

What are the keys that you were having problems with?
Also, what is your client and server OS? Does your setxkbmap understand the "-query" option? (I have found this to be sufficient in almost all cases - as relying on just "-print" is not always enough..)

comment:2 Changed 9 years ago by Antoine Martin

btw, here is a patch that does the same thing from the client code:

Index: xpra/xposix/gui.py
--- xpra/xposix/gui.py	(revision 310)
+++ xpra/xposix/gui.py	(working copy)
@@ -244,11 +244,26 @@
             log.error("the server will try to guess your keyboard mapping, which works reasonably well in most cases");
             log.error("however, upgrading 'setxkbmap' to a version that supports the '-query' parameter is preferred");
         xmodmap_data = get_keyboard_data("xmodmap", "-pke");
+        if xmodmap_data:
+            #try to ensure the modifiers are set properly:
+            clear_modifiers = """clear Lock
+clear Ctrl
+clear mod1
+clear mod4
+clear shift
+            set_modifiers = """
+add Ctrl = Control_L Control_R
+add mod1 = Alt_L Alt_R
+add mod4 = Super_L Super_R
+add shift = Shift_L Shift_R
+            xmodmap_data = clear_modifiers + xmodmap_data + set_modifiers
         return xkbmap_print, xkbmap_query, xmodmap_data
     def get_keyboard_repeat(self):

Does that also work for you?

Last edited 9 years ago by Antoine Martin (previous) (diff)

comment:3 Changed 9 years ago by Antoine Martin

Resolution: fixed
Status: acceptedclosed

not heard back, but r325 does something better: rather than hardcoding those values, we parse the output from "xmodmap -pm" and generate the clear/add lines on the fly

comment:4 Changed 9 years ago by Antoine Martin

Milestone: future0.0.7.x
Note: See TracTickets for help on using tickets.