aboutsummaryrefslogtreecommitdiff
path: root/scripts/vnc.sh
blob: ad9fefd6fa85e3f38248d54ce6eccf4c5aeb5838 (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
#!/usr/bin/env bash

set -eou

cleanup() {
    echo "Stopping VNC and i3..."

    kill -INT "$i3_pid" 2>/dev/null || true
    kill -INT "$vnc_pid" 2>/dev/null || true

    wait "$i3_pid" 2>/dev/null || true
    wait "$vnc_pid" 2>/dev/null || true
}

trap cleanup INT TERM EXIT

Xvnc :1 \
    -geometry 1920x1080 \
    -depth 24 \
    -rfbauth ~/.config/vnc/passwd &

vnc_pid=$!

sleep 1

DISPLAY=:1 \
I3SOCK=/tmp/i3-vnc.sock \
i3 -c ~/.config/i3/vnc &

i3_pid=$!

wait "$vnc_pid" "$i3_pid"