summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/tweaker/bin/twk_keymap.sh
blob: c7f4093f786d8d3e1d764ec5feed93955dd36a3d (plain)
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
#!/bin/bash

# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This script is called from twk_general.pl to implement keymap standardization in KnoppMyth

#KNOPPMYTH_SHARE=/usr/local/share/knoppmyth

####################
# Unify key mappings
####################

# Universal keybindings:
# Function	Remote Key	Keyboard Key
# ------------------------------------------
# Skip Back	<<		PgUp
# Skip Forward	>>		PgDn
# Play		|>		l
# Pause		||		p
# Stop		[]		ESC

#Make mplayer use keymappings that are compatible with other media player keymappings.
#NOTE: PGUP is PageUp and PGDWN is PageDown
MPLAYER_CONF=/etc/mplayer/input.conf
if [[ -f $MPLAYER_CONF ]]; then
    sed -i "s/^PGUP .*/PGUP seek -60/" $MPLAYER_CONF
    sed -i "s/^PGDWN .*/PGDWN seek +60/" $MPLAYER_CONF
    sed -i "s/^p .*/p pause/" $MPLAYER_CONF
    sed -i "s/^l .*/l pause/" $MPLAYER_CONF
else
    echo "ERROR: $MPLAYER_CONF is missing, which is unexpected."
    exit -1
fi

#Do the same for smplayer
SMPLAYER_CONF=/home/mythtv/.config/smplayer/smplayer.ini
if [[ -f $SMPLAYER_CONF ]]; then
    echo "INFO: $SMPLAYER_CONF found; tweaking now"
else
    echo "INFO: $SMPLAYER_CONF is missing; installing full version, then (re-)tweaking"
    sudo -u mythtv mkdir -p /home/mythtv/.config/smplayer/
    /bin/cp $TWEAKER_ROOT/fs$SMPLAYER_CONF $SMPLAYER_CONF
fi
sed -i "s/rewind3=.*/rewind3=PgUp/" $SMPLAYER_CONF
sed -i "s/forward3=.*/forward3=PgDown/" $SMPLAYER_CONF
sed -i "s/quit=.*/quit=Esc/" $SMPLAYER_CONF
sed -i "s/pause=.*/pause=P/" $SMPLAYER_CONF
sed -i "s/play=.*/play=L/" $SMPLAYER_CONF
# Remove conflicting keybindings
sed -i "s/stop=.*/stop=/" $SMPLAYER_CONF
sed -i "s/play_or_pause=.*/play_or_pause=/" $SMPLAYER_CONF
sed -i "s/exit_fullscreen=.*/exit_fullscreen=/" $SMPLAYER_CONF
sed -i "s/pl_play=.*/pl_play=/" $SMPLAYER_CONF