rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.24k stars 212 forks source link

HP omen macro keys #818

Open Hiperborea-Ro opened 11 months ago

Hiperborea-Ro commented 11 months ago

Hello is there a way to mapp macro keys on an HP Omen laptop? Thank you.

RedBearAK commented 11 months ago

@Hiperborea-Ro

Are you using Windows, or Linux? There are very different versions of Kinto for the two platforms.

If Linux, which distro and desktop environment?

What are you wanting the macros to do?

Hiperborea-Ro commented 11 months ago

I use linux Arch linux with kde desktop.Will be some thing if I could use them as desktop switches or atleast make them work on....

On Wed, 19 Jul 2023, 00:34 RedBearAK, @.***> wrote:

@Hiperborea-Ro https://github.com/Hiperborea-Ro

Are you using Windows, or Linux? There are very different versions of Kinto for the two platforms.

If Linux, which distro and desktop environment?

What are you wanting the macros to do?

— Reply to this email directly, view it on GitHub https://github.com/rbreaves/kinto/issues/818#issuecomment-1641025807, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJUI6WZSRXQC64BBFHLYD3XQ36PBANCNFSM6AAAAAA2O4AEVA . You are receiving this because you were mentioned.Message ID: @.***>

RedBearAK commented 11 months ago

@Hiperborea-Ro

One of the first things you'll need to figure out is the key codes for those keys, so that you can remap them to macros in the Kinto config file.

Make sure the evtest command is installed on your system. Run the command and select your keyboard device from the list. Press the macro keys and copy the output you see from pressing those keys into a text file.

You have to stop Kinto before you can use the evtest command, so that it can connect to the uinput device.

A macro in xkeysnail looks like this:

# Open preferences in browsers
define_keymap(re.compile("^Firefox$", re.IGNORECASE),{
    K("C-comma"): [
        K("C-T"),K("a"),K("b"),K("o"),K("u"),K("t"),
        K("Shift-SEMICOLON"),K("p"),K("r"),K("e"),K("f"),
        K("e"),K("r"),K("e"),K("n"),K("c"),K("e"),K("s"),K("Enter")
    ],
    K("RC-Shift-N"):    K("RC-Shift-P"),        # Open private window with Ctrl+Shift+N like other browsers
})

The line in this Firefox keymap that looks for Ctrl+comma remaps to a Python list (the square brackets) that types out the sequence of keys to open a new tab in Firefox and type "about:preferences" and hit Enter.

K("Some_Key"): [K("a"), K("B"), K("C"), K("Enter")],

This would type out "ABC" and hit Enter when you press a key that has the key code name "Some_Key" (which doesn't exist in the key definition file for the keymapper, this is just an example).

You'd want to remap the key code you see from the key press of a macro key to whatever keys and shortcuts you need to perform your desired action. Note that you don't need the list (brackets) if you are just doing a single shortcut combo. The list format is only necessary if you want to perform more than a single keystroke or shortcut combo.

But if you want it to do anything besides just type keys and normal shortcut combos, like mouse clicks, that's not something the keymapper can do in the Linux version of Kinto.

Put your remap in the keymap that begins with these lines, if you want it to work in all application windows:

# None referenced here originally
# - but remote clients and VM software ought to be set here
# These are the typical remaps for ALL GUI based apps
define_keymap(lambda wm_class: wm_class.casefold() not in remotes,{
    K("RC-Shift-Left_Brace"):   K("C-Page_Up"),         # Tab nav: Go to prior (left) tab
    K("RC-Shift-Right_Brace"):  K("C-Page_Down"),       # Tab nav: Go to next (right) tab
...
Hiperborea-Ro commented 11 months ago

Aint working,they dont send any signal same for omen special key or the FN one.

On Wed, 19 Jul 2023 at 14:38, RedBearAK @.***> wrote:

@Hiperborea-Ro https://github.com/Hiperborea-Ro

One of the first things you'll need to figure out is the key codes for those keys, so that you can remap them to macros in the Kinto config file.

Make sure the evtest command is installed on your system. Run the command and select your keyboard device from the list. Press the macro keys and copy the output you see from pressing those keys into a text file.

You have to stop Kinto before you can use the evtest command, so that it can connect to the uinput device.

A macro in xkeysnail looks like this:

Open preferences in browsersdefine_keymap(re.compile("^Firefox$", re.IGNORECASE),{

K("C-comma"): [
    K("C-T"),K("a"),K("b"),K("o"),K("u"),K("t"),
    K("Shift-SEMICOLON"),K("p"),K("r"),K("e"),K("f"),
    K("e"),K("r"),K("e"),K("n"),K("c"),K("e"),K("s"),K("Enter")
],
K("RC-Shift-N"):    K("RC-Shift-P"),        # Open private window with Ctrl+Shift+N like other browsers

})

The line in this Firefox keymap that looks for Ctrl+comma remaps to a Python list (the square brackets) that types out the sequence of keys to open a new tab in Firefox and type "about:preferences" and hit Enter.

K("Some_Key"): [K("a"), K("B"), K("C"), K("Enter")],

This would type out "ABC" and hit Enter when you press a key that has the key code name "Some_Key" (which doesn't exist in the key definition file for the keymapper, this is just an example).

You'd want to remap the key code you see from the key press of a macro key to whatever keys and shortcuts you need to perform your desired action. Note that you don't need the list (brackets) if you are just doing a single shortcut combo. The list format is only necessary if you want to perform more than a single keystroke or shortcut combo.

But if you want it to do anything besides just type keys and normal shortcut combos, like mouse clicks, that's not something the keymapper can do in the Linux version of Kinto.

Put your remap in the keymap that begins with these lines, if you want it to work in all application windows:

None referenced here originally# - but remote clients and VM software ought to be set here# These are the typical remaps for ALL GUI based appsdefine_keymap(lambda wm_class: wm_class.casefold() not in remotes,{

K("RC-Shift-Left_Brace"):   K("C-Page_Up"),         # Tab nav: Go to prior (left) tab
K("RC-Shift-Right_Brace"):  K("C-Page_Down"),       # Tab nav: Go to next (right) tab

...

— Reply to this email directly, view it on GitHub https://github.com/rbreaves/kinto/issues/818#issuecomment-1641923106, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJUI6XHQ2MDUYZYZFFEPMTXQ7BJ3ANCNFSM6AAAAAA2O4AEVA . You are receiving this because you were mentioned.Message ID: @.***>

RedBearAK commented 11 months ago

@Hiperborea-Ro

Aint working,they dont send any signal same for omen special key or the FN

Yeah, I wondered about that. If they were just something convenient like F18-F24, they probably would have been labeled that way.

The Fn key on most PC keyboards (unlike Apple keyboards) doesn't send a detectable (by evdev) key event, so the keymapper can't use it. If the "special" key and the macro keys on the Omen also don't have detectable key events in evtest, you won't be able to use those keys for anything in Linux.

Sounds like it's really a hardware-based thing, and you need the special Windows software to make it work. Unless someone has made a software utility for Linux that does what the Windows utility does. You might search for something like that.

RedBearAK commented 11 months ago

@Hiperborea-Ro

BTW, I am not the Kinto dev, just a long-time user and contributor. Also, if you only interact with this forum by email, you may miss important edits that people make to their responses. It's best to use the "view on GitHub" link at the bottom of the email to open issues in a browser, rather than reply by email.

Hiperborea-Ro commented 11 months ago

No clue where to find it :-/

On Wed, 19 Jul 2023 at 23:09, RedBearAK @.***> wrote:

@Hiperborea-Ro https://github.com/Hiperborea-Ro

BTW, I am not the Kinto dev, just a long-time user and contributor. Also, if you only interact with this forum by email, you may miss important edits that people make to their responses. It's best to use the "view on GitHub" link at the bottom of the email to open issues in a browser, rather than reply by email.

— Reply to this email directly, view it on GitHub https://github.com/rbreaves/kinto/issues/818#issuecomment-1642687227, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJUI6RLQ4ZZ5FIUEYE24CLXRA5GTANCNFSM6AAAAAA2O4AEVA . You are receiving this because you were mentioned.Message ID: @.***>

RedBearAK commented 11 months ago

@Hiperborea-Ro

You don't see this text and link at the bottom of each email you receive?

Reply to this email directly, view it on GitHub <#818 (comment)>,

RedBearAK commented 11 months ago

@Hiperborea-Ro

This project might be able to give you usable key code events from the macro keys, which you should then be able to remap in the Kinto config file. But this is otherwise unrelated to Kinto.

https://github.com/pelrun/hp-omen-linux-module

Hiperborea-Ro commented 11 months ago

Indeed,but still don't know how to get those key to give a signal..

On Thu, 20 Jul 2023, 13:57 RedBearAK, @.***> wrote:

@Hiperborea-Ro https://github.com/Hiperborea-Ro

This project might be able to give you usable key code events from the macro keys, which you should then be able to remap in the Kinto config file. But this is otherwise unrelated to Kinto.

https://github.com/pelrun/hp-omen-linux-module

— Reply to this email directly, view it on GitHub https://github.com/rbreaves/kinto/issues/818#issuecomment-1643712138, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJUI6XKNDFJBBDZQQ5CK5TXREFJ5ANCNFSM6AAAAAA2O4AEVA . You are receiving this because you were mentioned.Message ID: @.***>

RedBearAK commented 11 months ago

Key events should be from this code, but I’m not sure which would be the macro keys.

static const struct key_entry hp_wmi_keymap[] = {
  { KE_KEY, 0x02,   { KEY_BRIGHTNESSUP } },
  { KE_KEY, 0x03,   { KEY_BRIGHTNESSDOWN } },
  { KE_KEY, 0x20e6, { KEY_PROG1 } },
  { KE_KEY, 0x20e8, { KEY_MEDIA } },
  { KE_KEY, 0x2142, { KEY_MEDIA } },
  { KE_KEY, 0x213b, { KEY_INFO } },
  { KE_KEY, 0x2169, { KEY_ROTATE_DISPLAY } },
  { KE_KEY, 0x216a, { KEY_SETUP } },
  { KE_KEY, 0x231b, { KEY_HELP } },
  { KE_KEY, 0x21A4, { KEY_F14 } }, // Winlock hotkey
  { KE_KEY, 0x21A5, { KEY_F15 } }, // Omen key
  { KE_KEY, 0x21A7, { KEY_F16 } }, // ???
  { KE_KEY, 0x21A9, { KEY_F17 } }, // Disable touchpad hotkey
  { KE_END, 0 }
};

Probably these.

  { KE_KEY, 0x20e6, { KEY_PROG1 } },
  { KE_KEY, 0x20e8, { KEY_MEDIA } },
  { KE_KEY, 0x2142, { KEY_MEDIA } },
  { KE_KEY, 0x213b, { KEY_INFO } },
  { KE_KEY, 0x2169, { KEY_ROTATE_DISPLAY } },
  { KE_KEY, 0x216a, { KEY_SETUP } },
  { KE_KEY, 0x231b, { KEY_HELP } },

You’ll have to ask in the issues for that project if you can’t get it working.

Hiperborea-Ro commented 11 months ago

Thanks, I'll check them out.

On Thu, 20 Jul 2023, 14:56 RedBearAK, @.***> wrote:

Key events should be from this code, but I’m not sure which would be the macro keys.

static const struct key_entry hp_wmi_keymap[] = { { KE_KEY, 0x02, { KEY_BRIGHTNESSUP } }, { KE_KEY, 0x03, { KEY_BRIGHTNESSDOWN } }, { KE_KEY, 0x20e6, { KEY_PROG1 } }, { KE_KEY, 0x20e8, { KEY_MEDIA } }, { KE_KEY, 0x2142, { KEY_MEDIA } }, { KE_KEY, 0x213b, { KEY_INFO } }, { KE_KEY, 0x2169, { KEY_ROTATE_DISPLAY } }, { KE_KEY, 0x216a, { KEY_SETUP } }, { KE_KEY, 0x231b, { KEY_HELP } }, { KE_KEY, 0x21A4, { KEY_F14 } }, // Winlock hotkey { KE_KEY, 0x21A5, { KEY_F15 } }, // Omen key { KE_KEY, 0x21A7, { KEY_F16 } }, // ??? { KE_KEY, 0x21A9, { KEY_F17 } }, // Disable touchpad hotkey { KE_END, 0 } };

Probably these.

{ KE_KEY, 0x20e6, { KEY_PROG1 } }, { KE_KEY, 0x20e8, { KEY_MEDIA } }, { KE_KEY, 0x2142, { KEY_MEDIA } }, { KE_KEY, 0x213b, { KEY_INFO } }, { KE_KEY, 0x2169, { KEY_ROTATE_DISPLAY } }, { KE_KEY, 0x216a, { KEY_SETUP } }, { KE_KEY, 0x231b, { KEY_HELP } },

You’ll have to ask in the issues for that project if you can’t get it working.

— Reply to this email directly, view it on GitHub https://github.com/rbreaves/kinto/issues/818#issuecomment-1643790057, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJUI6WAIEB42MRCHUHNH2LXREMFRANCNFSM6AAAAAA2O4AEVA . You are receiving this because you were mentioned.Message ID: @.***>

Hiperborea-Ro commented 11 months ago

Can't manage to work with xkeysnail and in kinto no clue how to print key output.

On Fri, 21 Jul 2023 at 13:17, Victor Sava @.***> wrote:

Thanks, I'll check them out.

On Thu, 20 Jul 2023, 14:56 RedBearAK, @.***> wrote:

Key events should be from this code, but I’m not sure which would be the macro keys.

static const struct key_entry hp_wmi_keymap[] = { { KE_KEY, 0x02, { KEY_BRIGHTNESSUP } }, { KE_KEY, 0x03, { KEY_BRIGHTNESSDOWN } }, { KE_KEY, 0x20e6, { KEY_PROG1 } }, { KE_KEY, 0x20e8, { KEY_MEDIA } }, { KE_KEY, 0x2142, { KEY_MEDIA } }, { KE_KEY, 0x213b, { KEY_INFO } }, { KE_KEY, 0x2169, { KEY_ROTATE_DISPLAY } }, { KE_KEY, 0x216a, { KEY_SETUP } }, { KE_KEY, 0x231b, { KEY_HELP } }, { KE_KEY, 0x21A4, { KEY_F14 } }, // Winlock hotkey { KE_KEY, 0x21A5, { KEY_F15 } }, // Omen key { KE_KEY, 0x21A7, { KEY_F16 } }, // ??? { KE_KEY, 0x21A9, { KEY_F17 } }, // Disable touchpad hotkey { KE_END, 0 } };

Probably these.

{ KE_KEY, 0x20e6, { KEY_PROG1 } }, { KE_KEY, 0x20e8, { KEY_MEDIA } }, { KE_KEY, 0x2142, { KEY_MEDIA } }, { KE_KEY, 0x213b, { KEY_INFO } }, { KE_KEY, 0x2169, { KEY_ROTATE_DISPLAY } }, { KE_KEY, 0x216a, { KEY_SETUP } }, { KE_KEY, 0x231b, { KEY_HELP } },

You’ll have to ask in the issues for that project if you can’t get it working.

— Reply to this email directly, view it on GitHub https://github.com/rbreaves/kinto/issues/818#issuecomment-1643790057, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJUI6WAIEB42MRCHUHNH2LXREMFRANCNFSM6AAAAAA2O4AEVA . You are receiving this because you were mentioned.Message ID: @.***>