replicas-computer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/assets/desktop/brand-wallpaper.svg +54 -0
- package/assets/desktop/geist-mono.woff2 +0 -0
- package/assets/desktop/gtk-settings.ini +11 -0
- package/assets/desktop/novnc-index.html +282 -0
- package/assets/desktop/openbox-rc.xml +79 -0
- package/assets/desktop/openbox-theme/close.xbm +7 -0
- package/assets/desktop/openbox-theme/close_hover.xbm +7 -0
- package/assets/desktop/openbox-theme/close_pressed.xbm +7 -0
- package/assets/desktop/openbox-theme/iconify.xbm +7 -0
- package/assets/desktop/openbox-theme/iconify_hover.xbm +7 -0
- package/assets/desktop/openbox-theme/iconify_pressed.xbm +7 -0
- package/assets/desktop/openbox-theme/max.xbm +7 -0
- package/assets/desktop/openbox-theme/max_hover.xbm +7 -0
- package/assets/desktop/openbox-theme/max_pressed.xbm +7 -0
- package/assets/desktop/openbox-theme/max_toggled.xbm +7 -0
- package/assets/desktop/openbox-theme/max_toggled_hover.xbm +7 -0
- package/assets/desktop/openbox-theme/max_toggled_pressed.xbm +7 -0
- package/assets/desktop/openbox-theme/themerc +66 -0
- package/assets/desktop/picom.conf +44 -0
- package/assets/desktop/replicas-chrome +52 -0
- package/assets/desktop/replicas-chrome.desktop +21 -0
- package/assets/desktop/start-services.sh +383 -0
- package/assets/desktop/tint2rc +91 -0
- package/dist/index.js +3287 -0
- package/package.json +42 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set +e
|
|
3
|
+
|
|
4
|
+
STATE_DIR="${REPLICAS_DESKTOP_STATE_DIR:-/tmp/replicas-computer}"
|
|
5
|
+
PROFILE_DIR="${REPLICAS_DESKTOP_CHROME_PROFILE_DIR:-$STATE_DIR/chrome-profile}"
|
|
6
|
+
DEBUG_PORT="${REPLICAS_DESKTOP_CHROME_DEBUG_PORT:-9222}"
|
|
7
|
+
MARKER="$PROFILE_DIR/.replicas-chrome-seeded"
|
|
8
|
+
PREFERENCES="$PROFILE_DIR/Default/Preferences"
|
|
9
|
+
|
|
10
|
+
mkdir -p "$PROFILE_DIR/Default"
|
|
11
|
+
|
|
12
|
+
if [ ! -f "$MARKER" ]; then
|
|
13
|
+
touch "$PROFILE_DIR/First Run"
|
|
14
|
+
|
|
15
|
+
if [ ! -f "$PREFERENCES" ]; then
|
|
16
|
+
cat > "$PREFERENCES" <<'JSON'
|
|
17
|
+
{
|
|
18
|
+
"browser": {
|
|
19
|
+
"first_run_finished": true,
|
|
20
|
+
"has_seen_welcome_page": true,
|
|
21
|
+
"should_reset_check_default_browser": false
|
|
22
|
+
},
|
|
23
|
+
"distribution": {
|
|
24
|
+
"make_chrome_default": false,
|
|
25
|
+
"show_welcome_page": false,
|
|
26
|
+
"skip_first_run_ui": true,
|
|
27
|
+
"suppress_first_run_default_browser_prompt": true
|
|
28
|
+
},
|
|
29
|
+
"signin": {
|
|
30
|
+
"allowed": false
|
|
31
|
+
},
|
|
32
|
+
"sync_promo": {
|
|
33
|
+
"show_on_first_run_allowed": false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
JSON
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
touch "$MARKER"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
exec /usr/bin/google-chrome-stable \
|
|
43
|
+
--user-data-dir="$PROFILE_DIR" \
|
|
44
|
+
--profile-directory=Default \
|
|
45
|
+
--no-first-run \
|
|
46
|
+
--no-default-browser-check \
|
|
47
|
+
--disable-search-engine-choice-screen \
|
|
48
|
+
--disable-sync \
|
|
49
|
+
--remote-debugging-address=127.0.0.1 \
|
|
50
|
+
--remote-debugging-port="$DEBUG_PORT" \
|
|
51
|
+
--start-maximized \
|
|
52
|
+
"$@"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[Desktop Entry]
|
|
2
|
+
Version=1.0
|
|
3
|
+
Name=Google Chrome
|
|
4
|
+
GenericName=Web Browser
|
|
5
|
+
Comment=Access the Internet
|
|
6
|
+
Exec=/usr/local/bin/replicas-chrome %U
|
|
7
|
+
StartupNotify=true
|
|
8
|
+
Terminal=false
|
|
9
|
+
Icon=google-chrome
|
|
10
|
+
Type=Application
|
|
11
|
+
Categories=Network;WebBrowser;
|
|
12
|
+
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/google-chrome;
|
|
13
|
+
Actions=new-window;new-private-window;
|
|
14
|
+
|
|
15
|
+
[Desktop Action new-window]
|
|
16
|
+
Name=New Window
|
|
17
|
+
Exec=/usr/local/bin/replicas-chrome
|
|
18
|
+
|
|
19
|
+
[Desktop Action new-private-window]
|
|
20
|
+
Name=New Incognito Window
|
|
21
|
+
Exec=/usr/local/bin/replicas-chrome --incognito
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Idempotent. Best-effort during engine boot; CLI callers get a nonzero exit if
|
|
3
|
+
# another process holds the startup lock long enough that repair did not run.
|
|
4
|
+
|
|
5
|
+
set +e
|
|
6
|
+
|
|
7
|
+
DISPLAY_NUM="${REPLICAS_DESKTOP_DISPLAY:-99}"
|
|
8
|
+
DISPLAY_NUM="${DISPLAY_NUM#:}"
|
|
9
|
+
RESOLUTION="${REPLICAS_DESKTOP_RESOLUTION:-}"
|
|
10
|
+
if [ -n "$RESOLUTION" ]; then
|
|
11
|
+
WIDTH="${RESOLUTION%x*}"
|
|
12
|
+
HEIGHT="${RESOLUTION#*x}"
|
|
13
|
+
else
|
|
14
|
+
WIDTH="${REPLICAS_DESKTOP_WIDTH:-1920}"
|
|
15
|
+
HEIGHT="${REPLICAS_DESKTOP_HEIGHT:-1080}"
|
|
16
|
+
fi
|
|
17
|
+
case "$WIDTH:$HEIGHT" in
|
|
18
|
+
'':*|*:''|*[!0-9:]*)
|
|
19
|
+
WIDTH=1920
|
|
20
|
+
HEIGHT=1080
|
|
21
|
+
;;
|
|
22
|
+
esac
|
|
23
|
+
if [ "$WIDTH" -lt 1920 ] || [ "$HEIGHT" -lt 1080 ]; then
|
|
24
|
+
WIDTH=1920
|
|
25
|
+
HEIGHT=1080
|
|
26
|
+
fi
|
|
27
|
+
DEPTH="${REPLICAS_DESKTOP_DEPTH:-24}"
|
|
28
|
+
VNC_PORT="${REPLICAS_DESKTOP_VNC_PORT:-5900}"
|
|
29
|
+
NOVNC_PORT="${REPLICAS_DESKTOP_NOVNC_PORT:-6080}"
|
|
30
|
+
STATE_DIR="${REPLICAS_DESKTOP_STATE_DIR:-/tmp/replicas-computer}"
|
|
31
|
+
VNC_STARTUP_WAIT_MS="${REPLICAS_DESKTOP_VNC_STARTUP_WAIT_MS:-1}"
|
|
32
|
+
VNC_STARTUP_DEFER_MS="${REPLICAS_DESKTOP_VNC_STARTUP_DEFER_MS:-0}"
|
|
33
|
+
VNC_STARTUP_SETDEFER="${REPLICAS_DESKTOP_VNC_STARTUP_SETDEFER:--1}"
|
|
34
|
+
VNC_WAIT_MS="${REPLICAS_DESKTOP_VNC_WAIT_MS:-0}"
|
|
35
|
+
VNC_DEFER_MS="${REPLICAS_DESKTOP_VNC_DEFER_MS:-0}"
|
|
36
|
+
VNC_SETDEFER="${REPLICAS_DESKTOP_VNC_SETDEFER:--1}"
|
|
37
|
+
X11VNC_EXTRA_ARGS="${REPLICAS_DESKTOP_X11VNC_EXTRA_ARGS:-}"
|
|
38
|
+
COMPOSITOR="${REPLICAS_DESKTOP_COMPOSITOR:-0}"
|
|
39
|
+
CHROME_PROFILE_DIR="${REPLICAS_DESKTOP_CHROME_PROFILE_DIR:-$STATE_DIR/chrome-profile}"
|
|
40
|
+
LOCK_BUSY_EXIT_CODE="${REPLICAS_DESKTOP_LOCK_BUSY_EXIT_CODE:-75}"
|
|
41
|
+
LOCK_FILE="${REPLICAS_DESKTOP_LOCK_FILE:-$STATE_DIR/services-start.lock}"
|
|
42
|
+
|
|
43
|
+
mkdir -p "$STATE_DIR"
|
|
44
|
+
|
|
45
|
+
acquire_start_lock() {
|
|
46
|
+
if command -v flock >/dev/null 2>&1; then
|
|
47
|
+
exec 9>"$LOCK_FILE"
|
|
48
|
+
if ! flock -w "${REPLICAS_DESKTOP_START_LOCK_WAIT_SECONDS:-15}" 9; then
|
|
49
|
+
echo "desktop services startup already in progress" >&2
|
|
50
|
+
exit "$LOCK_BUSY_EXIT_CODE"
|
|
51
|
+
fi
|
|
52
|
+
else
|
|
53
|
+
LOCK_DIR="$LOCK_FILE.d"
|
|
54
|
+
if ! mkdir "$LOCK_DIR" 2>/dev/null; then
|
|
55
|
+
echo "desktop services startup already in progress" >&2
|
|
56
|
+
exit "$LOCK_BUSY_EXIT_CODE"
|
|
57
|
+
fi
|
|
58
|
+
trap 'rmdir "$LOCK_DIR" 2>/dev/null || true' EXIT
|
|
59
|
+
fi
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
start_bg() {
|
|
63
|
+
local name="$1"
|
|
64
|
+
local test_cmd="$2"
|
|
65
|
+
local run_cmd="$3"
|
|
66
|
+
local pid_file="$STATE_DIR/$name.pid"
|
|
67
|
+
if [ -s "$pid_file" ]; then
|
|
68
|
+
local pid
|
|
69
|
+
pid="$(cat "$pid_file" 2>/dev/null)"
|
|
70
|
+
if [ -n "$pid" ] && kill -0 "$pid" >/dev/null 2>&1; then
|
|
71
|
+
return 0
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
if eval "$test_cmd" >/dev/null 2>&1; then
|
|
75
|
+
return 0
|
|
76
|
+
fi
|
|
77
|
+
nohup setsid bash -c "exec 9>&-; $run_cmd" >> "$STATE_DIR/$name.log" 2>&1 &
|
|
78
|
+
echo $! > "$pid_file"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
count_lines() {
|
|
82
|
+
awk 'NF { count++ } END { print count + 0 }'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
port_listener_pids() {
|
|
86
|
+
local port="$1"
|
|
87
|
+
local name="$2"
|
|
88
|
+
ss -H -ltnp "sport = :$port" 2>/dev/null | grep "$name" | grep -o 'pid=[0-9][0-9]*' | cut -d= -f2 | sort -u
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
x11vnc_listener_pids() {
|
|
92
|
+
port_listener_pids "$VNC_PORT" 'x11vnc'
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
websockify_listener_pids() {
|
|
96
|
+
port_listener_pids "$NOVNC_PORT" 'websockify'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
x11vnc_pids() {
|
|
100
|
+
{ x11vnc_listener_pids; pgrep -f "[x]11vnc .* -rfbport $VNC_PORT" 2>/dev/null; } | sort -u
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
websockify_pids() {
|
|
104
|
+
{ websockify_listener_pids; pgrep -f "[w]ebsockify .* $NOVNC_PORT localhost:$VNC_PORT" 2>/dev/null; } | sort -u
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
root_pids() {
|
|
108
|
+
local pids="$1"
|
|
109
|
+
local candidate
|
|
110
|
+
local is_child
|
|
111
|
+
local pid
|
|
112
|
+
local ppid
|
|
113
|
+
for pid in $pids; do
|
|
114
|
+
ppid="$(ps -o ppid= -p "$pid" 2>/dev/null | tr -d ' ')"
|
|
115
|
+
[ -n "$ppid" ] || continue
|
|
116
|
+
is_child=0
|
|
117
|
+
for candidate in $pids; do
|
|
118
|
+
if [ "$candidate" = "$ppid" ]; then
|
|
119
|
+
is_child=1
|
|
120
|
+
break
|
|
121
|
+
fi
|
|
122
|
+
done
|
|
123
|
+
[ "$is_child" = "0" ] && echo "$pid"
|
|
124
|
+
done | sort -u
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
websockify_root_pids() {
|
|
128
|
+
root_pids "$(websockify_pids)"
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
websockify_listener_root_pids() {
|
|
132
|
+
root_pids "$(websockify_listener_pids)"
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
has_x11vnc() {
|
|
136
|
+
[ "$(x11vnc_listener_pids | count_lines)" -gt 0 ]
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
has_websockify() {
|
|
140
|
+
[ "$(websockify_listener_root_pids | count_lines)" -gt 0 ]
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
listen_recvq() {
|
|
144
|
+
local port="$1"
|
|
145
|
+
ss -H -ltn "sport = :$port" 2>/dev/null | awk '{
|
|
146
|
+
for (i = 1; i < NF; i++) {
|
|
147
|
+
if ($i == "LISTEN") {
|
|
148
|
+
sum += $(i + 1)
|
|
149
|
+
break
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} END { print sum + 0 }'
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
json_number_array() {
|
|
156
|
+
local first=1
|
|
157
|
+
local value
|
|
158
|
+
printf '['
|
|
159
|
+
for value in $1; do
|
|
160
|
+
if [ "$first" = "1" ]; then
|
|
161
|
+
first=0
|
|
162
|
+
else
|
|
163
|
+
printf ','
|
|
164
|
+
fi
|
|
165
|
+
printf '%s' "$value"
|
|
166
|
+
done
|
|
167
|
+
printf ']'
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
bridge_status_json() {
|
|
171
|
+
local x11vnc_listeners
|
|
172
|
+
local websockify_listeners
|
|
173
|
+
local websockify_roots
|
|
174
|
+
x11vnc_listeners="$(x11vnc_listener_pids)"
|
|
175
|
+
websockify_listeners="$(websockify_listener_pids)"
|
|
176
|
+
websockify_roots="$(websockify_listener_root_pids)"
|
|
177
|
+
printf '{"x11vnc":{"port":%s,"listeners":%s,"listenerPids":' "$VNC_PORT" "$(printf '%s\n' "$x11vnc_listeners" | count_lines)"
|
|
178
|
+
json_number_array "$x11vnc_listeners"
|
|
179
|
+
printf ',"backlog":%s},"websockify":{"port":%s,"rootListeners":%s,"listenerPids":' "$(listen_recvq "$VNC_PORT")" "$NOVNC_PORT" "$(printf '%s\n' "$websockify_roots" | count_lines)"
|
|
180
|
+
json_number_array "$websockify_listeners"
|
|
181
|
+
printf ',"rootPids":'
|
|
182
|
+
json_number_array "$websockify_roots"
|
|
183
|
+
printf '}}\n'
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if [ "$1" = "--status-json" ]; then
|
|
187
|
+
bridge_status_json
|
|
188
|
+
exit 0
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
kill_pids() {
|
|
192
|
+
local pids="$1"
|
|
193
|
+
local pid
|
|
194
|
+
[ -n "$pids" ] || return 0
|
|
195
|
+
for pid in $pids; do
|
|
196
|
+
[ "$pid" = "$$" ] && continue
|
|
197
|
+
kill "$pid" 2>/dev/null || true
|
|
198
|
+
done
|
|
199
|
+
sleep 0.2
|
|
200
|
+
for pid in $pids; do
|
|
201
|
+
[ "$pid" = "$$" ] && continue
|
|
202
|
+
if kill -0 "$pid" >/dev/null 2>&1; then
|
|
203
|
+
kill -KILL "$pid" 2>/dev/null || true
|
|
204
|
+
fi
|
|
205
|
+
done
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if [ "$1" = "--stop" ]; then
|
|
209
|
+
acquire_start_lock
|
|
210
|
+
for pid_file in "$STATE_DIR"/*.pid; do
|
|
211
|
+
[ -e "$pid_file" ] || continue
|
|
212
|
+
kill_pids "$(cat "$pid_file" 2>/dev/null)"
|
|
213
|
+
rm -f "$pid_file"
|
|
214
|
+
done
|
|
215
|
+
kill_pids "$(websockify_pids)"
|
|
216
|
+
kill_pids "$(x11vnc_pids)"
|
|
217
|
+
pkill -TERM -f "[X]vfb :$DISPLAY_NUM( |$)" 2>/dev/null || true
|
|
218
|
+
pkill -TERM -f "[o]penbox" 2>/dev/null || true
|
|
219
|
+
pkill -TERM -f "[t]int2" 2>/dev/null || true
|
|
220
|
+
pkill -TERM -f "[p]icom" 2>/dev/null || true
|
|
221
|
+
exit 0
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
bridge_needs_restart() {
|
|
225
|
+
local vnc_count
|
|
226
|
+
local novnc_count
|
|
227
|
+
local vnc_proc_count
|
|
228
|
+
local novnc_proc_count
|
|
229
|
+
vnc_count="$(x11vnc_listener_pids | count_lines)"
|
|
230
|
+
novnc_count="$(websockify_listener_root_pids | count_lines)"
|
|
231
|
+
vnc_proc_count="$(x11vnc_pids | count_lines)"
|
|
232
|
+
novnc_proc_count="$(websockify_root_pids | count_lines)"
|
|
233
|
+
[ "$vnc_count" -gt 1 ] && return 0
|
|
234
|
+
[ "$novnc_count" -gt 1 ] && return 0
|
|
235
|
+
[ "$vnc_proc_count" -gt 1 ] && return 0
|
|
236
|
+
[ "$novnc_proc_count" -gt 1 ] && return 0
|
|
237
|
+
return 1
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
restart_bridge() {
|
|
241
|
+
echo "repairing desktop bridge"
|
|
242
|
+
kill_pids "$(websockify_pids)"
|
|
243
|
+
kill_pids "$(x11vnc_pids)"
|
|
244
|
+
rm -f "$STATE_DIR/x11vnc.pid" "$STATE_DIR/novnc.pid"
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
clear_bridge_pid_if_unhealthy() {
|
|
248
|
+
local name="$1"
|
|
249
|
+
local health_cmd="$2"
|
|
250
|
+
local pids_cmd="$3"
|
|
251
|
+
local pid_file="$STATE_DIR/$name.pid"
|
|
252
|
+
local pids
|
|
253
|
+
if eval "$health_cmd" >/dev/null 2>&1; then
|
|
254
|
+
return 0
|
|
255
|
+
fi
|
|
256
|
+
pids="$("$pids_cmd")"
|
|
257
|
+
kill_pids "$pids"
|
|
258
|
+
rm -f "$pid_file"
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
paint_wallpaper() {
|
|
262
|
+
local wallpaper="${REPLICAS_DESKTOP_WALLPAPER:-$REPLICAS_DESKTOP_TEMPLATES/brand-wallpaper.svg}"
|
|
263
|
+
local rendered_wallpaper="$STATE_DIR/wallpaper-${WIDTH}x${HEIGHT}.png"
|
|
264
|
+
local dock_height="${REPLICAS_DESKTOP_DOCK_HEIGHT:-92}"
|
|
265
|
+
if command -v ffmpeg >/dev/null 2>&1 && [ -f "$wallpaper" ] && [ ! -f "$rendered_wallpaper" ]; then
|
|
266
|
+
ffmpeg -y -loglevel error \
|
|
267
|
+
-i "$wallpaper" \
|
|
268
|
+
-vf "scale=${WIDTH}:${HEIGHT}:force_original_aspect_ratio=increase,crop=${WIDTH}:${HEIGHT},drawbox=x=0:y=ih-${dock_height}:w=iw:h=${dock_height}:color=0x0b1020@0.86:t=fill" \
|
|
269
|
+
-frames:v 1 "$rendered_wallpaper" >/dev/null 2>&1 || true
|
|
270
|
+
fi
|
|
271
|
+
|
|
272
|
+
if command -v hsetroot >/dev/null 2>&1 && [ -f "$rendered_wallpaper" ]; then
|
|
273
|
+
DISPLAY=":$DISPLAY_NUM" hsetroot -fill "$rendered_wallpaper" >/dev/null 2>&1 || true
|
|
274
|
+
elif command -v hsetroot >/dev/null 2>&1 && [ -f "$wallpaper" ]; then
|
|
275
|
+
DISPLAY=":$DISPLAY_NUM" hsetroot -cover "$wallpaper" >/dev/null 2>&1 || true
|
|
276
|
+
elif command -v hsetroot >/dev/null 2>&1; then
|
|
277
|
+
DISPLAY=":$DISPLAY_NUM" hsetroot -solid '#0d1117' >/dev/null 2>&1 || true
|
|
278
|
+
else
|
|
279
|
+
DISPLAY=":$DISPLAY_NUM" xsetroot -solid '#0d1117' >/dev/null 2>&1 || true
|
|
280
|
+
fi
|
|
281
|
+
DISPLAY=":$DISPLAY_NUM" xsetroot -cursor_name left_ptr >/dev/null 2>&1 || true
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
acquire_start_lock
|
|
285
|
+
|
|
286
|
+
export XCURSOR_THEME="${XCURSOR_THEME:-Bibata-Modern-Ice}"
|
|
287
|
+
export XCURSOR_SIZE="${XCURSOR_SIZE:-22}"
|
|
288
|
+
export GTK_THEME="${GTK_THEME:-Yaru-dark}"
|
|
289
|
+
export GTK_ICON_THEME="${GTK_ICON_THEME:-Yaru}"
|
|
290
|
+
|
|
291
|
+
REPLICAS_DESKTOP_TEMPLATES="${REPLICAS_DESKTOP_TEMPLATES:-/usr/local/share/replicas/desktop}"
|
|
292
|
+
mkdir -p \
|
|
293
|
+
"$HOME/.config/tint2" \
|
|
294
|
+
"$HOME/.config/openbox" \
|
|
295
|
+
"$HOME/.config/picom" \
|
|
296
|
+
"$HOME/.config/gtk-3.0" \
|
|
297
|
+
"$HOME/.themes/Replicas-modern/openbox-3" \
|
|
298
|
+
"$HOME/.icons/default"
|
|
299
|
+
|
|
300
|
+
[ -f "$REPLICAS_DESKTOP_TEMPLATES/tint2rc" ] && cp "$REPLICAS_DESKTOP_TEMPLATES/tint2rc" "$HOME/.config/tint2/tint2rc"
|
|
301
|
+
[ -f "$REPLICAS_DESKTOP_TEMPLATES/openbox-rc.xml" ] && cp "$REPLICAS_DESKTOP_TEMPLATES/openbox-rc.xml" "$HOME/.config/openbox/rc.xml"
|
|
302
|
+
[ -f "$REPLICAS_DESKTOP_TEMPLATES/picom.conf" ] && cp "$REPLICAS_DESKTOP_TEMPLATES/picom.conf" "$HOME/.config/picom/picom.conf"
|
|
303
|
+
[ -f "$REPLICAS_DESKTOP_TEMPLATES/gtk-settings.ini" ] && cp "$REPLICAS_DESKTOP_TEMPLATES/gtk-settings.ini" "$HOME/.config/gtk-3.0/settings.ini"
|
|
304
|
+
if [ -d "$REPLICAS_DESKTOP_TEMPLATES/openbox-theme" ]; then
|
|
305
|
+
cp "$REPLICAS_DESKTOP_TEMPLATES/openbox-theme/"* "$HOME/.themes/Replicas-modern/openbox-3/" 2>/dev/null || true
|
|
306
|
+
fi
|
|
307
|
+
if [ -f "$REPLICAS_DESKTOP_TEMPLATES/replicas-chrome" ]; then
|
|
308
|
+
sudo install -m 0755 "$REPLICAS_DESKTOP_TEMPLATES/replicas-chrome" /usr/local/bin/replicas-chrome 2>/dev/null || true
|
|
309
|
+
fi
|
|
310
|
+
if [ -f "$REPLICAS_DESKTOP_TEMPLATES/replicas-chrome.desktop" ]; then
|
|
311
|
+
sudo install -m 0644 "$REPLICAS_DESKTOP_TEMPLATES/replicas-chrome.desktop" /usr/share/applications/replicas-chrome.desktop 2>/dev/null || true
|
|
312
|
+
fi
|
|
313
|
+
if command -v replicas-chrome >/dev/null 2>&1; then
|
|
314
|
+
REPLICAS_DESKTOP_CHROME_PROFILE_DIR="$CHROME_PROFILE_DIR" replicas-chrome --version >/dev/null 2>&1 || true
|
|
315
|
+
fi
|
|
316
|
+
cat > "$HOME/.icons/default/index.theme" <<EOF
|
|
317
|
+
[Icon Theme]
|
|
318
|
+
Inherits=$XCURSOR_THEME
|
|
319
|
+
EOF
|
|
320
|
+
|
|
321
|
+
start_bg xvfb \
|
|
322
|
+
"pgrep -af 'Xvfb :$DISPLAY_NUM '" \
|
|
323
|
+
"exec Xvfb :$DISPLAY_NUM -screen 0 ${WIDTH}x${HEIGHT}x${DEPTH} -ac +extension RANDR +extension GLX"
|
|
324
|
+
|
|
325
|
+
for _ in $(seq 1 30); do
|
|
326
|
+
if DISPLAY=":$DISPLAY_NUM" xdpyinfo >/dev/null 2>&1; then break; fi
|
|
327
|
+
sleep 0.1
|
|
328
|
+
done
|
|
329
|
+
|
|
330
|
+
# Paint twice because some themes reset root pixmap during startup.
|
|
331
|
+
paint_wallpaper
|
|
332
|
+
|
|
333
|
+
start_bg openbox \
|
|
334
|
+
"DISPLAY=:$DISPLAY_NUM xprop -root _NET_SUPPORTING_WM_CHECK 2>/dev/null | grep -q 'window id'" \
|
|
335
|
+
"DISPLAY=:$DISPLAY_NUM exec openbox"
|
|
336
|
+
sleep 0.2
|
|
337
|
+
paint_wallpaper
|
|
338
|
+
|
|
339
|
+
# tint2 panel anchors window stacking on bare openbox.
|
|
340
|
+
start_bg tint2 \
|
|
341
|
+
"false" \
|
|
342
|
+
"DISPLAY=:$DISPLAY_NUM exec tint2"
|
|
343
|
+
|
|
344
|
+
if [ "$COMPOSITOR" = "1" ]; then
|
|
345
|
+
start_bg picom \
|
|
346
|
+
"false" \
|
|
347
|
+
"DISPLAY=:$DISPLAY_NUM exec picom --config $HOME/.config/picom/picom.conf --no-fading-openclose"
|
|
348
|
+
fi
|
|
349
|
+
|
|
350
|
+
if bridge_needs_restart; then
|
|
351
|
+
restart_bridge
|
|
352
|
+
fi
|
|
353
|
+
clear_bridge_pid_if_unhealthy x11vnc has_x11vnc x11vnc_pids
|
|
354
|
+
clear_bridge_pid_if_unhealthy novnc has_websockify websockify_pids
|
|
355
|
+
|
|
356
|
+
start_bg x11vnc \
|
|
357
|
+
"has_x11vnc" \
|
|
358
|
+
"exec x11vnc -display :$DISPLAY_NUM -nopw -listen 127.0.0.1 -xkb -forever -shared -rfbport $VNC_PORT -desktop 'Replicas' -nobell -defer $VNC_STARTUP_DEFER_MS -wait $VNC_STARTUP_WAIT_MS -setdefer $VNC_STARTUP_SETDEFER -nonap -threads -input_eagerly -snapfb -onetile -nowireframe -speeds lan $X11VNC_EXTRA_ARGS -quiet"
|
|
359
|
+
|
|
360
|
+
for _ in $(seq 1 20); do
|
|
361
|
+
if x11vnc -display ":$DISPLAY_NUM" -query pid >/dev/null 2>&1; then break; fi
|
|
362
|
+
sleep 0.1
|
|
363
|
+
done
|
|
364
|
+
x11vnc -display ":$DISPLAY_NUM" -remote "defer:$VNC_DEFER_MS" >/dev/null 2>&1 || true
|
|
365
|
+
x11vnc -display ":$DISPLAY_NUM" -remote "wait:$VNC_WAIT_MS" >/dev/null 2>&1 || true
|
|
366
|
+
x11vnc -display ":$DISPLAY_NUM" -remote "setdefer:$VNC_SETDEFER" >/dev/null 2>&1 || true
|
|
367
|
+
|
|
368
|
+
NOVNC_WEBROOT="${REPLICAS_DESKTOP_NOVNC_WEBROOT:-/usr/share/novnc}"
|
|
369
|
+
if [ ! -d "$NOVNC_WEBROOT" ]; then
|
|
370
|
+
NOVNC_WEBROOT="/usr/share/novnc-common"
|
|
371
|
+
fi
|
|
372
|
+
|
|
373
|
+
# Fallback install for dev workspaces booted on older images that predate
|
|
374
|
+
# the package-managed /usr/share/novnc/index.html.
|
|
375
|
+
if [ ! -f "$NOVNC_WEBROOT/index.html" ] && [ -f "$REPLICAS_DESKTOP_TEMPLATES/novnc-index.html" ]; then
|
|
376
|
+
sudo install -m 0644 "$REPLICAS_DESKTOP_TEMPLATES/novnc-index.html" "$NOVNC_WEBROOT/index.html" 2>/dev/null || true
|
|
377
|
+
fi
|
|
378
|
+
|
|
379
|
+
start_bg novnc \
|
|
380
|
+
"has_websockify" \
|
|
381
|
+
"exec websockify --web=$NOVNC_WEBROOT $NOVNC_PORT localhost:$VNC_PORT"
|
|
382
|
+
|
|
383
|
+
exit 0
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
panel_items = LTC
|
|
2
|
+
panel_size = 100% 84
|
|
3
|
+
panel_margin = 0 0
|
|
4
|
+
panel_padding = 18 12 18
|
|
5
|
+
panel_background_id = 1
|
|
6
|
+
wm_menu = 0
|
|
7
|
+
panel_dock = 0
|
|
8
|
+
panel_position = bottom center horizontal
|
|
9
|
+
panel_layer = top
|
|
10
|
+
panel_monitor = all
|
|
11
|
+
panel_shrink = 0
|
|
12
|
+
strut_policy = follow_size
|
|
13
|
+
disable_transparency = 1
|
|
14
|
+
font_shadow = 0
|
|
15
|
+
|
|
16
|
+
rounded = 0
|
|
17
|
+
rounded = 16
|
|
18
|
+
border_width = 0
|
|
19
|
+
background_color = #ffffff 14
|
|
20
|
+
border_color = #000000 0
|
|
21
|
+
rounded = 16
|
|
22
|
+
border_width = 0
|
|
23
|
+
background_color = #1a1a1a 0
|
|
24
|
+
border_color = #000000 0
|
|
25
|
+
rounded = 16
|
|
26
|
+
border_width = 0
|
|
27
|
+
background_color = #ffffff 10
|
|
28
|
+
border_color = #000000 0
|
|
29
|
+
|
|
30
|
+
launcher_padding = 12 0 12
|
|
31
|
+
launcher_background_id = 1
|
|
32
|
+
launcher_icon_background_id = 4
|
|
33
|
+
launcher_icon_size = 54
|
|
34
|
+
launcher_icon_asb = 100 0 0
|
|
35
|
+
launcher_icon_theme = Yaru
|
|
36
|
+
launcher_item_app = /usr/share/applications/replicas-chrome.desktop
|
|
37
|
+
launcher_item_app = /usr/share/applications/thunar.desktop
|
|
38
|
+
launcher_item_app = /usr/share/applications/xfce4-terminal.desktop
|
|
39
|
+
launcher_item_app = /usr/share/applications/org.xfce.mousepad.desktop
|
|
40
|
+
|
|
41
|
+
taskbar_mode = single_desktop
|
|
42
|
+
taskbar_padding = 16 0 16
|
|
43
|
+
taskbar_background_id = 0
|
|
44
|
+
taskbar_active_background_id = 0
|
|
45
|
+
taskbar_name = 0
|
|
46
|
+
taskbar_distribute_size = 0
|
|
47
|
+
taskbar_sort_order = none
|
|
48
|
+
|
|
49
|
+
systray_padding = 8 0 8
|
|
50
|
+
systray_background_id = 1
|
|
51
|
+
systray_sort = ascending
|
|
52
|
+
systray_icon_size = 24
|
|
53
|
+
systray_icon_asb = 100 0 0
|
|
54
|
+
|
|
55
|
+
task_text = 0
|
|
56
|
+
task_icon = 1
|
|
57
|
+
task_centered = 1
|
|
58
|
+
task_align = center
|
|
59
|
+
urgent_nb_of_blink = 8
|
|
60
|
+
task_maximum_size = 62 58
|
|
61
|
+
task_padding = 10 0
|
|
62
|
+
task_tooltip = 1
|
|
63
|
+
task_font = Cantarell 10
|
|
64
|
+
task_font_color = #c8c8c8 100
|
|
65
|
+
task_active_font_color = #ffffff 100
|
|
66
|
+
task_background_id = 3
|
|
67
|
+
task_active_background_id = 4
|
|
68
|
+
task_iconified_background_id = 3
|
|
69
|
+
task_urgent_background_id = 4
|
|
70
|
+
task_icon_asb = 100 0 0
|
|
71
|
+
task_active_icon_asb = 100 0 0
|
|
72
|
+
|
|
73
|
+
time1_format = %H:%M
|
|
74
|
+
time2_format = %a %b %-d
|
|
75
|
+
time1_font = Cantarell bold 11
|
|
76
|
+
time2_font = Cantarell 8
|
|
77
|
+
clock_font_color = #ffffff 100
|
|
78
|
+
clock_padding = 18 0
|
|
79
|
+
clock_background_id = 1
|
|
80
|
+
|
|
81
|
+
tooltip_padding = 8 6
|
|
82
|
+
tooltip_show_timeout = 0.5
|
|
83
|
+
tooltip_hide_timeout = 0.1
|
|
84
|
+
tooltip_background_id = 1
|
|
85
|
+
tooltip_font_color = #ffffff 100
|
|
86
|
+
tooltip_font = Cantarell 10
|
|
87
|
+
|
|
88
|
+
mouse_middle = none
|
|
89
|
+
mouse_right = close
|
|
90
|
+
mouse_scroll_up = toggle
|
|
91
|
+
mouse_scroll_down = iconify
|