SHARE
TWEET

Untitled

a guest Jun 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # $Header: /etc/acpi/default.sh                          Exp $
  4. # $Author: (c) 2012-2014 -tclover <tokiclover@dotfiles.> Exp $
  5. # $License: MIT (or 2-clause/new/simplified BSD)         Exp $
  6. # $Version: 2014/12/24 21:09:26                          Exp $
  7. #
  8.  
  9. log() { logger -p daemon "ACPI: $*"; }
  10. uhd() { log "event unhandled: $*"; }
  11.  
  12. set $*
  13. group=${1%/*}
  14. action=${1#*/}
  15. device=$2
  16. id=$3
  17. value=$4
  18.  
  19. [ -d /dev/snd ] && alsa=true || alsa=false
  20. [ -d /dev/oss ] && oss=true || oss=false
  21. amixer="amixer -q set Master"
  22. ossmix="ossmix -- vmix0-outvol"
  23.  
  24. case $group in
  25.     ac_adapter)
  26.         case $value in
  27.             *0) log "switching to power.bat power profile"
  28.                 hprofile power.bat;;
  29.             *1) log "switching to power.adp power profile"
  30.                 hprofile power.adp;;
  31.             *) uhd $*;;
  32.         esac
  33.         ;;
  34.     battery)
  35.         case $value in
  36.             *0) log "switching to power.adp power profile"
  37.                 hprofile power.adp;;
  38.             *1) log "switching to power.adp power profile"
  39.                 hprofile power.adp;;
  40.             *) uhd $*;;
  41.         esac
  42.         ;;
  43.     button)
  44.         case $action in
  45.             lid)
  46.                 case "$id" in
  47.                     close) hibernate-ram;;
  48.                     open) :;;
  49.                     *) uhd $*;;
  50.                 esac
  51.                 ;;
  52.             power) shutdown -H now;;
  53.             sleep) hibernate-ram;;
  54.             mute)
  55.                 $alsa && $amixer toggle;;
  56.             volumeup)
  57.                 $alsa && $amixer 3dB+
  58.                 $oss && $ossmix +3;;
  59.             volumedown)
  60.                 $alsa && $amixer 3dB-
  61.                 $oss && $ossmix -3;;
  62.             *) uhd $*;;
  63.         esac
  64.         ;;
  65.     cd)
  66.         case $action in
  67.             play) :;;
  68.             stop) :;;
  69.             prev) :;;
  70.             next) :;;
  71.             *) uhd $*;;
  72.         esac
  73.         ;;
  74.     jack)
  75.         case $id in
  76.             *plug) :;;
  77.             *) uhd $*;;
  78.         esac
  79.         ;;
  80.     video)
  81.         case $action in
  82.             displayoff) :;;
  83.             *) uhd $*;;
  84.         esac
  85.         ;;
  86.     *) uhd $*;;
  87. esac
  88.  
  89. unset alsa oss amixer ossmix group action device id
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top