July 28th, 2011, 02:04 AM
|
#1 (permalink)
|
|
Junior Member
Join Date: Jul 2011
Posts: 27
Device(s): Generic noname android 2.2 tablet
Thanks: 0
Thanked 0 Times in 0 Posts
|
Possible to Intercept keyboard key presses?
I had an idea for an application, but I don't know if it's possible or not.
Can a program sit in the background and intercept keypresses, convert the keypresses from one letter to another, and send it to whatever program you are working in as though the new letter is what you typed?
As qwerty is the only layout choice for hardware keyboards and I don't have root on my tablet, I want to use this as a work around.
If I were to press "s" on my hardware usb keyboard. The program would intercept the "s" before it got to whatever textbox and convert it into the dvorak key equivalent of "o". That o would then be passed to the program as a normal keypress.
if I were to press asdfg on the qwerty aoeui would be sent instead.
Is this possible to do? I thought it best to ask before I waste hours trying to learn how to write the program.
List of changes I would make in a pseudocode case statement format.
Select Case Key
#Comment - Number Row Key changes
- = change to [
= = change to ]
#Comment - Top Row Key changes
q = change to '
w = change to ,
e = change to .
r = change to p
t = change to y
y = change to f
u = change to g
i = change to c
o = change to r
p = change to l
[ = change to /
] = change to =
#Comment - Middle Row Key changes
#Comment - A = A Same in Dvorak as Qwerty Handled by the Else
s = change to o
d = change to e
f = change to u
g = change to i
h = change to d
j = change to h
k = change to t
l = change to n
; = change to s
' = change to -
#Comment - Bottom Row Key changes
z = change to ;
x = change to q
c = change to j
v = change to k
b = change to x
n = change to b
#Comment - M = M Same in Dvorak as Qwerty Handled by the Else
, = change to w
. = change to v
/ = change to z
else
#Comment - For keys that are the same in Dvorak as in Qwerty
pressed key = pressed key
end case
|
|
|
Last edited by tannim; July 28th, 2011 at 03:18 AM.
Reason: added a bit
|
|