Advertisement
lexthebrony

Color Keyboard Script

Nov 27th, 2014
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.09 KB | None | 0 0
  1. #! /bin/bash
  2. #changes keyboard colors on clevo laptops. Tested on P170EM
  3. #Noah B.
  4.  
  5. #Prompt for root
  6. [ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
  7.  
  8. off=000
  9. white=111
  10. green=100
  11. red=010
  12. blue=001
  13. yellow=110
  14. purple=011
  15. aqua=101
  16.  
  17. left=$1
  18. l_code=000
  19. middle=$2
  20. m_code=000
  21. right=$3
  22. r_code=000
  23.  
  24. #LEFT SIDE
  25.  
  26. if [ -z "$left" ]
  27. then
  28.     echo "Enter desired color for the left side:
  29.     (off/white/green/red/blue/yellow/purple/aqua)"
  30. read -p "Color choice: " left
  31. fi
  32.  
  33. eval "l_code=\$$left"
  34.  
  35. echo $l_code > /sys/devices/platform/clevo_wmi/kbled/left
  36.  
  37. #MIDDLE
  38.  
  39. if [ -z "$middle" ]
  40. then
  41.         echo "Enter desired color for the middle:
  42.        (off/white/green/red/blue/yellow/purple/aqua)"
  43. read -p "Color choice: " middle
  44. fi
  45.  
  46. eval "m_code=\$$middle"
  47.  
  48. echo $m_code > /sys/devices/platform/clevo_wmi/kbled/middle
  49.  
  50. #RIGHT SIDE
  51.  
  52. if [ -z "$right" ]
  53. then
  54.         echo "Enter desired color for the right side:
  55.        (off/white/green/red/blue/yellow/purple/aqua)"
  56. read -p "Color choice: " right
  57. fi
  58.  
  59. eval "r_code=\$$right"
  60.  
  61. echo $r_code > /sys/devices/platform/clevo_wmi/kbled/right
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement