Skip to content

Commit 5971ba1

Browse files
committed
Initial commit.
0 parents  commit 5971ba1

21 files changed

+470
-0
lines changed

actions/brightness

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
. /etc/acpi/actions/osd
4+
5+
if [ "up" == "$1" ]; then
6+
echo "up" > /proc/acpi/ibm/brightness
7+
else
8+
echo "down" > /proc/acpi/ibm/brightness
9+
fi
10+
11+
CUR=`cat /proc/acpi/ibm/brightness | grep level: | cut -f3`
12+
PERC=`awk "BEGIN{print 6.66667 * $CUR}"`
13+
14+
progress $PERC "Brightness"
15+
16+

actions/eject

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
sudo eject

actions/hibernate

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
pm-bust -gui

actions/killswitch

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "disable" > /proc/acpi/ibm/bluetooth

actions/lm_ac_adapter.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/sh
2+
3+
test -f /usr/sbin/laptop_mode || exit 0
4+
5+
# ac on/offline event handler
6+
7+
/usr/sbin/laptop_mode auto

actions/lm_battery.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#! /bin/sh
2+
3+
test -f /usr/sbin/laptop_mode || exit 0
4+
5+
# Automatically disable laptop mode when the battery almost runs out,
6+
# and re-enable it when it
7+
8+
/usr/sbin/laptop_mode auto

actions/lm_lid.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/sh
2+
3+
test -f /usr/sbin/laptop_mode || exit 0
4+
5+
# lid button pressed/released event handler
6+
7+
/usr/sbin/laptop_mode auto

actions/lock

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
/usr/bin/xscreensaver-command -activate

actions/mute

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
. /etc/acpi/actions/osd
4+
5+
amixer set PCM 0%
6+
osd "Mute"

actions/osd

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
osd() {
3+
echo "$1" | osd_cat -d 1 -c green --font="-*-times-bold-r-*--40-40-*-*-*-*-*-*" -A center -p bottom
4+
}
5+
6+
progress() {
7+
killall osd_cat
8+
osd_cat -b 'percentage' -P $1 -T $2 -A center -p bottom -o 50 -w -d 1
9+
}

actions/radio

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
. /etc/acpi/actions/osd
4+
5+
if [ -n `ifconfig | grep wlan0` ]; then
6+
sudo ifconfig wlan0 up
7+
osd "Wireless On"
8+
9+
else
10+
sudo ifconfig wlan0 down
11+
osd "Wireless Off"
12+
fi

actions/screen

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#!/bin/bash
2+
# From: http://www.thinkwiki.org/wiki/Sample_Fn-F7_script
3+
#
4+
# External output may be "VGA" or "VGA-0" or "DVI-0" or "TMDS-1"
5+
EXTERNAL_OUTPUT="VGA1"
6+
INTERNAL_OUTPUT="LVDS1"
7+
# EXTERNAL_LOCATION may be one of: left, right, above, or below
8+
EXTERNAL_LOCATION="right"
9+
10+
case "$EXTERNAL_LOCATION" in
11+
left|LEFT)
12+
EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
13+
;;
14+
right|RIGHT)
15+
EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
16+
;;
17+
top|TOP|above|ABOVE)
18+
EXTERNAL_LOCATION="--above $INTERNAL_OUTPUT"
19+
;;
20+
bottom|BOTTOM|below|BELOW)
21+
EXTERNAL_LOCATION="--below $INTERNAL_OUTPUT"
22+
;;
23+
*)
24+
EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
25+
;;
26+
esac
27+
28+
function screen_external(){
29+
xrandr --output $INTERNAL_OUTPUT --off
30+
xrandr --output $EXTERNAL_OUTPUT --auto
31+
}
32+
33+
function screen_internal(){
34+
xrandr --output $EXTERNAL_OUTPUT --off
35+
xrandr --output $INTERNAL_OUTPUT --auto
36+
}
37+
38+
function screen_mirror(){
39+
xrandr --output $INTERNAL_OUTPUT --auto
40+
xrandr --output $EXTERNAL_OUTPUT --auto --same-as $INTERNAL_OUTPUT
41+
}
42+
43+
function screen_both(){
44+
xrandr --output $INTERNAL_OUTPUT --auto
45+
xrandr --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION
46+
}
47+
48+
function screen_toggle(){
49+
# Figure out current state
50+
INTERNAL_STATE=$(xrandr | grep $INTERNAL_OUTPUT | grep con | sed "s/.*connected //" | sed "s/(.*//")
51+
EXTERNAL_STATE=$(xrandr | grep $EXTERNAL_OUTPUT | grep con | sed "s/.*connected //" | sed "s/(.*//")
52+
53+
if [ -z "$INTERNAL_STATE" ]; then
54+
STATE="external"
55+
elif [ -z "$EXTERNAL_STATE" ]; then
56+
STATE="internal"
57+
else
58+
INTERNAL_STATE=$(echo $INTERNAL_STATE | sed "s/[0-9]*x[0-9]*//")
59+
EXTERNAL_STATE=$(echo $EXTERNAL_STATE | sed "s/[0-9]*x[0-9]*//")
60+
if [ "$INTERNAL_STATE" = "$EXTERNAL_STATE" ]; then
61+
STATE="mirror"
62+
else
63+
STATE="both"
64+
fi
65+
fi
66+
67+
case "$STATE" in
68+
internal)
69+
screen_mirror
70+
;;
71+
mirror)
72+
screen_external
73+
;;
74+
external)
75+
screen_both
76+
;;
77+
both)
78+
screen_internal
79+
;;
80+
*)
81+
screen_internal
82+
;;
83+
esac
84+
}
85+
86+
# based on /etc/acpi/screenblank.sh (Ubuntu 7.10)
87+
# . /usr/share/acpi-support/power-funcs # for getXuser
88+
getXuser() {
89+
user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
90+
if [ x"$user" = x"" ]; then
91+
user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
92+
fi
93+
if [ x"$user" != x"" ]; then
94+
userhome=`getent passwd $user | cut -d: -f6`
95+
export XAUTHORITY=$userhome/.Xauthority
96+
else
97+
export XAUTHORITY=""
98+
fi
99+
}
100+
# end of getXuser from /usr/share/acpi-support/power-funcs
101+
#
102+
for x in /tmp/.X11-unix/*; do
103+
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
104+
getXuser;
105+
if [ x"$XAUTHORITY" != x"" ]; then
106+
export DISPLAY=":$displaynum"
107+
screen_toggle
108+
fi
109+
done
110+
111+
# What should we do?
112+
DO="$1"
113+
if [ -z "$DO" ]; then
114+
if [ $(basename $0) = "screen" ]; then
115+
DO="toggle"
116+
fi
117+
fi
118+
119+
case "$DO" in
120+
toggle)
121+
screen_toggle
122+
;;
123+
internal)
124+
screen_internal
125+
;;
126+
external)
127+
screen_external
128+
;;
129+
mirror)
130+
screen_mirror
131+
;;
132+
both)
133+
screen_both
134+
;;
135+
status)
136+
echo "Current Fn-F7 state is: $STATE"
137+
echo
138+
echo "Attached monitors:"
139+
$SU xrandr | grep "\Wconnected" | sed "s/^/ /"
140+
;;
141+
*)
142+
echo "usage: $0 <command>" >&2
143+
echo >&2
144+
echo " commands:" >&2
145+
echo " status" >&2
146+
echo " internal" >&2
147+
echo " external" >&2
148+
echo " mirror" >&2
149+
echo " both" >&2
150+
echo " toggle" >&2
151+
echo >&2
152+
;;
153+
esac
154+

actions/suspend

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
sudo pm-suspend

actions/touchpad

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
/home/kremso/bin/ultrabay_eject.sh

actions/volume

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
. /etc/acpi/actions/osd
4+
5+
if [ "up" == $1 ]; then
6+
VOL=`amixer set PCM 2dB+ unmute`
7+
fi
8+
9+
if [ "down" == $1 ]; then
10+
VOL=`amixer set PCM 2dB- unmute`
11+
fi
12+
13+
PERC=`echo $VOL | grep 'Front Left:' | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*'`
14+
15+
16+
progress $PERC "Volume"

events/anything

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Pass all events to our one handler script
2+
event=.*
3+
action=/etc/acpi/handler.sh %e

events/lm_ac_adapter

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
event=ac_adapter.*
2+
action=/etc/acpi/actions/lm_ac_adapter.sh

events/lm_battery

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
event=battery.*
2+
action=/etc/acpi/actions/lm_battery.sh %e

events/lm_lid

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
event=button[ /]lid
2+
action=/etc/acpi/actions/lm_lid.sh %e

0 commit comments

Comments
 (0)