gromit-mpx icon indicating copy to clipboard operation
gromit-mpx copied to clipboard

HOTKEY & UNDOKEY F13-F24 key support

Open nose-gnome opened this issue 3 years ago • 11 comments
trafficstars

If you'd like to put out an incentive for implementing this feature, you can do so at https://issuehunt.io/r/bk138/gromit-mpx

Is your feature request related to a problem? Please describe.

I am using a Corsair keyboard that has macro keys "G keys" and if I was able to set gromit-mpx's HOTKEY & UNDOKEY to use the function keys in range F13-F24, it would allow me to have one of the G keys as F18 and another as F19, freeing the normal function keys.

Describe the solution you'd like

Allow setting the HOTKEY & UNDOKEY in config to accept the functions keys in the range of F13-F24.

Describe alternatives you've considered

If I try to set HOTKEY to F19 in gromit-mpx.cfg for example, gromit-mpx fails to start

nose-gnome avatar May 16 '22 13:05 nose-gnome

Please start from a Terminal with the -d option and post the output here.

bk138 avatar May 16 '22 13:05 bk138

Please start from a Terminal with the -d option and post the output here.

❯ flatpak run net.christianbeier.Gromit-MPX -d
Gtk-Message: 14:57:20.343: Failed to load module "canberra-gtk-module"
Gtk-Message: 14:57:20.343: Failed to load module "canberra-gtk-module"
Using user config /home/blyth/.var/app/net.christianbeier.Gromit-MPX/config/gromit-mpx.cfg
Tool name: "Eraser|@0           ": Eraser,  width:  75, minwidth:   1, arrowsize: 0.00, color: rgb(255,0,0)
Tool name: "Wacom Intuos3 6x8 Pen cursor|@0": Pen,     width:   7, minwidth:   1, arrowsize: 0.00, color: rgb(255,0,0)
Tool name: "red Pen|@0          ": Pen,     width:   7, minwidth:   1, arrowsize: 0.00, color: rgb(255,0,0)
Tool name: "Wacom Intuos3 6x8 Pen eraser|@0": Eraser,  width:  75, minwidth:   1, arrowsize: 0.00, color: rgb(255,0,0)
cannot find the key "F19"

nose-gnome avatar May 16 '22 13:05 nose-gnome

Also, here is my gromit-mpx.cfg file:

"Eraser" = ERASER (size = 75);
"red Pen" = PEN (size=7 color="red");

"Wacom Intuos3 6x8 Pen cursor" = "red Pen";
"Wacom Intuos3 6x8 Pen eraser" = "Eraser";

HOTKEY = "F19";
UNDOKEY = "F18";

nose-gnome avatar May 16 '22 14:05 nose-gnome

Thanks for the swift reply! That happens here: https://github.com/bk138/gromit-mpx/blob/master/src/main.c#L699 - so this seems to be a GDK issue. You might be able to create a minimal proof-of-concept and maybe report over at GDK.

OTOH, the key seems to be defined in GDK, if you follow https://code.woboq.org/gtk/gtk/gdk/gdkkeys.c.html

bk138 avatar May 16 '22 14:05 bk138

Thanks for the swift reply! That happens here: https://github.com/bk138/gromit-mpx/blob/master/src/main.c#L699 - so this seems to be a GDK issue. You might be able to create a minimal proof-of-concept and maybe report over at GDK.

OTOH, the key seems to be defined in GDK, if you follow https://code.woboq.org/gtk/gtk/gdk/gdkkeys.c.html

Okay, thank you for your response. That's strange that GDK doesn't seem to work with F13-F24, despite the fact that it defines them. I'll have a look to see if I can figure anything out

nose-gnome avatar May 16 '22 15:05 nose-gnome

I don't know if this is relevant, but when I ran xev to see the key values of the keys typed and pressed F9 followed by F19, I noticed that for the Function keys in the range of F1-F12, that it would have an actual keysym (F9's being 0xffc6 and show the name of the key. Whereas, the keys above F12 had a keysym of 0x0 and said NoSymbol instead of saying the name of the pressed key.

The result from pressing F9:

KeyPress event, serial 34, synthetic NO, window 0x9400001,
    root 0x1e5, subw 0x0, time 19376310, (-762,172), root:(1398,1500),
    state 0x0, keycode 75 (keysym 0xffc6, F9), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x9400001,
    root 0x1e5, subw 0x0, time 19376388, (-762,172), root:(1398,1500),
    state 0x0, keycode 75 (keysym 0xffc6, F9), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Result from pressing F19:

KeyRelease event, serial 37, synthetic NO, window 0x9400001,
    root 0x1e5, subw 0x0, time 18798569, (772,306), root:(1022,1617),
    state 0x0, keycode 75 (keysym 0xffc6, F9), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x9400001,
    root 0x1e5, subw 0x0, time 18800308, (772,306), root:(1022,1617),
    state 0x0, keycode 197 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

nose-gnome avatar May 16 '22 16:05 nose-gnome

What's more:

grep F9 /usr/include/X11/keysymdef.h
#define XK_F9                            0xffc6

and

grep F19 /usr/include/X11/keysymdef.h
#define XK_F19                           0xffd0

So I would argue that xev should show 0xffd0, right? Btw, is there a typo in your snippet about F19 as it says F9 in the first stanza?

bk138 avatar May 16 '22 17:05 bk138

What's more:

grep F9 /usr/include/X11/keysymdef.h
#define XK_F9                            0xffc6

and

grep F19 /usr/include/X11/keysymdef.h
#define XK_F19                           0xffd0

So I would argue that xev should show 0xffd0, right? Btw, is there a typo in your snippet about F19 as it says F9 in the first stanza?

Oh yes sorry, I accidentally copied part of the wrong text for the F19 output. Here is the correct output from F19:

KeyPress event, serial 34, synthetic NO, window 0x8e00001,
    root 0x1e5, subw 0x0, time 25242345, (337,398), root:(2502,1731),
    state 0x10, keycode 197 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x8e00001,
    root 0x1e5, subw 0x0, time 25242398, (337,398), root:(2502,1731),
    state 0x10, keycode 197 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Also, I agree, xev should be showing 0xffd0. I don't know why it is not

nose-gnome avatar May 16 '22 18:05 nose-gnome

I just tried using evtest instead of xev, which gave me a different keycode for both F9 & F19. It was also able to show the name F19.

Outputs of sudo evtest

Event: time 1652725422.005078, type 1 (EV_KEY), code 96 (KEY_KPENTER), value 0
Event: time 1652725422.005078, -------------- SYN_REPORT ------------
Event: time 1652725424.871109, type 1 (EV_KEY), code 67 (KEY_F9), value 1
Event: time 1652725424.871109, -------------- SYN_REPORT ------------
Event: time 1652725424.974102, type 1 (EV_KEY), code 67 (KEY_F9), value 0
Event: time 1652725424.974102, -------------- SYN_REPORT ------------
Event: time 1652725425.287110, type 1 (EV_KEY), code 189 (KEY_F19), value 1
Event: time 1652725425.287110, -------------- SYN_REPORT ------------
Event: time 1652725425.363265, type 1 (EV_KEY), code 189 (KEY_F19), value 0

nose-gnome avatar May 16 '22 18:05 nose-gnome

That hints at the X11 layer...

bk138 avatar May 16 '22 20:05 bk138

@nose-gnome how do we proceed here - anything worth doing for the Gromit-MPX codebase?

bk138 avatar May 21 '22 18:05 bk138

Tentatively closing, please post new info here once available.

bk138 avatar Sep 06 '23 19:09 bk138