Advertisement
metalx1000

Logitech G815 Keyboard Random key Colors

Jan 31st, 2022
1,636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.28 KB | None | 0 0
  1. #!/bin/bash
  2. #original code https://delightlylinux.wordpress.com/2020/05/21/programming-the-logitech-g513-rgb-keyboard-lights-in-linux-with-g810-led/
  3. #modified by Kris Occhipinti http://filmsbykris.com
  4.  
  5. function getColor()
  6. {
  7.   rgb=$(printf "%02x%02x%02x" $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)))
  8.   echo $rgb
  9. }
  10.  
  11. arrKeys=('esc'
  12.  
  13. # Function F1-F12
  14. 'f1' 'f2' 'f3' 'f4' 'f5' 'f6' 'f7' 'f8' 'f9' 'f10' 'f11' 'f12'
  15.  
  16. # Print Screen Scroll Lock Pause
  17. 'printscr' 'scrolllock' 'pause'
  18.  
  19. 'ins' 'del' 'home' 'end' 'pageup' 'pagedown'
  20.  
  21. # Arrow keys
  22. 'top' 'right' 'bottom' 'left'
  23.  
  24. # Numpad
  25. 'numlock' 'numslash' 'numasterisk' 'numminus' 'numplus' 'numenter'
  26. 'num0' 'num1' 'num2' 'num3' 'num4' 'num5' 'num6' 'num7' 'num8' 'num9' 'num.'
  27.  
  28. 'tilde' {0..9} 'minus' 'equal' 'backspace'
  29. 'tab' {a..z}
  30. 'comma' 'period' 'slash' 'semicolon'
  31. 'quote' 'open_bracket' 'close_bracket' 'backslash' 'enter' 'shiftright' 'shiftleft'
  32. 'caps' 'winright' 'winleft' 'menu' 'space' 'capslock' 'ctrlleft' 'ctrlright'
  33. 'altleft' 'altright'
  34.  
  35. 'gamemode' 'capsindicator' )
  36.  
  37. # Set all keys to off in case of "stuck" key colors
  38. g810-led -a 000000
  39.  
  40.  
  41. for key in ${arrKeys[*]}
  42. do
  43.   g810-led -k $key "$(getColor)"
  44. done
  45.  
  46. g810-led -g gkeys $(getColor)
  47. g810-led -g multimedia $(getColor)
  48. g810-led -fx cycle logo ff
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement