#apt-get install acpid acpi-support cpufrequtils
#acpi_listen ac_adapter ACPI0003:00 00000080 00000000 ibm/hotkey LEN0068:00 00000080 00006030 thermal_zone LNXTHERM:00 00000081 00000000 battery PNP0C0A:00 00000080 00000001 ibm/hotkey LEN0068:00 00000080 00004011
#acpi_listen ibm/hotkey LEN0068:00 00000080 00004010 ac_adapter ACPI0003:00 00000080 00000001 ibm/hotkey LEN0068:00 00000080 00006030 thermal_zone LNXTHERM:00 00000081 00000000 battery PNP0C0A:00 00000080 00000001 button/lid LID close
#vim /etc/acpi/events/thinkpad-dock event=ibm/hotkey LEN0068:00 00000080 00004010 action=/etc/acpi/thinkpad-dock.sh #vim /etc/acpi/events/thinkpad-undock event=ibm/hotkey LEN0068:00 00000080 00004011 action=/etc/acpi/thinkpad-undock.sh
#vim /etc/acpi/events/lidbtn event=button[ /]lid action=/etc/acpi/lid.sh
#vim /etc/acpi/lid.sh #!/bin/bash #, - grep -q on /etc/tp_dock_state; if [ $? = 0 ] then # , grep -q open /proc/acpi/button/lid/*/state if [ $? = 0 ] then # , , DISPLAY=:0.0 su user -c 'xrandr --output LVDS1 --auto' DISPLAY=:0.0 su user -c 'xrandr --output HDMI3 --off' else # , , DISPLAY=:0.0 su user -c 'xrandr --output HDMI3 --auto' DISPLAY=:0.0 su user -c 'xrandr --output LVDS1 --off' # bluetooth- echo enabled> /proc/acpi/ibm/bluetooth /etc/init.d/bluetooth start # bluetooth . echo 'connect 90:7F:61:10:A3:BC'|bluetoothctl # alt_gr, DISPLAY=:0.0 su user -c 'setxkbmap -option grp:toggle us,ru' DISPLAY=:0.0 su user -c 'xmodmap ~/.xmodmaprc' fi else # grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then # , bt- echo 'disconnect 90:7F:61:10:A3:BC'|bluetoothctl /etc/init.d/bluetooth stop echo disabled> /proc/acpi/ibm/bluetooth # user DISPLAY=:0.0 su user -c /home/user/bin/lock # DISPLAY=:0.0 su user -c 'xrandr --output LVDS1 --auto' # DISPLAY=:0.0 su user -c 'xrandr --output HDMI3 --off' # pm-suspend # , thinkpad: grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then # , , : echo on >/etc/tp_dock_state # DISPLAY=:0.0 su user -c 'xrandr --output HDMI3 --auto' DISPLAY=:0.0 su user -c 'xrandr --output LVDS1 --off' # bt-, , bt- echo enabled> /proc/acpi/ibm/bluetooth /etc/init.d/bluetooth start echo 'connect 90:7F:61:10:A3:BC'|bluetoothctl # DISPLAY=:0.0 su user -c 'setxkbmap -option grp:toggle us,ru' DISPLAY=:0.0 su user -c 'xmodmap ~/.xmodmaprc &' fi else # , DISPLAY=:0.0 su user -c 'xrandr --output LVDS1 --auto' fi
#apt-get install bluez #bluetoothctl [NEW] Controller 40:2C:F4:BB:3C:FC nethack [default] [bluetooth]# agent on Agent registered [bluetooth]# default-agent Default agent request successful [bluetooth]# scan on Discovery started [CHG] Controller 40:2C:F4:BB:3C:FC nethack [default] [NEW] Device 90:7F:61:10:A3:BC ThinkPad Compact Bluetooth Keyboard with TrackPoint [bluetooth]# pair 90:7F:61:10:A3:BC Attempting to pair with 90:7F:61:10:A3:BC [CHG] Device 90:7F:61:10:A3:BC Connected: yes [agent] PIN code: 12345 # PIN [bluetooth]# connect 90:7F:61:10:A3:BC Attempting to connect to 90:7F:61:10:A3:BC Connection successful
#echo 'connect 90:7F:61:10:A3:BC'| bluetoothctl
#vim /etc/acpi/thinkpad-dock.sh #!/bin/sh # echo on >/etc/tp_dock_state # performance cpufreq-set -c 0 -g performance cpufreq-set -c 1 -g performance cpufreq-set -c 2 -g performance cpufreq-set -c 3 -g performance # , , - echo 'connect 90:7F:61:10:A3:BC'|bluetoothctl
#vim /etc/acpi/thinkpad-undock.sh #!/bin/bash # echo off >/etc/tp_dock_state # cpufreq-set -c 0 -g powersave cpufreq-set -c 1 -g powersave cpufreq-set -c 2 -g powersave cpufreq-set -c 3 -g powersave #, : grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then # , DISPLAY=:0.0 su user -c /home/user/bin/lock # bt-, , echo 'disconnect 90:7F:61:10:A3:BC'|bluetoothctl /etc/init.d/bluetooth stop echo disabled> /proc/acpi/ibm/bluetooth # DISPLAY=:0.0 su user -c 'xrandr --output LVDS1 --auto' DISPLAY=:0.0 su user -c 'xrandr --output HDMI3 --off' # pm-suspend # , grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then # , DISPLAY=:0.0 su user -c 'xrandr --output HDMI3 --auto' DISPLAY=:0.0 su user -c 'xrandr --output LVDS1 --off' # bt-, , echo enabled> /proc/acpi/ibm/bluetooth /etc/init.d/bluetooth start echo 'connect 90:7F:61:10:A3:BC'|bluetoothctl # echo on >/etc/tp_dock_state fi fi
#sed -i 's/HandleLidSwitch=yes/HandleLidSwitch=ignore/' /etc/systemd/logind.conf
Source: https://habr.com/ru/post/272167/
All Articles