-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.sh
executable file
·116 lines (112 loc) · 2.1 KB
/
remote.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env bash
#
# react to cec keypresses in the jankiest way possible
#
# Author: Dave Eddy <[email protected]>
# Date: 10/15/2013
# Licens: MIT
# Tested on: Raspberry pi with libcec compiled from soure
#
# vlc specific hotkey inputs and shutdown feature added, linus fargo
# plus decreased jankieness by switching search string from pressed to released
#
onF1()
{
echo 'blue button pressed'
DISPLAY=:0 xdotool key f
}
onF2()
{
echo 'red button pressed'
echo 'You are doing right'
pcmanfm /mnt/windows_share
}
onF3()
{
echo 'green button pressed'
pcmanfm /mnt/windows_share
}
onF4()
{
echo 'yellow button pressed'
}
onright() {
echo 'right button pressed'
DISPLAY=:0 xdotool key Right
}
onleft() {
echo 'left button pressed'
DISPLAY=:0 xdotool key Left
}
onnine() {
echo 'nine button pressed'
/home/pi/rpvlcdmp/./powerdown.sh
}
ondown() {
echo 'down button pressed'
DISPLAY=:0 xdotool key Down
}
onup() {
echo 'up button pressed'
DISPLAY=:0 xdotool key Up
}
onselect() {
echo 'select button pressed'
DISPLAY=:0 xdotool key space
}
onplay() {
echo 'play button pressed'
DISPLAY=:0 xdotool key space
}
onpause() {
echo 'pause button pressed'
DISPLAY=:0 xdotool key space
}
onforward() {
echo 'forward button pressed'
DISPLAY=:0 xdotool key ctrl+Right
}
onbackward() {
echo 'back button pressed'
DISPLAY=:0 xdotool key ctrl+Left
}
ondisplay() {
echo 'display button pressed'
DISPLAY=:0 xdotool key i
}
onexit()
{
echo 'exit button pressed'
DISPLAY=:0 xdotool key BackSpace
}
onclear()
{
echo 'clear button pressed'
DISPLAY=:0 xdotool key alt+F4
}
filter() {
perl -nle 'BEGIN{$|=1} /key released: (.*) \(.*\)/ && print $1'
}
echo as | cec-client | filter | \
while read cmd; do
case "$cmd" in
'F1 (blue)') onF1;;
'F2 (red)') onF2;;
'F3 (green)') onF3;;
'F4 (yellow)') onF4;;
clear) onclear;;
exit) onexit;;
right) onright;;
left) onleft;;
9) onnine;;
up) onup;;
down) ondown;;
select) onselect;;
play) onplay;;
pause) onpause;;
'Fast forward') onforward;;
rewind) onbackward;;
'display information') ondisplay;;
*) echo "unrecognized button ($cmd)";;
esac
done