fierce_brake

Untitled

Jun 6th, 2023
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. #!/bin/bash
  2. # Default acpi script that takes an entry for all actions
  3.  
  4.  
  5. fxply () {
  6. sudo -u fierce_brake env -i bash -c "XDG_RUNTIME_DIR='/run/user/1000' DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus' $1"
  7. return 0
  8. }
  9.  
  10.  
  11. case "$1" in
  12. button/power)
  13. case "$2" in
  14. PBTN|PWRF)
  15. logger 'PowerButton pressed'
  16. ;;
  17. *)
  18. logger "ACPI action undefined: $2"
  19. ;;
  20. esac
  21. ;;
  22. button/sleep)
  23. case "$2" in
  24. SLPB|SBTN)
  25. logger 'SleepButton pressed'
  26. ;;
  27. *)
  28. logger "ACPI action undefined: $2"
  29. ;;
  30. esac
  31. ;;
  32. ac_adapter)
  33. case "$2" in
  34. AC|ACAD|ADP0)
  35. case "$4" in
  36. 00000000)
  37. logger 'AC unpluged'
  38. ;;
  39. 00000001)
  40. logger 'AC pluged'
  41. ;;
  42. esac
  43. ;;
  44. *)
  45. logger "ACPI action undefined: $2"
  46. ;;
  47. esac
  48. ;;
  49. battery)
  50. case "$2" in
  51. BAT0)
  52. case "$4" in
  53. 00000000)
  54. logger 'Battery online'
  55. ;;
  56. 00000001)
  57. logger 'Battery offline'
  58. ;;
  59. esac
  60. ;;
  61. CPU0)
  62. ;;
  63. *) logger "ACPI action undefined: $2" ;;
  64. esac
  65. ;;
  66. button/lid)
  67. case "$3" in
  68. close)
  69. logger 'LID closed'
  70. ;;
  71. open)
  72. logger 'LID opened'
  73. ;;
  74. *)
  75. logger "ACPI action undefined: $3"
  76. ;;
  77. esac
  78. ;;
  79. button/volumedown)
  80. case "$2" in
  81. VOLDN)
  82. fxply 'pactl set-sink-volume @DEFAULT_SINK@ -5%'
  83. fxply 'notify-send "VolD" --icon=audio-volume-low'
  84. ;;
  85. esac
  86. ;;
  87. button/volumeup)
  88. case "$2" in
  89. VOLUP)
  90. fxply 'pactl set-sink-volume @DEFAULT_SINK@ +5%'
  91. fxply 'notify-send "VolU" --icon=audio-volume-high'
  92. ;;
  93. esac
  94. ;;
  95. button/mute)
  96. case "$2" in
  97. MUTE)
  98. fxply 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
  99. fxply 'notify-send "Mute" --icon=audio-volume-muted'
  100. ;;
  101. esac
  102. ;;
  103. cd/prev)
  104. case "$2" in
  105. CDPREV)
  106. fxply 'playerctl previous'
  107. fxply 'notify-send "Prev" --icon=media-skip-backward'
  108. ;;
  109. esac
  110. ;;
  111. cd/play)
  112. case "$2" in
  113. CDPLAY)
  114. fxply 'playerctl play-pause'
  115. fxply 'notify-send "Play" --icon=media-playback-start'
  116. ;;
  117. esac
  118. ;;
  119. cd/next)
  120. case "$2" in
  121. CDNEXT)
  122. fxply 'playerctl next'
  123. fxply 'notify-send "Next" --icon=media-skip-forward'
  124. ;;
  125. esac
  126. ;;
  127.  
  128. *)
  129. logger "ACPI group/action undefined: $1 / $2"
  130. ;;
  131. esac
  132.  
  133. # vim:set ts=4 sw=4 ft=sh et:
  134.  
Advertisement
Add Comment
Please, Sign In to add comment