askrobots / network-computer
Public
Your phone is the terminal. Stream a Linux/Mac desktop to an iPhone over WebRTC through NAT, with audio and input. Open source, single binaries.
Dan Quellhorst
Firefox policy: no WebRTC mDNS (a page using WebRTC made Firefox listen on UDP 5353)
a1d92f3
1 month, 3 weeks ago
History
nc-dashboard · 1.1 KB · 26 lines
| 1 | #!/bin/sh |
| 2 | # The desktop dashboard (started at login): one at a time, and its layout |
| 3 | # follows the screen. A phone-sized screen gets three lines, a middling one |
| 4 | # six, a big one everything (/etc/nc-dashboard/{mini,compact,conky}.conf): |
| 5 | # the most important first, the rest where there is room. The screen size is |
| 6 | # checked every few seconds (the desk resizes to the device you connect from) |
| 7 | # and conky restarted only when the layout changes. See docs/DESIGN.md. |
| 8 | LOCK="${XDG_RUNTIME_DIR:-/tmp}/nc-dashboard.lock" |
| 9 | exec 9>"$LOCK" |
| 10 | flock -n 9 || { pkill -u "$(id -u)" -x conky; exec flock 9 "$0" "$@"; } # one watcher |
| 11 | layout() { |
| 12 | xdpyinfo 2>/dev/null | awk '/dimensions/ { split($2, d, "x"); w = d[1]; h = d[2] |
| 13 | if (h < 600 || w < 800) print "mini"; else if (h < 900 || w < 1400) print "compact"; else print "conky"; exit }' |
| 14 | } |
| 15 | cur="" |
| 16 | while true; do |
| 17 | l=$(layout) |
| 18 | [ -n "$l" ] || l=conky |
| 19 | if [ "$l" != "$cur" ] || ! pgrep -u "$(id -u)" -x conky >/dev/null; then |
| 20 | pkill -u "$(id -u)" -x conky 2>/dev/null |
| 21 | sleep 0.3 |
| 22 | conky -c "/etc/nc-dashboard/$l.conf" >/dev/null 2>&1 & |
| 23 | cur=$l |
| 24 | fi |
| 25 | sleep 3 |
| 26 | done |