g13 icon indicating copy to clipboard operation
g13 copied to clipboard

Support for modifiers

Open cameri opened this issue 8 years ago • 6 comments

Can we have support for modifiers such as shift, ctrl and alt?

We could then bind combinations like SHIFT+F1 or CTRL+F3.

cameri avatar Dec 09 '15 20:12 cameri

It should be possible. You can bind a shift key and a regular key to two different G-keys and that works, so there aren't any obvious weird shift state issues. However, the mechanism for mapping would need to be enhanced. As it happens, I've already been working on that, with the goal of being able to map keys to more complex actions (multiple keystrokes, macros, python scripts, ...). Adding support for modifiers should be fairly simple.

james-fowler avatar Dec 09 '15 20:12 james-fowler

Still fairly primitive, but functional : added an "mbind" command, similar to bind, so you can say

mbind G16 KEY_LEFTSHIFT+KEY_F1

The mbind command is probably temporary - I'll probably just roll the functionality into bind once it's tested a bit. Code is at [https://github.com/james-fowler/g13]

james-fowler avatar Dec 09 '15 21:12 james-fowler

Awesome! I'll be testing it over the weekend :+1:

cameri avatar Dec 11 '15 02:12 cameri

Great, let me know how it works for you. Just to be fair, there is another option : Paul Healy implemented similar support for modifiers, you can find more about it at https://github.com/ecraven/g13/pull/11 . I probably should have used his as a starting point, but I didn't notice it so I ended up duplicating effort. That said, I've also implemented some additional stuff like writing text to the LCD and maintaining multiple keymapping profiles. Sometime soon I'll add support for mapping the G keys to more than just sending keystrokes, like sending signals out a pipe/socket, changing profiles, etc... might even add an option to run python scripts directly, although I'm not sure that's a great idea (writing out to a pipe/socket, combined with reading from /tmp/g13-0, makes it possible to do really cool python scripts with the G13, without the overhead and complexity of embedding a python interpreter in g13d...)

james-fowler avatar Dec 11 '15 04:12 james-fowler

Did you get a chance to test it (https://github.com/james-fowler/g13) yet?

james-fowler avatar Dec 15 '15 15:12 james-fowler

Thanks for the heads up.

I just tried it and so far it works! I am playing Tibia at the moment and the hotkeys work just fine. The keys show fine in xev (X events).

And good job refactoring everything into classes by the way :)

Do you have a list of features you'd like to have?

On Tue, Dec 15, 2015 at 11:38 AM, James Fowler [email protected] wrote:

Did you get a chance to test it (https://github.com/james-fowler/g13) yet?

— Reply to this email directly or view it on GitHub https://github.com/ecraven/g13/issues/13#issuecomment-164801140.

cameri avatar Dec 15 '15 16:12 cameri