add laptop_power_plug script
This commit is contained in:
parent
638b94345c
commit
bd3a8563f2
26
scripts/scripts/laptop_power_plug
Executable file
26
scripts/scripts/laptop_power_plug
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"in")
|
||||||
|
export message="Power cord plugged in"
|
||||||
|
governor="performance"
|
||||||
|
;;
|
||||||
|
"out")
|
||||||
|
export message="Power cord unplugged"
|
||||||
|
governor="schedutil"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Wrong argument specified"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
user=$(who | head -n 1 | cut -d" " -f1)
|
||||||
|
|
||||||
|
|
||||||
|
export XAUTHORITY=/home/$user/.Xauthority
|
||||||
|
export DISPLAY=:0
|
||||||
|
|
||||||
|
su $user -c 'notify-send "$message"'
|
||||||
|
cpupower frequency-set -r -g $governor
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user