<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<br>
Okay, got that working just fine. Is there an argument for
XTestFakeKeyEvent that would just change the LED and not the state of
the flags; analagous to "setleds -L +caps"<br>
<br>
Trying 'system( "setleds -L +caps" );' returns the standard complaint
... stdin is not a VT<br>
<br>
Regards<br>
John W.<br>
<blockquote type="cite" cite="mid000901c593c0$afbbc6d0$1902a8c0@COACH">
<blockquote type="cite">
<pre wrap="">From: "Ken Bloom" <a class="moz-txt-link-rfc2396E" href="mailto:kbloom@gmail.com"><kbloom@gmail.com></a>
To: "lugod's technical discussion Sent: Thursday, July 28, 2005 9:35 AM
Subject: Re: [vox-tech] Using setleds
forum" <a class="moz-txt-link-rfc2396E" href="mailto:vox-tech@lists.lugod.org"><vox-tech@lists.lugod.org></a>
On 7/27/05, John Wojnaroski <a class="moz-txt-link-rfc2396E" href="mailto:castle@mminternet.com"><castle@mminternet.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
Is there a way to use 'setleds' inside a program? My understanding is
</pre>
</blockquote>
<pre wrap="">that
</pre>
<blockquote type="cite">
<pre wrap="">it only works with VTs (tty0 -- ttyxxx) and programs using input devices
such as /dev/pts/0 will not work.
Regards
John W.
</pre>
</blockquote>
<pre wrap="">You can use setleds inside a program by simply executing it as you
would any other UNIX program, using system(3) or fork(2) and exec(2).
If you're trying to use setleds on an x display, here's a little C
program that can toggle the numlock key. I have it run in my .xsession
so that it always turns on numlock when I log in. You can also look at
<a class="moz-txt-link-freetext" href="http://freshmeat.net/projects/numlockx/">http://freshmeat.net/projects/numlockx/</a> which is similar.
//numlock.c
//compile using:
//gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock Numlock.c
-lX11 -lXtst#include <X11/extensions/XTest.h>
#include <X11/keysym.h>
int main(void) {
Display* disp = XOpenDisplay( NULL );
if( disp == NULL )
return 1;
XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock),
True, CurrentTime );
XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock),
False, CurrentTime );
XCloseDisplay( disp );
return 0;
}
//end of source code
--Ken Bloom
_______________________________________________
vox-tech mailing list
<a class="moz-txt-link-abbreviated" href="mailto:vox-tech@lists.lugod.org">vox-tech@lists.lugod.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lugod.org/mailman/listinfo/vox-tech">http://lists.lugod.org/mailman/listinfo/vox-tech</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>