-
Notifications
You must be signed in to change notification settings - Fork 1
/
kodi-fullscreen.sh
executable file
·80 lines (58 loc) · 1.28 KB
/
kodi-fullscreen.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
#!/bin/bash
WINDOW='Kodi'
SCREEN_LEFT_POSITION="0,0"
SCREEN_RIGHT_POSITION="1920,0"
# Position Kodi Window function
position_kodi_window()
{
# Wait for Kodi Window
while [ -z "`wmctrl -l | grep \"$WINDOW\"`" ]
do
sleep 1
done
# Make sure Kodi is a free floating window
wmctrl -r "$WINDOW" -b remove,fullscreen
# Relax a little before next action
sleep 0.5
wmctrl -r "$WINDOW" -b remove,maximized_vert,maximized_horz
# Relax a little before next action
sleep 0.5
# Position Kodi window on correct screen
if [ "$1" = "left" ]
then
wmctrl -r "$WINDOW" -e '0,'"$SCREEN_LEFT_POSITION"',-1,-1'
elif [ "$1" = "right" ]
then
wmctrl -r "$WINDOW" -e '0,'"$SCREEN_RIGHT_POSITION"',-1,-1'
fi
# Relax a little before next action
sleep 0.5
# Make it fullscreen
wmctrl -r "$WINDOW" -b add,maximized_vert,maximized_horz
# Relax a little before next action
sleep 0.5
wmctrl -r "$WINDOW" -b add,fullscreen
}
start_kodi()
{
ps cax | grep 'kodi.bin' > /dev/null
if [ $? -ne 0 ]; then
SDL_VIDEO_ALLOW_SCREENSAVER=0 exec kodi
fi
}
# Main
case "$1" in
# Left screen
left)
SCREEN="left"
;;
# Right screen
right)
SCREEN="right"
;;
*)
echo ""
echo "Usage: $0 {left|right}"
exit 1
esac
position_kodi_window "$SCREEN" & start_kodi