Search code examples
javawindowstriggersmedia-playerhotkeys

Any way to programatically trigger global mediakeys in Windows using Java?


Is there any way to programatically trigger global mediakeys in Windows using Java? I want to trigger the global hotkeys that mediaplayers are listening to. Is this possible in Java or maybe in C#?


Solution

  • The keys also just have keycodes, and keycode constants all just map to byte values, so: Get a for-loop, an byte-variable, and fire all after another which in the end will give you the expected result :)

    Maybe you have to add modifiers, the linux keymap files for your keyboard of choice should give you hints about your keys.