-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
149 lines (125 loc) · 4.71 KB
/
install.sh
File metadata and controls
149 lines (125 loc) · 4.71 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env bash
set -euo pipefail
APP_NAME="vitrine"
BIN_DIR="$HOME/.local/bin"
CONFIG_DIR="$HOME/.config/vitrine"
SERVICE_DIR="$HOME/.config/systemd/user"
BINARY="${1:-src-tauri/target/release/$APP_NAME}"
# ── Colors ──────────────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
info() { echo -e "${GREEN}[✓]${NC} $*"; }
warn() { echo -e "${YELLOW}[!]${NC} $*"; }
fail() { echo -e "${RED}[✗]${NC} $*"; exit 1; }
# ── Check binary ────────────────────────────────────────────────────
[[ -f "$BINARY" ]] || fail "Binary not found: $BINARY\n Build first: pnpm tauri build"
[[ -x "$BINARY" ]] || chmod +x "$BINARY"
# ── Install binary ──────────────────────────────────────────────────
mkdir -p "$BIN_DIR"
cp "$BINARY" "$BIN_DIR/$APP_NAME"
info "Installed binary to $BIN_DIR/$APP_NAME"
# ── Default config ──────────────────────────────────────────────────
mkdir -p "$CONFIG_DIR"
if [[ ! -f "$CONFIG_DIR/config.toml" ]]; then
cat > "$CONFIG_DIR/config.toml" << 'TOML'
[general]
polling_interval_ms = 1000
mock_sensors = false
auto_start = true
target_display = "auto"
[theme]
mode = "dark"
accent_color = "#60A5FA"
background_opacity = 0.85
enable_glow_effects = true
enable_animations = true
[temperature_thresholds]
cpu_warn = 75
cpu_critical = 90
gpu_warn = 80
gpu_critical = 95
[[pages]]
name = "System"
[[pages.widgets]]
widget_type = "cpu_monitor"
position = { col = 0, row = 0 }
size = { cols = 2, rows = 2 }
[[pages.widgets]]
widget_type = "gpu_monitor"
position = { col = 0, row = 2 }
size = { cols = 2, rows = 2 }
[[pages.widgets]]
widget_type = "ram_usage"
position = { col = 0, row = 4 }
size = { cols = 1, rows = 1 }
[[pages.widgets]]
widget_type = "nvme_storage"
position = { col = 1, row = 4 }
size = { cols = 1, rows = 1 }
[[pages]]
name = "Media & Network"
[[pages.widgets]]
widget_type = "media_player"
position = { col = 0, row = 0 }
size = { cols = 2, rows = 2 }
[[pages.widgets]]
widget_type = "network_monitor"
position = { col = 0, row = 2 }
size = { cols = 1, rows = 1 }
[advisor]
enabled = true
api_endpoint = "http://localhost:1234/v1/chat/completions"
interval_seconds = 90
TOML
info "Created default config at $CONFIG_DIR/config.toml"
else
warn "Config already exists, skipping: $CONFIG_DIR/config.toml"
fi
# ── Systemd service ─────────────────────────────────────────────────
mkdir -p "$SERVICE_DIR"
cat > "$SERVICE_DIR/$APP_NAME.service" << EOF
[Unit]
Description=Vitrine system monitor dashboard
After=graphical-session.target
[Service]
Type=simple
ExecStart=$BIN_DIR/$APP_NAME
Restart=on-failure
RestartSec=3
Environment=DISPLAY=:0
[Install]
WantedBy=graphical-session.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now "$APP_NAME" 2>/dev/null || true
info "Systemd user service installed and enabled"
# ── KDE window rules (optional, Y70 auto-detect) ────────────────
if command -v kwriteconfig6 &>/dev/null; then
# Attempt to detect HYTE Y70 Touch Infinite (682x2560)
Y70_OUTPUT=""
if command -v kscreen-doctor &>/dev/null; then
Y70_OUTPUT=$(kscreen-doctor -o 2>/dev/null | grep -oP 'Output \d+.*682x2560' | head -1 | grep -oP 'Output \d+' || true)
fi
if [[ -n "$Y70_OUTPUT" ]]; then
info "Detected Y70 display: $Y70_OUTPUT"
kwriteconfig6 --file kwinrulesrc --group 1 --key Description "Vitrine Y70 Panel"
kwriteconfig6 --file kwinrulesrc --group 1 --key wmclass "$APP_NAME"
kwriteconfig6 --file kwinrulesrc --group 1 --key wmclassmatch 1
kwriteconfig6 --file kwinrulesrc --group 1 --key above 1
kwriteconfig6 --file kwinrulesrc --group 1 --key aboverule 2
kwriteconfig6 --file kwinrulesrc --group 1 --key noborder 1
kwriteconfig6 --file kwinrulesrc --group 1 --key noborderrule 2
kwriteconfig6 --file kwinrulesrc --group 1 --key skiptaskbar 1
kwriteconfig6 --file kwinrulesrc --group 1 --key skiptaskbarrule 2
info "KDE window rules applied for Y70 display"
else
warn "Y70 display not auto-detected. Skipping KDE window rules."
fi
fi
echo ""
info "Vitrine installed successfully!"
echo " Config: $CONFIG_DIR/config.toml"
echo " Binary: $BIN_DIR/$APP_NAME"
echo " Service: systemctl --user status $APP_NAME"