Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- FUNC_LIB=/etc/acpi/functions.sh
- DEFAULT=/etc/default/$PKG
- WLAN_IF=wlan0
- # для корректной работы synclient требуется $DISPLAY, решение "в лоб":
- export DISPLAY=:0.0
- [ -e $FUNC_LIB ] || exit 0
- #if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
- . $FUNC_LIB
- code=$3
- wireless_toggle(){
- CTL=/sys/class/rfkill/rfkill0/state
- if [ -e $CTL ]; then
- toggle
- else
- notify error 'Wifi unavailable'
- fi
- }
- handle_blank_screen() {
- if [ -S /tmp/.X11-unix/X0 ]; then
- detect_x_display
- if [ -n "$XAUTHORITY" ]; then
- xset dpms force off
- fi
- fi
- }
- is_on()
- {
- if [ -e $CTL ]; then
- [ $( cat $CTL ) = "1" ]
- else
- false
- fi
- }
- toggle()
- {
- if is_on; then
- echo 0 > $CTL
- else
- if [ -e $CTL ]; then
- echo 1 > $CTL
- fi
- fi
- }
- handle_camera_toggle() {
- CTL=/sys/devices/platform/eeepc/camera
- [ -e $CTL ] || CTL=/proc/acpi/asus/camera #pre-2.6.26
- if [ -e $CTL ]; then
- toggle
- fi
- }
- cardr_toggle() {
- CTL=/sys/devices/platform/eeepc/cardr
- if [ -e $CTL ]; then
- toggle
- fi
- }
- touchpad_toggle(){
- if(/usr/bin/synclient -l | grep -e "TouchpadOff" | grep -e "0" > /dev/null) ; th
- en
- /usr/bin/synclient TouchpadOff=1
- else
- /usr/bin/synclient TouchpadOff=0
- fi
- }
- case $code in
- 00000013)
- /etc/acpi/actions/volume.sh toggle
- ;;
- 00000014)
- /etc/acpi/actions/volume.sh down
- ;;
- 00000015)
- /etc/acpi/actions/volume.sh up
- ;;
- # Fn+F2 -- toggle wireless
- 00000010)
- wireless_toggle
- ;;
- # 0000003[012])
- # /etc/acpi/actions/vga-toggle.sh
- # ;;
- 0000001a)
- handle_blank_screen
- ;;
- 00000016)
- handle_blank_screen
- ;;
- 0000001b)
- cardr_toggle # soft-buton 2
- ;;
- 0000001c)
- # soft-buton 3
- handle_camera_toggle
- ;;
- 0000001d)
- touchpad_toggle
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment