-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathorangepi.sh
More file actions
executable file
·66 lines (58 loc) · 2.26 KB
/
orangepi.sh
File metadata and controls
executable file
·66 lines (58 loc) · 2.26 KB
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
# DSKY launcher for Orange Pi
# - Starts `next-dsky` (server + UI) and opens Chromium fullscreen
# - In appliance mode (default): sets up display, black screen until ready
# - Cron mode: re-opens Chromium if it crashed
#
# Display overrides (env vars, set in ~/.xsession before calling this script):
# DSKY_XRANDR_OUTPUT xrandr output name (default: HDMI-1)
# DSKY_XRANDR_TRANSFORM xrandr --transform matrix (default: 0,-1,544,1,0,0,0,0,1)
# For the 800x480 LCD use: 0,-1,480,1,0,0,0,0,1
XRANDR_OUTPUT="${DSKY_XRANDR_OUTPUT:-HDMI-1}"
XRANDR_TRANSFORM="${DSKY_XRANDR_TRANSFORM:-0,-1,544,1,0,0,0,0,1}"
if [ "$1" = "cron" ]; then
killall chromium-browser chromium &>/dev/null
if [ $? -eq 0 ]; then
export DISPLAY=:0
chromium-browser --start-fullscreen --incognito http://localhost:3000 >/dev/null 2>&1 &
sleep 5
wmctrl -a chromium
fi
else
# Black screen immediately, then rotate, then show splash
xsetroot -solid black
sleep 2
xrandr --output "$XRANDR_OUTPUT" --transform "$XRANDR_TRANSFORM"
# Now set the splash (after rotation so it uses the correct resolution)
SPLASH=~/DSKY/Programs/orangepi-utilities/splash.png
if [ -f "$SPLASH" ]; then
feh --bg-fill --no-fehbg "$SPLASH"
fi
# Disable screen blanking and power management
xset s off
xset -dpms
xset s noblank
# Hide cursor immediately
unclutter -idle 0 -root &>/dev/null &
while true; do
cd ~/DSKY/Programs/next-dsky
npm start -- \
-s /dev/ttyUSB0 \
--shutdown 'shutdown -h now' \
--reboot 'shutdown -r now' \
--wifi-connect "$@" &
next_pid=$!
killall chromium-browser chromium &>/dev/null
# Wait until the :3000 app is actually responding before opening Chromium.
while true; do
curl -fsS http://localhost:3000 >/dev/null 2>&1 && break
sleep 1
done
chromium-browser --start-fullscreen --incognito \
--noerrdialogs --disable-infobars --disable-session-crashed-bubble \
--no-default-browser-check --no-first-run \
http://localhost:3000/?view=screen >/dev/null 2>&1 &
sleep 5
wait "$next_pid"
done
fi