Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #----------------------------------------------------------------------
- #hinge-sensor (/etc/acpi/events)
- event=video/tabletmode
- action=/etc/acpi/actions/hinge-sensor.sh %e
- #----------------------------------------------------------------------
- #hinge-sensor.sh (/etc/acpi/actions/hinge-sensor.sh)
- #!/bin/bash
- pid=$( ps ax | grep "lightdm --session-child" | grep -v grep | awk '{print $1}')
- pid=$(pgrep -P $pid -n)
- import_environment() {
- (( pid )) && for var; do
- IFS='=' read key val < <(egrep -z "$var" /proc/$pid/environ)
- printf -v "$key" %s "$val"
- [[ ${!key} ]] && export "$key"
- done
- }
- import_environment XAUTHORITY USER DISPLAY
- logger 'beginning tablet mode test'
- case "$2" in
- TBLT)
- logger 'tablet sensor triggered'
- case "$4" in
- 00000001)
- logger 'tablet mode 1'
- #su -c `notify-send "Tablet mode engaged"` $USER
- su -c "/home/$USER/bin/acpi/tabletmode 1" $USER
- ;;
- 00000000)
- logger 'tablet mode 0'
- #su -c `notify-send "Tablet mode disengaged"` $USER
- su -c "/home/$USER/bin/acpi/tabletmode 0" $USER
- ;;
- esac
- ;;
- *)
- su -c "notify-send "undefined action" "tablet mode undefined action: $1 $2 $3 $4"" $USER
- logger 'tablet mode action undefined: $1 $2 $3 $4'
- ;;
- esac
- #======================================================================
- #----------------------------------------------------------------------
- #ibmspecialkeys (/etc/acpi/events)
- event=ibm/hotkey
- action=/etc/acpi/actions/ibmspecialkeys.sh %e
- #======================================================================
- #----------------------------------------------------------------------
- #ibmspecialkeys.sh (/etc/acpi/actions/ibmspecialkeys.sh)
- #!/bin/bash
- pid=$( ps ax | grep "lightdm --session-child" | grep -v grep | awk '{print $1}')
- pid=$(pgrep -P $pid -n)
- import_environment() {
- (( pid )) && for var; do
- IFS='=' read key val < <(egrep -z "$var" /proc/$pid/environ)
- printf -v "$key" %s "$val"
- [[ ${!key} ]] && export "$key"
- done
- }
- import_environment XAUTHORITY USER DISPLAY
- #logger "pid:$pid"
- #logger "XAUTHORITY:$XAUTHORITY USER:$USER DISPLAY:$DISPLAY"
- case "$4" in
- 00001311)
- logger 'favorites button pressed'
- #/home/$USER/bin/notify-send-root "favorites button pressed" "$1 $2 $3 $4"
- su -c "/home/$USER/bin/acpi/ibm-keyconfig star-symbol" $USER
- ;;
- 00001315)
- logger 'keyboard symbol button pressed'
- su -c "/home/$USER/bin/acpi/ibm-keyconfig keyboard-symbol" $USER
- ;;
- *)
- logger "ACPI action undefined: $1"
- ;;
- esac
- #======================================================================
- #----------------------------------------------------------------------
- mouse-config (/home/$USER/bin)
- #!/bin/bash
- #mouse configuration
- #hint: use xinput list for a list of devices and their associated ids
- #hint: use xinput list-prods "${id}" to get a list of properties of device
- #Xorg
- #==================================
- #--------------------------------
- #device:Trackpoint
- id="ETPS/2 Elantech TrackPoint"
- xinput --set-prop "${id}" 'libinput Natural Scrolling Enabled' 0
- xinput --set-prop "${id}" 'libinput Left Handed Enabled' 0
- xinput --set-prop "${id}" 'libinput Accel Speed' 1
- xinput --set-prop "${id}" 'libinput Accel Profiles Available' 0, 1
- xinput --set-prop "${id}" 'libinput Accel Profile Enabled' 0, 1
- xinput --set-prop "${id}" 'libinput Button Scrolling Button' 2
- xinput --set-prop "${id}" 'libinput Middle Emulation Enabled' 1
- xinput --set-prop "${id}" 'libinput Send Events Mode Enabled' 0, 0
- xinput --set-prop "${id}" 'libinput Horizontal Scroll Enabled' 1
- #xinput --set-prop "${id}" 'libinput Scroll Methods Available' 0, 0, 1
- #xinput --set-prop "${id}" 'libinput Send Events Modes Available' 1, 0
- #--------------------------------
- #device:Touchpad
- #id=14
- #xinput --set-prop "${id}"
- #==================================
- #======================================================================
- #----------------------------------------------------------------------
- #ibmspecialkeys.sh (/home/$USER/bin/acpi)
- #!/bin/bash
- pid=$( ps ax | grep "lightdm --session-child" | grep -v grep | awk '{print $1}')
- pid=$(pgrep -P $pid -n)
- import_environment() {
- (( pid )) && for var; do
- IFS='=' read key val < <(egrep -z "$var" /proc/$pid/environ)
- printf -v "$key" %s "$val"
- [[ ${!key} ]] && export "$key"
- done
- }
- import_environment XAUTHORITY USER DISPLAY
- #logger "pid:$pid"
- #logger "XAUTHORITY:$XAUTHORITY USER:$USER DISPLAY:$DISPLAY"
- case "$4" in
- 00001311)
- logger 'favorites button pressed'
- #/home/$USER/bin/notify-send-root "favorites button pressed" "$1 $2 $3 $4"
- su -c "/home/$USER/bin/acpi/ibm-keyconfig star-symbol" $USER
- ;;
- 00001315)
- logger 'keyboard symbol button pressed'
- su -c "/home/$USER/bin/acpi/ibm-keyconfig keyboard-symbol" $USER
- ;;
- *)
- logger "ACPI action undefined: $1"
- ;;
- esac
- #=======================================================================
- #-----------------------------------------------------------------------
- #tabletmode (/home/$USER/bin/acpi)
- #!/bin/sh
- #acpi action script for tablet mode, handled by acpi handler in /etc/acpi/actions
- case $1 in
- 0)
- #notify-send "Tablet mode disengaged"
- #write commands here
- ;;
- 1)
- #notify-send "Tablet mode engaged"
- #write commands here
- ;;
- *)
- notify-send "undefined action" "undefined action for tablet mode initiated"
- ;;
- esac
- ;;
- #=======================================================================
- #-----------------------------------------------------------------------
- #notify-send-root
- #in case you need to send notification with root privelages
- #!/bin/bash
- #
- # This script shows how to send a libnotify message
- # to a specific user.
- #
- # It looks for a process that was started by the user and is connected to dbus.
- #------------------------------------------------------------------------------------
- #User input
- #--------------------------------------------------------------------
- USER="$USER"
- USER_DBUS_PROCESS_NAME="gconfd-2" #pick any valid user process that can be associated with dbus
- NOTIFY_SEND_BIN="/usr/bin/notify-send"
- #--------------------------------------------------------------------
- # get pid of user dbus process
- DBUS_PID=`ps ax | grep $USER_DBUS_PROCESS_NAME | grep -v grep | awk '{ print $1 }'`
- # get DBUS_SESSION_BUS_ADDRESS variable
- DBUS_SESSION=`grep -z DBUS_SESSION_BUS_ADDRESS /proc/$DBUS_PID/environ | tr '\0' '\n' | sed -e s/DBUS_SESSION_BUS_ADDRESS=//`
- params=()
- while [ "$1" != "" ]; do
- params+=(\"$1\")
- shift
- done
- notify() {
- arg="$@"
- DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION su -c "$NOTIFY_SEND_BIN ${params[*]}" $USER
- }
- #----------------------------------------------------------------------
- notify $@
- #debug
- #notify "title 1" "body 2" "--urgency=normal" "--icon=/usr/share/icons/gnome/32x32/emblems/emblem-default.png"
- #=======================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement