Hi,
Most likely this behavior depends on the keyboard layout. Currently the
command 'str' only supports character that can be typed on the user's
specific keyboard, either without key modifiers or with the modifiers
Shift_L or ISO_Level3_Shift. You will get a list of available
character/keys if you run xte in debug mode:
xte -d 2 "str f...@bar"
In my case, 'xte "str f...@bar"' works, because I currently use an US
keyboard, where '@' is simply Shift+2. I suppose you have to type
something more complicated on your keyboard to get an '@'.
I get the same error as you when I try 'xte "str naïve"', because ï is
AltGr+"+i on my US keyboard. I think xte should print a more
comprehensible error or warning in that case. I've attached a patch
which should do this job.
I'll think about a way to get characters working, which require a more
complicated key sequence (e.g. involving Multi_key). A workaround is
specifying the key sequence explicitly:
str na
keydown Multi_key
str "i
keyup Multi_key
str ve
This will print 'naïve' correctly. This workaround, however, will only
work for users that use compatible keyboard layouts.
Cheers,
Marco
--- xautomation-1.02/xte.c 2008-03-17 16:12:49.000000000 +0100
+++ xautomation-1.02-mod/xte.c 2009-04-09 19:00:14.000000000 +0200
@@ -82,25 +82,29 @@ void send_string( Display *d, char *thin
/* keysym = wchar value */
keysym = wc_singlechar_str[ 0 ];
if( keysym >= MAX_KEYSYM ) {
- fprintf( stderr, "Special character '%ls' is currently not supported.\n", thing );
+ fprintf( stderr, "Special character '%ls' is currently not supported.\n", wc_singlechar_str );
}else{
/* Keyboard modifier and KeyCode lookup */
wrap_key = key_modifiers[ keysym_to_modifier_map[ keysym ] ];
keycode = keysym_to_keycode_map[keysym];
-
- dmsg( 1, "Keycode: %d\n",
- keycode );
-
- if( wrap_key != NULL )
- XTestFakeKeyEvent( d, thing_to_keycode( d, wrap_key ), True, CurrentTime );
- XTestFakeKeyEvent( d, keycode, True, CurrentTime );
- XTestFakeKeyEvent( d, keycode, False, CurrentTime );
- if( wrap_key != NULL )
- XTestFakeKeyEvent( d, thing_to_keycode( d, wrap_key ), False, CurrentTime );
-
- /* Not flushing after every key like we need to, thanks
- * [email protected] */
- XFlush( d );
+ if ( keycode == 0 ) {
+ fprintf( stderr, "Character '%ls' is currently not supported on this keyboard layout.\n", wc_singlechar_str );
+ } else {
+
+ dmsg( 1, "Keycode: %d, Wrap key: %s\n",
+ keycode, wrap_key );
+
+ if( wrap_key != NULL )
+ XTestFakeKeyEvent( d, thing_to_keycode( d, wrap_key ), True, CurrentTime );
+ XTestFakeKeyEvent( d, keycode, True, CurrentTime );
+ XTestFakeKeyEvent( d, keycode, False, CurrentTime );
+ if( wrap_key != NULL )
+ XTestFakeKeyEvent( d, thing_to_keycode( d, wrap_key ), False, CurrentTime );
+
+ /* Not flushing after every key like we need to, thanks
+ * [email protected] */
+ XFlush( d );
+ }
}
i++;