Volume Keys not working in some games

Documentation. First post is always kind of manual page, being continuously updated by author. Following posts are discussion about the topic.
Post Reply
Adleskronen
Posts: 2
Joined: 17 Sep 2022, 14:47

Volume Keys not working in some games

Post by Adleskronen » 12 Jan 2023, 21:05

Hi, i have a script to change the currently highlighted application's volume, like, your in a game and watching netflix at the same time, you can press a button and not the master volume, but only the games volume goes down.

Sadly, this does not work on some apps/games, theres three versions of how it could go:

1. It works, the currently focused app/game does not register the button at all
2. The game reacts to the original button, but the keycombo from luamacros is still working
3. The game reacts to the original button, lua doesnt happen at all

Is there a way to elevate my script over any game? the function to have a shortcut to lower the currently focused window is like gold to me

Thanks in advance


Script:

Code: Select all

lmc_device_set_name('streamdeck','1DCC1640')
lmc.minimizeToTray = true
lmc_minimize()

lmc_set_handler('streamdeck', function(button,direction)
--  if (direction == 1) then return end
  if (direction == 0) then return end

  if (button == 112) then
    lmc_send_keys('^{F1}', 50)

    elseif (button == 113) then
    lmc_send_keys('^{F2}', 50)

    elseif (button == 114) then
    lmc_send_keys('^{F3}', 50)

    elseif (button == 115) then
    lmc_send_keys('^+{F4}', 50)

    elseif (button == 116) then
    lmc_send_keys('^{F5}', 50)

    elseif (button == 117) then
    lmc_send_keys('^{F6}', 50)

    elseif (button == 118) then
    lmc_send_keys('^{F7}', 50)

    elseif (button == 119) then
    lmc_send_keys('^{F8}', 50)

    elseif (button == 120) then
    lmc_send_keys('^{F9}', 50)

    elseif (button == 121) then
    lmc_send_keys('^{F10}', 50)

    elseif (button == 122) then
    lmc_send_keys('^{F11}', 50)

    elseif (button == 123) then
    lmc_send_keys('^{F12}', 50)




    elseif (button == 45) then
    lmc_send_keys('^+{INS}', 50)

    elseif (button == 36) then
    lmc_send_keys('^+{HOME}', 50)  

    elseif (button == 35) then
    lmc_send_keys('^+{END}', 50)

    elseif (button == 44) then
    lmc_send_keys('^%{END}', 50)

    elseif (button == 145) then
    lmc_send_keys('^{SCROLLLOCK}', 50)

    elseif (button == 19) then
    lmc_send_keys('^{BREAK}', 50)



    elseif (button == 220) then
    lmc_send_keys('^%+1', 50)

    elseif (button == 49) then
    lmc_send_keys('^+1', 50)

    elseif (button == 50) then
    lmc_send_keys('^+2', 50)

    elseif (button == 51) then
    lmc_send_keys('^+3', 50)

    elseif (button == 52) then
    lmc_send_keys('^+4', 50)

    elseif (button == 53) then
    lmc_send_keys('^+5', 50)

    elseif (button == 54) then
    lmc_send_keys('^+6', 50)

    elseif (button == 55) then
    lmc_send_keys('^+7', 50)

    elseif (button == 56) then
    lmc_send_keys('^+8', 50)

    elseif (button == 57) then
    lmc_send_keys('^+9', 50)

    elseif (button == 48) then
    lmc_send_keys('^+0', 50)

    elseif (button == 219) then
    lmc_send_keys('^%+0', 50)



    elseif (button == 8) then
    lmc_send_keys('^{BACKSPACE}', 50)



    elseif (button == 46) then
    lmc_send_keys('^+{DEL}', 50)

    elseif (button == 111) then
    lmc_send_keys('^{NUMDIVIDE}', 50)

    elseif (button == 106) then
    lmc_send_keys('^{NUMMULTIPLY}', 50)

    elseif (button == 109) then
    lmc_send_keys('^{NUMMINUS}', 50)

    elseif (button == 97) then
    lmc_send_keys('^%{NUM1}', 50)

    elseif (button == 98) then
    lmc_send_keys('^%{NUM2}', 50)

    elseif (button == 99) then
    lmc_send_keys('^%{NUM3}', 50)

    elseif (button == 100) then
    lmc_send_keys('^%{NUM4}', 50)

    elseif (button == 101) then
    lmc_send_keys('^%{NUM5}', 50)

    elseif (button == 102) then
    lmc_send_keys('^%{NUM6}', 50)  

    elseif (button == 103) then
    lmc_send_keys('^%{NUM7}', 50)

    elseif (button == 104) then
    lmc_send_keys('^%{NUM8}', 50)

    elseif (button == 105) then
    lmc_send_keys('^%{NUM9}', 50)

    elseif (button == 105) then
    lmc_send_keys('^%{NUM9}', 50)

    elseif (button == 96) then
    lmc_send_keys('^%{NUM0}', 50) 

    elseif (button == 110) then
    lmc_send_keys('%{NUMDECIMAL}', 50)




    elseif (button == 9) then
    lmc_send_keys('%q', 50)

    elseif (button == 81) then
    lmc_send_keys('%+Q', 50)

    elseif (button == 87) then
    lmc_send_keys('%+W', 50)

    elseif (button == 69) then
    lmc_send_keys('%+E', 50)

    elseif (button == 82) then
    lmc_send_keys('%+R', 50)

    elseif (button == 84) then
    lmc_send_keys('%+T', 50)

    elseif (button == 90) then
    lmc_send_keys('%+Z', 50)

    elseif (button == 85) then
    lmc_send_keys('%+U', 50)

    elseif (button == 73) then
    lmc_send_keys('%+I', 50)

    elseif (button == 79) then
    lmc_send_keys('%+O', 50)

    elseif (button == 80) then
    lmc_send_keys('%+P', 50)

    elseif (button == 186) then
    lmc_send_keys('^%+P', 50)

    elseif (button == 187) then
    lmc_send_keys('^%+O', 50)



    elseif (button == 65) then
    lmc_send_keys('%+A', 50)

    elseif (button == 83) then
    lmc_send_keys('%+S', 50)

    elseif (button == 68) then
    lmc_send_keys('%+D', 50)

    elseif (button == 70) then
    lmc_send_keys('^{F13}', 50)

    elseif (button == 71) then
    lmc_send_keys('%+G', 50)

    elseif (button == 72) then
    lmc_send_keys('%+H', 50)

    elseif (button == 74) then
    lmc_send_keys('%+J', 50)

    elseif (button == 75) then
    lmc_send_keys('%+K', 50)

    elseif (button == 76) then
    lmc_send_keys('%+L', 50)

    elseif (button == 192) then
    lmc_send_keys('^%+L', 50)

    elseif (button == 222) then
    lmc_send_keys('^%+K', 50)

    elseif (button == 191) then
    lmc_send_keys('^%+J', 50)


                             

    elseif (button == 16) then
    lmc_send_keys('^%+Y', 50)

    elseif (button == 226) then
    lmc_send_keys('^%+X', 50)

    elseif (button == 89) then
    lmc_send_keys('%+Y', 50)

    elseif (button == 88) then
    lmc_send_keys('%+X', 50)

    elseif (button == 67) then
    lmc_send_keys('%+C', 50)

    elseif (button == 86) then
    lmc_send_keys('%+V', 50)

    elseif (button == 66) then
    lmc_send_keys('%+B', 50)

    elseif (button == 78) then
    lmc_send_keys('%+N', 50)

    elseif (button == 77) then
    lmc_send_keys('%+M', 50)

    elseif (button == 188) then
    lmc_send_keys('^%+M', 50)

    elseif (button == 190) then
    lmc_send_keys('^%+N', 50)

    elseif (button == 189) then
    lmc_send_keys('^%+B', 50)




    elseif (button == 17) then
    lmc_send_keys('^%+S', 50)

    elseif (button == 18) then
    lmc_send_keys('^%+F', 50)

    elseif (button == 32) then
    lmc_send_keys('^%+V', 50)



    elseif (button == 33) then
    lmc_send_keys('^%+E', 50)

    elseif (button == 34) then
    lmc_send_keys('^%+R', 50)

    elseif (button == 37) then
    lmc_send_keys('^%+T', 50)

    elseif (button == 38) then
    lmc_send_keys('^%+Z', 50)

    elseif (button == 39) then
    lmc_send_keys('^%+U', 50)

    elseif (button == 40) then
    lmc_send_keys('^%+I', 50)

    elseif (button == 27) then
    lmc_send_keys('^%+H', 50)

    elseif (button == 221) then
    lmc_send_keys('^%+C', 50)

    elseif (button == 13) then
    lmc_send_keys('^%+3', 50)



  end
end
)

Post Reply