Open GoogleCodeExporter opened 9 years ago
It's clear to me, I wasn't realizing the features of Sticky Keys while I was
(blindly) implementing this options for key-mon.
When I was working on Issue 59, I seemed to only read the feature description
on Wikipedia [1]:
StickyKeys allows the user to press and release a modifier key, such as Shift, Ctrl, Alt, or the Windows key, and have it remain active until any other key is pressed.
Which does not mention "double-pressed locking method" (I just named it :D).
But the comment 2 of Issue 59 [2]:
In my KDE, sticky keys behave like following.
- when one of the modifier keys (shift, ctrl, alt, meta/win) is pressed, it stays until another key is pressed.
- when one of the modifier keys is pressed twice it stays until that same key is pressed again no matter how many non-modifier keys are pressed.
has describe the features. And I only implemented the first part.
The problem I have here is: Is StickyKey feature provided by X or Desktop
Environment or other? Is the features of Sticky Keys all the same over any
DE/WM?
I am currently using DWM, only the window manager, I don't think I have
StickyKeys and that's reason I blindly implemented Sticky Keys option.
I think this feature is important but since I don't have real StickyKeys,
therefore I can't test throughly, I will wait for a while before I get on this
if no other developers are going to take this.
However, I wonder if there is already some programs can indicate modifiers'
states in tray, there should be some, right?
[1] http://en.wikipedia.org/wiki/StickyKeys
[2] http://code.google.com/p/key-mon/issues/detail?id=59#c2
Original comment by livibet...@gmail.com
on 10 Nov 2011 at 8:25
I have searched for an indicator and haven't found one. I am using Ubuntu 10.04
and Gnome. Key-mon is the nearest software I've found to what I'm looking for.
Original comment by den...@gmail.com
on 10 Nov 2011 at 10:19
Maybe we can start a new project? I am sure you aren't the only one who needs
modifier keys indicator.
Key-mon might be a little overkill in my opinion.
Original comment by livibet...@gmail.com
on 10 Nov 2011 at 10:32
While I personally don't use StickyKeys, I got interested in this issue. I hope
the information here, although incomplete, helps you.
I discovered that this feature is handled by X11 itself (I'm using Compiz
window manager without any Desktop Environment). I found a little tool called
"accessx" that includes a TCL/TK interface for configuring it (in addition to a
command-line "ax" tool).
http://cita.disability.uiuc.edu/software/accessx/freewareaccessx.php
In that GUI tool, I selected "StickyKeys", deselected "StickyKeys Two Key
Disable" and clicked "Save". Now I had StickyKeys working, and thus I could
start testing.
I found that "XkbStateRec" struct has all the required data. According to the
Xkb documentation: base_mods are the modifiers physically held down;
locked_mods are modifiers that are active, although maybe not physically held
down; and latched_mods are modifiers that get unset after the next key event.
http://www.x.org/releases/X11R7.6/doc/libX11/specs/XKB/xkblib.html#keyboard_stat
e_description
http://www.x.org/releases/X11R7.6/doc/libX11/specs/XKB/xkblib.html#tracking_keyb
oard_state
Thus, I believe all the information we need is available through XkbGetState(),
or, even better, through XkbStateNotifyEvent.
"X.h" contains the #defines for each modifier bit. Look for ShiftMask.
I guess that's enough to get started. :)
---
Some final thoughts:
I don't think we need a separate project for this. I believe that adding an
option to display key states as icons in the systray would be the best
solution, as it would allow sharing most of the code (and features) with the
main key-mon.
In addition, that systray option would be even nicer if key-mon someday also
displays numlock/capslock/scrolllock state. (but I realize that asking for this
is subject to another issue.
Original comment by denilsonsa
on 12 Nov 2011 at 12:56
Original comment by livibet...@gmail.com
on 30 Jan 2012 at 10:37
[deleted comment]
The following question on AskUbuntu (asked by myself) describes the behaviour
of the KDE applet for showing the state of the modifier keys, with respect to
Sticky Keys. User denilsonsa might find that it answers some of his questions.
http://askubuntu.com/questions/402315/how-to-add-a-keyboard-modifier-state-apple
t-to-unity-panel
It seems that the KDE applet is available here, so you can examine the source
code:
http://kde-look.org/content/show.php/?content=115234
Original comment by dotancohen
on 13 Mar 2014 at 4:47
Here is another applet which has source code for querying the real state of the
modifier keys from X:
https://gitorious.org/keystate
Original comment by dotancohen
on 13 Mar 2014 at 4:49
I guess the 'sticky keys' feature was not implemented with the actual
"universal access" idea of Sticky Keys in mind, or was a hack that to make it
work with that.
The correct thing is to get the actual state from X11, then the sticky key
option in the program can be removed altogether.
Original comment by sc...@forusers.com
on 13 Mar 2014 at 8:01
> The correct thing is to get the actual state from X11, then the sticky key
option
> in the program can be removed altogether.
Right, that is why I posted links to the source of applications that do just
that!
Original comment by dotancohen
on 14 Mar 2014 at 2:02
I just want to mention `xkbwatch` is the best/minimum example (showcase) of
modifiers state. It uses XkbGetState() to get initial status then follow
changes by listening to XkbStateNotifyEvent. As I'm not sure, if python-xlib
provides their bindings.
xkbwatch show a small Xt widget with state of 5 mod 8bit registers: base,
latch, lock, effective, compatible.
The minimum best choice as I think is to follow effective (doesn't matter if
base or latch) & lock registers.
Original comment by sneetsher@gmail.com
on 3 Apr 2014 at 9:29
Original issue reported on code.google.com by
den...@gmail.com
on 10 Nov 2011 at 7:35