-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
147 lines (124 loc) · 6.7 KB
/
Copy pathjustfile
File metadata and controls
147 lines (124 loc) · 6.7 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
# Lilith-TTS Justfile — standard COSMIC applet build & install recipes
# Usage:
# just # Build release binaries
# just install # Install system-wide (default prefix=/usr)
# just install-user # Install to user-local directories (~/.local)
# just download-model # Interactively check/download NeuTTS Nano GGUF model
# just setup-hotkey # Add user to 'input' group for global hotkey
rootdir := ''
prefix := '/usr'
cargo-target-dir := env('CARGO_TARGET_DIR', 'target')
# Installation paths
base-dir := absolute_path(clean(rootdir / prefix))
bin-dst := base-dir / 'bin'
desktop-dst := base-dir / 'share' / 'applications'
icon-dst-scalable := base-dir / 'share' / 'icons' / 'hicolor' / 'scalable' / 'apps'
systemd-user-dst := base-dir / 'lib' / 'systemd' / 'user'
# Default recipe which builds the release profile
default: build-release
# Clean cargo target directory
clean:
cargo clean
# Build debug binaries
build-debug *args:
cargo build {{args}}
# Build release binaries
build-release *args: (build-debug '--release' args)
# System-wide installation (typically requires sudo)
# Usage: sudo just install or just install prefix=/usr/local (with sudo)
install: build-release
install -Dm0755 {{ cargo-target-dir }}/release/lilith-tts {{ bin-dst }}/lilith-tts
install -Dm0755 {{ cargo-target-dir }}/release/lilith-tts-daemon {{ bin-dst }}/lilith-tts-daemon
install -Dm0644 assets/io.lilith.LilithTts.svg {{ icon-dst-scalable }}/io.lilith.LilithTts.svg
install -Dm0644 assets/io.lilith.LilithTts-symbolic.svg {{ icon-dst-scalable }}/io.lilith.LilithTts-symbolic.svg
# Configure and install desktop file
mkdir -p {{ desktop-dst }}
install -m 0644 assets/lilith-tts.desktop {{ desktop-dst }}/io.lilith.LilithTts.desktop
# Configure and install systemd user service
mkdir -p {{ systemd-user-dst }}
sed "s|%h/.local/bin/lilith-tts-daemon|{{ prefix }}/bin/lilith-tts-daemon|g" \
assets/lilith-tts-daemon.service > {{ systemd-user-dst }}/lilith-tts-daemon.service
chmod 0644 {{ systemd-user-dst }}/lilith-tts-daemon.service
# Update system caches if applicable
if [ -z "{{ rootdir }}" ]; then \
update-desktop-database {{ desktop-dst }} 2>/dev/null || true; \
gtk-update-icon-cache -f -t {{ base-dir }}/share/icons/hicolor 2>/dev/null || true; \
fi
# System-wide uninstallation
uninstall:
rm -f {{ bin-dst }}/lilith-tts
rm -f {{ bin-dst }}/lilith-tts-daemon
rm -f {{ icon-dst-scalable }}/io.lilith.LilithTts.svg
rm -f {{ icon-dst-scalable }}/io.lilith.LilithTts-symbolic.svg
rm -f {{ desktop-dst }}/io.lilith.LilithTts.desktop
rm -f {{ systemd-user-dst }}/lilith-tts-daemon.service
if [ -z "{{ rootdir }}" ]; then \
update-desktop-database {{ desktop-dst }} 2>/dev/null || true; \
gtk-update-icon-cache -f -t {{ base-dir }}/share/icons/hicolor 2>/dev/null || true; \
fi
# User-local installation (no root privileges required)
install-user: build-release
# Create target directories
mkdir -p ~/.local/bin
mkdir -p ~/.local/share/applications
mkdir -p ~/.local/share/icons/hicolor/scalable/apps
mkdir -p ~/.config/systemd/user
mkdir -p ~/.config/autostart
# Copy binaries
install -m 0755 {{ cargo-target-dir }}/release/lilith-tts ~/.local/bin/lilith-tts
install -m 0755 {{ cargo-target-dir }}/release/lilith-tts-daemon ~/.local/bin/lilith-tts-daemon
# Copy icons
install -m 0644 assets/io.lilith.LilithTts.svg ~/.local/share/icons/hicolor/scalable/apps/io.lilith.LilithTts.svg
install -m 0644 assets/io.lilith.LilithTts-symbolic.svg ~/.local/share/icons/hicolor/scalable/apps/io.lilith.LilithTts-symbolic.svg
# Install custom desktop file with full path in Exec (so it launches properly in any case)
sed "s|Exec=lilith-tts|Exec=$HOME/.local/bin/lilith-tts|g" \
assets/lilith-tts.desktop > ~/.local/share/applications/io.lilith.LilithTts.desktop
chmod 0644 ~/.local/share/applications/io.lilith.LilithTts.desktop
# Install daemon autostart
echo "[Desktop Entry]" > ~/.config/autostart/lilith-tts-daemon.desktop
echo "Name=Lilith TTS Daemon" >> ~/.config/autostart/lilith-tts-daemon.desktop
echo "Comment=Background daemon for Lilith TTS" >> ~/.config/autostart/lilith-tts-daemon.desktop
echo "Type=Application" >> ~/.config/autostart/lilith-tts-daemon.desktop
echo "Exec=$HOME/.local/bin/lilith-tts-daemon" >> ~/.config/autostart/lilith-tts-daemon.desktop
echo "Hidden=false" >> ~/.config/autostart/lilith-tts-daemon.desktop
echo "NoDisplay=true" >> ~/.config/autostart/lilith-tts-daemon.desktop
echo "X-COSMIC-Autostart=true" >> ~/.config/autostart/lilith-tts-daemon.desktop
# Install systemd user service pointing to local path
sed "s|%h|$HOME|g" assets/lilith-tts-daemon.service > ~/.config/systemd/user/lilith-tts-daemon.service
chmod 0644 ~/.config/systemd/user/lilith-tts-daemon.service
# Update databases
update-desktop-database ~/.local/share/applications 2>/dev/null || true
gtk-update-icon-cache -f -t ~/.local/share/icons/hicolor 2>/dev/null || true
# Enable and start user service
systemctl --user daemon-reload
systemctl --user enable --now lilith-tts-daemon.service
@echo ""
@echo "=================================================="
@echo "Lilith TTS (User-local) installed successfully!"
@echo "Add the applet from your COSMIC settings/panel."
@echo "=================================================="
# Uninstall user-local files
uninstall-user:
rm -f ~/.local/bin/lilith-tts
rm -f ~/.local/bin/lilith-tts-daemon
rm -f ~/.local/share/icons/hicolor/scalable/apps/io.lilith.LilithTts.svg
rm -f ~/.local/share/icons/hicolor/scalable/apps/io.lilith.LilithTts-symbolic.svg
rm -f ~/.local/share/applications/io.lilith.LilithTts.desktop
rm -f ~/.config/autostart/lilith-tts-daemon.desktop
systemctl --user disable --now lilith-tts-daemon.service 2>/dev/null || true
rm -f ~/.config/systemd/user/lilith-tts-daemon.service
systemctl --user daemon-reload
update-desktop-database ~/.local/share/applications 2>/dev/null || true
gtk-update-icon-cache -f -t ~/.local/share/icons/hicolor 2>/dev/null || true
# Add current user to input group for global hotkey
setup-hotkey:
@if groups "$USER" | grep -qw 'input'; then \
echo "User is already in the 'input' group."; \
else \
echo "Adding user to 'input' group (requires sudo)..."; \
sudo usermod -aG input "$USER"; \
echo "Added! Please log out and back in for this to take effect."; \
fi
# Interactively check and download the NeuTTS Nano GGUF model (~120MB)
download-model:
./install.sh --only-model