oblitum / caps2esc

Transforming the most useless key ever in the most useful one
GNU General Public License v3.0
164 stars 37 forks source link

Configurable to allow Caps to be mapped to other things #4

Open jasonm23 opened 7 years ago

jasonm23 commented 7 years ago

It would be nice if we could map Caps to be other things too.

Obviously this may be beyond your intended scope as these mappings already satisfy a common Vim use case (especially when migrating from Karabiner/OS X)

Anyway I thought I would ask the question before deciding to fork or not.

Thanks for building this.

oblitum commented 7 years ago

As I've commented here, I'm working on a more general tool where caps2esc will be just an special case. I'll leave this open until I finish the other tool.

For your information, it's gonna be more or less like this:

intercept -g $DEVICE | caps2esc | other_mapping | uinput -d $DEVICE

intercept will be a tool to capture input from a given $DEVICE (grabbing it or not through the -g flag) and output it to stdout. caps2esc and other_mapping will be responsible solely for reading input events from stdin and outputting mutated events (or not) to stdout. uinput will be a tool to capture events from stdin and emulating them through a virtual device which can be constructed based on existing ones (-d flag) or through configuration files.

interception will be another tool that will accept a configuration file and will just monitor devices and execute any command when a given attached device matches the configuration. And any command can be one like the one above.

Ran4 commented 7 years ago

I personally really like that caps2esc does one thing, and one thing only. Any other tools would be cool, of course, but caps2esc staying the same would be nice.

oblitum commented 7 years ago

@Ran4 I agree. When I go about publishing the general tool I will provide an alternative caps2esc while this one will still live on its own.

dragon788 commented 7 years ago

I look forward to your new tool, I'm finding that it grabbing all the xinput items without a filter is conflicting with the xinput-toggle utility that I need for another purpose.

oblitum commented 6 years ago

@dragon788 caps2esc is now superseded by this more general project https://gitlab.com/interception/linux/tools, you can use it already to filter specific devices by name or other characteristics. A more generalized caps2escplugin regarding key configurations will come later.

silenc3r commented 6 years ago

I like caps2esc being simple but I would prefer to have Esc work as Esc and have CapsLock toggle on Ctrl. It looks like simple tweak but sadly I don't know C.

Edit: Nevermind, changing line 88 to

if (output[0].code == KEY_LEFTCTRL)

did the trick. C ain't that hard ;).