sendkeys
sendkeys copied to clipboard
xsendkey 'A' prints 'a'
Hello ;) You saved my life. But my biggest problem now is to be able to send uppercase chars. How to?
./xsendkey 'A' sends 'a'.
Ahh I got it.... 'Shift+A'. Maybe filtering the input and add this automatically? Or write more examples into the README. Is it possible to print whole words using this one process?
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
from subprocess import call
for char in sys.argv[1]:
if char.isupper():
char = 'Shift+%s' % (char,)
call(['xsendkey', char])
How to send those character independent of the keyboard layout? *,-.:;<>?@[\]^_
{|}~'`
http://linux.die.net/man/3/xstringtokeysym tells "Standard KeySym names are obtained from <X11/keysymdef.h> by removing the XK_ prefix from each name.". The header file is located at: /usr/include/X11/keysymdef.h
xsendkey Shift+asterisk prints a * therefore. I don't understand why Shift is needed.
Hi spaceone. Thanks for this.
Part of the problem is that the input is filtered for uppercase characters, but only in sendkeys.sh. So, sendkeys.sh 'Terminal' 'H'
, should work, but sendkey.sh 'Terminal' 'H'
and calling xsendkey 'H' directly don't work. The filtering could be moved to solve this, but as you point out, there is also a more fundamental problem with handling different keyboard layouts.
I see you have created a fork, which looks promising. Let me know if you'd like me to merge something.
Hi :) So far I created a forked version which I call 'xsendword' which is able to evaluate multiple arguments. Maybe I will find a solution to the problem otherwise I will make a static mapping: https://github.com/spaceone/sendkeys/blob/master/xsendword.c
http://linux.die.net/man/3/xstringtokeysym tells "Standard KeySym names are obtained from <X11/keysymdef.h> by removing the XK_ prefix from each name.". The header file is located at: /usr/include/X11/keysymdef.h
xsendkey Shift+asterisk prints a * therefore. I don't understand why Shift is needed.
Shift is still needed because "asterisk" is a key "named", which has 3 characters that works with at least 2 modifiers (shift+altgr). That's why the asterisk needs to press Shift to produce an asterisk. If "asterisk" did not have such name, you'll need to know the keycode which represents that key.
So, if you send "asterisk", it will should produce "+", then I will call that key "sum" or "+" instead of "asterisk".