Copy of github.com/askrobots/network-computer (MIT): a desk you reach from anything. The original lives on GitHub.

2 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/demo/network-computer.git
HTTPS
https://gitstable.com/git/demo/network-computer.git
SSH
ssh://git@gitstable.com:2222/demo/network-computer.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

GitStable demo README: say this is a copy and where the original is cde82c2 14 hours, 3 minutes ago History
nc-session-setup · 5.1 KB · 83 lines
1#!/bin/sh
2# Per-session desktop settings, applied at every login (autostart) and by
3# provisioning. Safe to run again.
4[ "$(id -un)" = root ] && exec nc-as-user "$0" "$@"
5q() { xfconf-query -c xfce4-keyboard-shortcuts "$@"; }
6# Alt+Space: the search and launch bar; the window menu moves to Shift+Alt+Space
7q -p '/xfwm4/custom/<Alt>space' -r 2>/dev/null
8q -p '/xfwm4/custom/<Shift><Alt>space' -n -t string -s popup_menu_key 2>/dev/null || q -p '/xfwm4/custom/<Shift><Alt>space' -s popup_menu_key
9q -p '/commands/custom/<Alt>space' -n -t string -s nc-launch 2>/dev/null || q -p '/commands/custom/<Alt>space' -s nc-launch
10echo "shortcuts: Alt+Space search and launch; Shift+Alt+Space window menu"
11
12# an Object Server icon on the desktop, once (the user may delete it), marked
13# trusted so Xfce opens it without the "untrusted launcher" question
14D=$(xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME/Desktop"); L="$D/Object Server.desktop"
15if [ -e "$L" ] && ! grep -q '^Exec=nc-object-open' "$L"; then rm -f "$L" "$HOME/.config/nc/object-icon-placed"; fi # an older version
16if [ ! -e "$L" ] && [ ! -e "$HOME/.config/nc/object-icon-placed" ]; then
17 cp /usr/share/applications/nc-object-home.desktop "$L" && chmod +x "$L" &&
18 gio set -t string "$L" metadata::xfce-exe-checksum "$(sha256sum "$L" | cut -d' ' -f1)" 2>/dev/null
19 mkdir -p "$HOME/.config/nc" && touch "$HOME/.config/nc/object-icon-placed"
20fi
21
22# the dbbasic apps (nc-apps), Today and Radio on the desktop, so they are one double-click or
23# double-tap away: each placed once and marked trusted (no "untrusted
24# launcher" question); one you delete stays deleted; one installed later
25# appears (nc-apps install runs this)
26for f in /usr/share/applications/dbbasic-*.desktop /usr/share/applications/nc-today.desktop /usr/share/applications/nc-radio.desktop; do
27 [ -f "$f" ] || continue
28 # Today and Radio only while they are on (~/.config/nc/dashboard.env)
29 case $f in
30 */nc-today.desktop) grep -Eqi '^(WEATHER|NEWS)=(on|"on")?$' "$HOME/.config/nc/dashboard.env" 2>/dev/null ||
31 [ ! -e "$HOME/.config/nc/dashboard.env" ] || continue ;;
32 */nc-radio.desktop) grep -Eqi '^RADIO=(off|no|false|0|"off")' "$HOME/.config/nc/dashboard.env" 2>/dev/null && continue ;;
33 esac
34 n=$(basename "$f" .desktop); mark="$HOME/.config/nc/placed-$n"
35 # a copy placed before the apps had launchers: bring its command up to date
36 if [ -e "$D/$n.desktop" ] && grep -q '^Exec=/desk/apps/' "$D/$n.desktop"; then
37 sed -i "s|^Exec=.*|$(grep '^Exec=' "$f")|" "$D/$n.desktop"
38 gio set -t string "$D/$n.desktop" metadata::xfce-exe-checksum "$(sha256sum "$D/$n.desktop" | cut -d' ' -f1)" 2>/dev/null
39 fi
40 [ -e "$mark" ] && continue
41 cp "$f" "$D/$n.desktop" && chmod +x "$D/$n.desktop" &&
42 gio set -t string "$D/$n.desktop" metadata::xfce-exe-checksum "$(sha256sum "$D/$n.desktop" | cut -d' ' -f1)" 2>/dev/null
43 mkdir -p "$HOME/.config/nc" && touch "$mark"
44done
45
46# ~/Objects (the object server's files, nc-object-files): in the file manager's
47# side pane always, and on the desktop once, as a link the user may delete
48O="$HOME/Objects"; B="$HOME/.config/gtk-3.0/bookmarks"
49mkdir -p "$(dirname "$B")"
50grep -qs "^file://$O " "$B" || echo "file://$O Objects" >> "$B"
51if [ ! -e "$D/Objects" ] && [ ! -e "$HOME/.config/nc/objects-link-placed" ]; then
52 ln -s "$O" "$D/Objects" && mkdir -p "$HOME/.config/nc" && touch "$HOME/.config/nc/objects-link-placed"
53fi
54
55# notifications bottom right: top right is where browser tabs and window buttons are
56xfconf-query -c xfce4-notifyd -p /notify-location -n -t int -s 3 2>/dev/null || xfconf-query -c xfce4-notifyd -p /notify-location -s 3
57
58# a plain background, once: it streams far cheaper than a detailed picture, and the
59# dashboard sits on it (the user can pick any wallpaper afterwards)
60if [ ! -e "$HOME/.config/nc/plain-background" ]; then
61 props=$(xfconf-query -c xfce4-desktop -l 2>/dev/null | grep '/workspace[0-9]*/image-style$')
62 if [ -z "$props" ]; then # a brand-new desktop has written none yet: name them from the screen
63 for mon in $(xrandr --listmonitors 2>/dev/null | awk 'NR>1{print $NF}'); do
64 for ws in 0 1 2 3; do props="$props /backdrop/screen0/monitor$mon/workspace$ws/image-style"; done
65 done
66 fi
67 set_ok=""
68 for p in $props; do
69 b=${p%image-style}
70 xfconf-query -c xfce4-desktop -p "${b}image-style" -n -t int -s 0 2>/dev/null ||
71 xfconf-query -c xfce4-desktop -p "${b}image-style" -s 0 || continue # no image
72 xfconf-query -c xfce4-desktop -p "${b}color-style" -n -t int -s 0 2>/dev/null ||
73 xfconf-query -c xfce4-desktop -p "${b}color-style" -s 0 # solid color
74 xfconf-query -c xfce4-desktop -p "${b}rgba1" -n -t double -s 0.075 -t double -s 0.09 \
75 -t double -s 0.125 -t double -s 1 2>/dev/null ||
76 xfconf-query -c xfce4-desktop -p "${b}rgba1" -t double -s 0.075 -t double -s 0.09 \
77 -t double -s 0.125 -t double -s 1
78 set_ok=1
79 done
80 # done only once it worked: a first login may come before the desktop is ready
81 [ -z "$set_ok" ] || { mkdir -p "$HOME/.config/nc" && touch "$HOME/.config/nc/plain-background"; }
82fi
83pgrep -u "$(id -u)" -x conky >/dev/null || (setsid nc-dashboard >/dev/null 2>&1 &)