Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

Off-Topic discussions about science, technology, and non Debian specific topics.
Message
Author
teika
Posts: 31
Joined: 2011-06-25 06:15

Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#1 Post by teika »

Edit May 2023:
Use "interception-tools" (in debian) and its plugin "Dual Function Keys" to replace my hack. The latter is not packaged by Debian (yet), so get it from the upstream. Another plugin "interception-caps2esc" is provided by Debian, so learn from it how to build.

Hi. This hack, at-home-modifier (or ahm for short) provides for example "space/shift dual role key". When you press the space key alone, it's a space; but when you press it with another key, it's a shift. Any pairs of keys are possible. This means your hands stay almost always at their home positions.

It's a fork of Xorg "evdev" driver (= xf86-input-evdev, or in debian xserver-xorg-input-evdev).

* README tells the detail.
* homepage. You can get the source tarball and git access instruction.

News for 2.10.6 (Mar 2020)
* Kernel >= 5.4 bug workaround. This bug was fixed in the kernels 5.6, 5.5.14 and 5.4.29.
* Merges the upstream 2.10.6.

Installation
I'm not a debian user. Please help yourself. The post below by Yuri Khan may help. His Ubuntu PPA is not maintained any more.

Old, manual installation guide. (Kept here for record, but links are dead.)
The strategy is: Rip the source package debian/ directory from the squeeze version, fix it, and apply to my source.

1. Download the upstream source tarball, get my fork patch, and prepare debian/{rules,changelog}.

2. Do some apt-get:
$ cd somewhere-to-run-debuild
$ apt-get build-dep xserver-xorg-input-evdev
$ apt-get apt-get source xserver-xorg-input-evdev

3. Extract files, apply the patch, and build
$ cd at-home-modifier
$ cp -r ../xserver-xorg-input-evdev-<x.y.z>/debian ./
$ patch -p1 < ahm-<x.y.z>.patch
$ debuild
$ dpkg -i <generated deb file>

Notice
When you upgrade the xorg-server, you have to rebuild this hack, too, or your keyboards and mice won't work! More precisely, for xorg-server-x.y.z, a change in z doesn't affect, but x or y does. (In debian, it seems to be called xserver-xorg-core-2:x.y.z-rel.)

Configuration
Modify 80-ahm.conf in the package, and put it under /etc/X11/xorg.conf.d/. Config options are described in README. (Make sure the evdev driver is used. Today the default keyboard driver is libinput.)

FAQ
Q: Can I input Shift+Space if my Space is Space/Shift dual-role key?
A: Turn both of your Space and Shift into Space/Shift keys.

If you know how it can be automated with git-buildpackage, please tell me.

Contact
Read README.

Notice
Probably I don't develop any more this hack as a fork of xf86-input-evdev. It's better to do all in user space, rather than as an X driver.

With best regards.
Last edited by teika on 2023-05-30 11:39, edited 18 times in total.

teika
Posts: 31
Joined: 2011-06-25 06:15

at-home-modifier-2.6.3 is released.

#2 Post by teika »

Hi. at-home-modifier-2.6.3 is released. Changes since the last post (2.6.0) are:

* Fast type fix
Users of this hack often have “tongue-twister of finger”: Suppose you want “ x”. If you press space/shift, press x, and release space/shift (before releasing x), you’ll get an upper-case X instead.
Fixes of this kind are attempted with new “AhmDelay” and “AhmFreezeTT” options.

* Cancellation by timeout
Suppose you were about to input shift + A and pressed space/shift, but you changed your mind. If you release the space/shift key, you’ll receive one space, but it’s not what you want!
This can be fixed by long enough press now.

* Reset
When something is wrong, leave the keyboard untouched for 10 secs. Then all are reset to the initial state.

* Gtk widget double press issue.
To push a gtk button, sometimes you had to press space/shift key twice, but this is fixed. If it doesn’t work out-of-box, set “AhmPaddingInterval” option. (This “bug” is not the author’s fault, but what’s bad for users are bugs.=)

For full changes, read README, "News" section:
http://gitorious.org/at-home-modifier/a ... ter/README

With best regards.

Homepage: http://gitorious.org/at-home-modifier/pages/Home
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#3 Post by teika »

Hi there. I've added installation instruction for squeeze. See the first post.
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#4 Post by teika »

You could help yourself:
teika wrote:* Reset
[...]all are reset to the initial state.
More is already available:
teika wrote:For full changes, read README[...]
From README:
*** Reset ***
Sometimes transmods get frozen (See "Switching VT" section below)
[...] Reset is implemented by sending release events to all translated
modifiers
[...]
* Switching VT: If your Ctrl is a transmod key, when you switch from X
to virtual console with Ctrl + Alt + F1, and switch back to X with Alt
+ F1, Ctrl get frozen. This is mitigated with "reset" feature.

It happens because Ctrl is pressed at the first switching, but the
release is only sent to the VT, not to X, in particular to this driver.
Now I reveal you a secret: when a developer introduces a new feature, there's a reason to do so, and when they release, they are satisfied, at least fairly.

In fact, I improved README a bit after your question. =)

Thank you for your interest. Cheers.

# BTW I've noticed that you can buy Japanese keyboards from say amazon.com. This hack works better with Japanese keyboards (read README), so when you need a new keyboard, consider buying one.
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#5 Post by teika »

Hi. at-home-modifier-2.6.4 is released. It has one minor fix, "mouse support":
When you press space/shift and a mouse button, the result used to be shift + click, ok, but also followed by an extra, unwanted space, as if the click hadn't happened. It's because each device ignored others. Now it's fixed, as long as the mouse is also handled by evdev driver. (Notebook touchpads are dealt by synaptics driver, so it's not fixed, and won't be fixed. Use AhmTimeout option as a workaround.)

For building, read the first message in the thread.

If you find the news or README difficult to understand, then feel free to ask.
<quote>"What's inconvenient is a bug." - Teika kazura</unquote>

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#6 Post by teika »

I forgot to tell you that when you upgrade the xorg-server, you have to rebuild this hack, too, or your keyboards and mice won't work! More precisely, for xorg-server-x.y.z, a change in z doesn't affect, but x or y does. (In debian, it seems to be called xserver-xorg-core-2:x.y.z-rel.)
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#7 Post by teika »

Hi. Ubuntu PPA for this hack is contributed by Yuri Khan. (Thanks!) I don't give general instruction and caution on PPA here. Use it at your own risk, but the source package may be nice; at least looking into debian/ directory will help.

Yuri Khan
Posts: 1
Joined: 2012-01-14 16:46

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#8 Post by Yuri Khan »

Oh, I don’t think my package will be of use for Debian users, ‘cause I started with an Ubuntu package that takes the original evdev tarball and applies Ubuntu-specific patches over it. But I can detail here what I did in case someone wants to do the same for Debian (does Debian have an equivalent of Ubuntu PPA?):
  • $ apt-get source xserver-xorg-input-evdev
  • $ cd xserver-xorg-input-evdev-2.6.0
  • $ debian/rules patch
  • $ quilt new 201-at_home_modifier.patch
  • $ quilt add README README.orig src/evdev.c src/evdev.h
  • manually apply the patch from http://gitorious.org/at-home-modifier/d ... ster/patch (because, with an Ubuntu-specific 100-xi2.1.patch applied, ahm’s patch applies incorrectly; on Debian, your mileage may vary)
  • $ quilt refresh
  • $ debian/rules unpatch
  • $ dch -i
  • update and save the changelog
  • $ debuild -S -sd
  • upload the newly built source package to PPA

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#9 Post by teika »

I've found an alternative, Space2Ctrl, by Victor Moreira.

* s2c works in the user space, while ahm (=at-home-modifier) is the fork of an X input driver.
* s2c uses "X Record Extension" to detect events. I haven't given a try yet, but it probably stands between the X server and clients (or Xlib).
*** This (probably) means it can't coexist with other softwares which use Record Extension, e.g. AutoKey or xnee.
* s2c doesn't require much updates; ahm has to keep up with the upstream (= X).
* s2c is written in C++. (I don't understand C++. :P)
* The s2c code is slim; it's easier for users to hack.
*** Ahm is a fork, so the distinction of the genuine ahm part and the original X code is not clear.
* s2c is rudimentary. The sole keycode pair is hard-coded, and has no option. According to the author (in private correspondence), "more of a personal hack, very poorly tested and documented."

Read the git commit log to know the author's email address. He said he'd like more users, so sending patches may be welcome.

News: Ahm development hasn't seen any progress after the 2.6.4 release.

Thank you very much, Yuri Khan for the detailed explanation.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#10 Post by teika »

An implementation in C, "keydouble" is developed by "baskerville" aka "bloom" in the ArchLinux forum. See the web site hosted at github. You may find the news at the Arch forum thread.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#11 Post by teika »

Hi, folks. Not a news of ahm update, but of a good keyboard.

keyboard glossary:
https://en.wikipedia.org/wiki/Keyboard_technology
http://www.overclock.net/t/491752/mecha ... oard-guide

I recommend Japanese keyboards for at-home-modifier, because you can press many keys with thumbs. Image here:
https://en.wikipedia.org/wiki/File:KB_Japanese.svg

The bottom row of my keyboard is:
Esc-BS-Spc-Ret-Tab and
Alt-Shift-Ctrl-Shift-Alt
(The middle one is the space bar.) as described in the README of ahm. Japanese keyboards enable such stunt which is really comfy.

I use a membrane keyboard, whose touch is bad for your finger. There hasn't been good keyboards with enough many thumb keys.

Recently a new keyboard with "cherry mx brown switch", OWL-KB109BM(B)IIB, came out:
http://www.owltech.co.jp/products/keybo ... _B_II.html (Japanese)
You can buy one from amozon.co.jp, at 8000 yen or so (roughly equal to $100; these days yen is high.). They offer an English interface, too. I dislike google/apple/amazon monopoly, though. (Who likes?)
There's also "cherry mx blue" one, OWL-KB109BM(B)II, too. They say blue is noisy.

There's already many other cherry switch or capacitive switch Japanese keyboards, but they have a long space bar, which doesn't suit my purpose.

I haven't bought yet. Not cheap, but interesting. Night night.

teika
Posts: 31
Joined: 2011-06-25 06:15

ahm-2.7.1 released.

#12 Post by teika »

At-home-modifier-2.7.1 is released. (Called whimsically 2.7.1, not 2.7.0.) It merges the upstream 2.7.0, but has no changes in ahm since 2.6.4.

The Xorg's 2.7.0 has mulitouch support. If you want it, you need Xorg server >= 1.11.99.901 and "mtdev" library.

Modifications from the upstream 2.7.0 are:
* An upstream bugfix of horizontal scroll, X.Org Bug 46205, is included. (The fix is published after the 2.7.0 release.)
* Added an option to configure script "--without-mtdev". The upstream code always checks mtdev, and enables it when found. If you don't pass the above option, it falls back to the original behavior.

Read README for the details.

* Source tarball
* Patch against Xorg's original 2.7.0

I don't write Debian support for 2.7.1.

Notice
Probably I don't develop any more this hack as a fork of xf86-input-evdev. It's better to do all in user space, not as an X driver. (And personally I'm terribly weakened.)

If you want some progress, improve "Keydouble" or so. I'm also interested in a rewrite in Python, which will be easier to allow flexible configuration. (In reality I don't think I'll ever write one.) It'll be great if it's integrated to AutoKey, but the AutoKey developer is not interested.

To make these hacks more popular, you can upvote my answer here to a question on Emacs Pinky in StackOverflow.

Regards.

User avatar
debil
Posts: 1336
Joined: 2008-05-11 08:55
Location: Mazes of Menace, surrounded by brown puddings

Re: ahm-2.7.1 released.

#13 Post by debil »

teika wrote:Notice
Probably I don't develop any more this hack as a fork of xf86-input-evdev. It's better to do all in user space, not as an X driver. (And personally I'm terribly weakened.)
I agree, if this (ahm) was a user space app, I would've tested it (haven't been in the mood for compiling X). Anyway, cheers for the contribution, us heavy keyboard users appreciate greatly.
Q: Why is the Eunux kernel so bloated?
A: It was made in the image of its founder.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#14 Post by teika »

Hi. At-home-modifier-2.7.3 is released. It merges the upstream 2.7.3, but has no changes in ahm itself since the last release, 2.7.1.

Sources:
* The full source tarball
* The patch against Xorg's original 2.7.3

I don't write Debian support for 2.7.3. Please share yours.

Regards.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#15 Post by teika »

There's another alternative, xcape by Albin Olsson. It replaces keydouble and space2ctrl.

It's not in Debian/Ubuntu. See the homepage for how to compile.
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

teika
Posts: 31
Joined: 2011-06-25 06:15

ahm-2.8.0 is released.

#16 Post by teika »

Hi. I release at-home-modifier-2.8.0. It merges the upstream 2.8.0, but has no changes in ahm itself since the last release, ahm-2.7.3. Those with new devices may want to use it. Don't worry, the dependency is the same as upstream-2.7.0, wheezy's version.

* Upstream news for 2.8.0

Sources:
* The full source tarball
* The patch against Xorg's original 2.8.0

I don't write a Debian support for 2.8.0. Please consult 2.6.3 support or PPA by Yuri Khan.
Please share yours.

Regards.

teika
Posts: 31
Joined: 2011-06-25 06:15

ahm-2.10.1 released & ahm is 5 years old.

#17 Post by teika »

Hi. Ahm-2.10.1 is released now. It's simply a merge of upstream-2.10.1, and ahm itself hasn't changed. It depends on xorg-server >= 1.18. [1] Please see the first post of the thread for the installation info. (Ubuntu PPA for 2.9.0 is provided by Yuri Khan. Thanks to Yuri.)

[1] You can use older versions of xorg-server, but in that case, you have to resolve a file collision manually.

I noticed that ahm has just turned 5 years old. The initial commit of the ahm patch was on 29 Jan 2011.

Regards.

Off-topic: the current Japanese government doesn't like freedom of speech, suggesting stopping "biased" TV stations, i.e. those that the ruling party doesn't like.[2] As a Japanese, it's a shame, and I've got repeatedly sick of 'em, who've got childish mind and brain. As for governments, Japan is resembling N/S Korea, China, Turkey, or Russia. (Please distinguish residents and their governments.)

(Please don't expand this issue here. Use, say the Gentoo "off the wall" forum instead. Sorry for showing anger which is irrelevant to many of you.)

[2] tl;dr: [1] [2] [3] Maybe this blog post or else helps.

# Oops I deleted the last post, the ahm-2.9.2 release notice in Apr 2015. :P

teika
Posts: 31
Joined: 2011-06-25 06:15

ahm-2.10.3 released.

#18 Post by teika »

Hi. Ahm-2.10.3 is released now. It's simply a merge of upstream-2.10.3, and ahm itself hasn't changed. Please see the first post of the thread for the installation info.

Ubuntu PPA for 2.10.2 is already provided by Yuri Khan. (Thanks.) 2.10.3 has only one change, a bug fix, since 2.10.2.
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#19 Post by teika »

For a Wayland replacement of my hack, you may find this post in the Archlinux BBS to be useful.

The upstream development of the evdev input driver seems to have almost stopped. (Only 3 commits in 2017.) It does not mean it's unusable. Keyboard is a mature device, so I think my hack remains to work for a coming few years. Of course earlier transition to the libinput driver makes the life less risky.

Regards
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

teika
Posts: 31
Joined: 2011-06-25 06:15

Re: Easy shift / ctrl / AltGr ... hack on xf86-input-evdev

#20 Post by teika »

Hi. "Cancellation by Long Press" is broken in some environments. Before an official release, I posted a fix patch in the Arch BBS.
Easy Shift / Ctrl / AltGr ... hack; save your pinkies, type without drudgery.

Post Reply