libxdotool - xdo_keysequence

447 views
Skip to first unread message

psc

unread,
Mar 23, 2011, 4:53:36 AM3/23/11
to xdotool-users
hi,

i am using libxdotool in my application like this:

working:
xdo_keysequence(xdo, xdotoolwindow, "F11", xdotooldelay);

*not working:
xdo_keysequence(xdo, xdotoolwindow, "Ctrl+s", xdotooldelay);

Mapping sym 65507 to 8
Mapping sym 65507 to 8

only output "s"

how can i fix this problem?
pat

Jordan Sissel

unread,
Mar 23, 2011, 11:15:38 AM3/23/11
to pat...@11h11.com, xdotool-users
On Wed, Mar 23, 2011 at 1:53 AM, psc <pat...@11h11.com> wrote:
hi,

i am using libxdotool in my application like this:

working:
xdo_keysequence(xdo, xdotoolwindow, "F11", xdotooldelay);

*not working:
xdo_keysequence(xdo, xdotoolwindow, "Ctrl+s", xdotooldelay);

Odd, that should work.
 

Mapping sym 65507 to 8
Mapping sym 65507 to 8

This output means that it couldn't find a key on your current keyboard map that is "Control_L" so it had to map it. However, mapping a control key requires two steps, mapping sym to keycode, and adding the keycode to a modifier map to act as a control key (In X11, you could have the 't' key act like control, for example)

Can you paste the output of 'xmodmap' ?

-Jordan

psc

unread,
Mar 23, 2011, 11:26:39 AM3/23/11
to xdotool-users
psc@mbp:~$ xmodmap
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L
(0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

i also tried "Alt_L+Tab", like i said "F11" works (only 1 key = no
problem). is it the "+" that causing a problem?

pat

psc

unread,
Mar 26, 2011, 12:24:20 AM3/26/11
to xdotool-users
hi

this version is working correctly:
xdotool-1.20100318.2737.tar.gz

all releases after that have a bug (at least here). do you know why?
ubuntu 10.4 - 32 bits - gnome.

pat

psc

unread,
Mar 26, 2011, 12:35:48 AM3/26/11
to xdotool-users
this is the code that cause the problem:
/* Hack for international/modeshift things.
* If we can't type this keysym with just a keycode or shift
+keycode,
* let's pretend we didn't find the keycode and request
* a keybinding.
*
* Should fix these bugs:
* http://code.google.com/p/semicomplete/issues/detail?id=21
* http://code.google.com/p/semicomplete/issues/detail?id=13
*
* This hack seems better (less code) than walking the keymap to
find
* which modifiers are required to type with this keycode to
invoke
* this keysym.
*/

int offset = 0;
/* I can't find a constant in Xlib that is 0x2000 (or 1 << 13)
* Maybe it's in Xkb? Either way, 0x2000 is the state shown by
xev(1)
* when we are shifted. Example:
* % setxkbmap -option * grp:switch,grp:shifts_toggle us,se
* Then hit both shift-keys simultaneously to switch to 'se' key
layout */
if (input_state & 0x2000) { /* keymap shifted via xkb */
offset = 2;
}

if (XKeycodeToKeysym(xdo->xdpy, key, 0 + offset) != sym
&& XKeycodeToKeysym(xdo->xdpy, key, 1 + offset) != sym) {
key = 0;
}

removing this code fix the problem. my keyboard layout is French/
Canadian, but i have also SCIM install to write kanji (Japanese).
Reply all
Reply to author
Forward
0 new messages