Skip to content

Commit 4e5871b

Browse files
committed
feat: proper linux install
1 parent de6d449 commit 4e5871b

12 files changed

Lines changed: 114 additions & 79 deletions

File tree

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,32 @@ powershell -ExecutionPolicy Bypass -File install.ps1
7171
> [!NOTE]
7272
> Linux support is still in beta and x86_64-only. Slack doesn't ship an official arm64 Linux build, so there's nothing for an arm64 machine to run Slick against.
7373
74-
Install Slack from your distro first (deb, rpm, AUR, whatever your package manager offers), then clone the repo and run:
74+
Install Slack from your distro first (deb, rpm, AUR, whatever your package manager offers), then run:
7575

7676
```bash
77-
./install-linux.sh
77+
curl -fsSL https://raw.githubusercontent.com/3kh0/slick/main/install-linux.sh | bash
7878
```
7979

80-
This builds `byoe/slick-linux`, installs a desktop entry, registers `slack://`, and launches Slick. For manual launch or debugging:
80+
To uninstall:
8181

8282
```bash
83-
./scripts/launch-linux.sh
84-
./scripts/launch-linux.sh --debug 9223
83+
curl -fsSL https://raw.githubusercontent.com/3kh0/slick/main/install-linux.sh | bash -s -- --uninstall
8584
```
8685

87-
You also have some nice flags to play around with: `--restore-handler` on `install-linux.sh` to give `slack://` back to the official Slack app, and `./scripts/uninstall-linux.sh` to remove Slick entirely.
86+
If you'd rather build it yourself (or hack on it), clone the repo and run:
87+
88+
```bash
89+
./install-linux.sh
90+
```
8891

89-
Prebuilt `x86_64` tarballs are published on the [releases page](https://github.com/3kh0/slick/releases/latest) too. To install one (with optional provenance verification if `gh` is installed):
92+
This builds from source into the same `~/.local/share/slick/app` location instead of using a prebuilt release. For manual launch or debugging:
9093

9194
```bash
92-
./install-linux.sh --from-release
95+
./scripts/launch-linux.sh
96+
./scripts/launch-linux.sh --debug 9223
9397
```
9498

95-
Or extract a tarball by hand and run `Slick/electron` directly.
99+
You also have some nice flags to play around with: `--restore-handler` on `install-linux.sh` to give `slack://` back to the official Slack app, `--from-release` to use a prebuilt tarball instead of building from source, and `--uninstall` (or `./scripts/uninstall-linux.sh`) to remove Slick entirely.
96100

97101
#### Flatpak
98102

assets/desktop-linux/1024.png

50 KB
Loading

assets/desktop-linux/128.png

4.15 KB
Loading

assets/desktop-linux/16.png

476 Bytes
Loading

assets/desktop-linux/256.png

11.1 KB
Loading

assets/desktop-linux/32.png

1.09 KB
Loading

assets/desktop-linux/512.png

18.6 KB
Loading

assets/desktop-linux/64.png

2.34 KB
Loading

install-linux.sh

Lines changed: 98 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
set -euo pipefail
33

44
ROOT="$(cd "$(dirname "$0")" && pwd)"
5-
TARGET="$ROOT/byoe/slick-linux"
5+
REPO="3kh0/slick"
6+
BRANCH="main"
7+
RAW_BASE="https://raw.githubusercontent.com/$REPO/$BRANCH"
8+
DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
9+
TARGET="$DATA_HOME/slick/app"
610
EDIST="$ROOT/byoe/node_modules/electron/dist"
711
EBIN="$EDIST/electron"
8-
REPO="3kh0/slick"
12+
DESKTOP_FILE="$HOME/.local/share/applications/dev.slick.byoe.desktop"
13+
PROFILE="$HOME/.config/slick"
14+
ICON_SIZES=(16 32 64 128 256 512)
915
SLACK_PATHS=(
1016
"${SLICK_SLACK_DIR:-}"
1117
"/usr/lib/slack"
@@ -15,6 +21,12 @@ SLACK_PATHS=(
1521
)
1622
NO_LAUNCH=0
1723
FROM_RELEASE=0
24+
UNINSTALL=0
25+
26+
# Only true when this script is sitting inside an actual clone of the repo
27+
# (curl | bash / bash <(curl ...) resolve ROOT to an unrelated directory).
28+
CLONED=0
29+
[ -f "$ROOT/scripts/byoe/build-handoff-linux.js" ] && CLONED=1
1830

1931
step() { printf '\033[1;35m==>\033[0m \033[1m%s\033[0m\n' "$*"; }
2032
die() {
@@ -24,8 +36,8 @@ die() {
2436

2537
verify_release_artifact() {
2638
local file="$1"
27-
if ! command -v gh >/dev/null 2>&1; then
28-
printf ' (gh CLI not found; skipping provenance check — https://cli.github.com)\n'
39+
if ! command -v gh >/dev/null 2>&1 || ! gh attestation --help >/dev/null 2>&1; then
40+
printf ' (gh CLI missing or too old for "gh attestation"; skipping provenance check — https://cli.github.com)\n'
2941
return 0
3042
fi
3143
step "Verifying build provenance"
@@ -44,10 +56,61 @@ verify_release_artifact() {
4456
die "refusing to install an unattested or mismatched build"
4557
}
4658

59+
do_uninstall() {
60+
local fail=0
61+
step "Stopping Slick"
62+
pkill -f "$TARGET/electron" 2>/dev/null || true
63+
for _ in {1..20}; do
64+
pgrep -f "$TARGET/electron" >/dev/null 2>&1 || break
65+
sleep 0.25
66+
done
67+
if pgrep -f "$TARGET/electron" >/dev/null 2>&1; then
68+
printf '\033[1;33mwarning:\033[0m some Slick processes are still running\n' >&2
69+
fail=1
70+
fi
71+
72+
step "Restoring slack:// to official Slack"
73+
if command -v xdg-mime >/dev/null 2>&1; then
74+
xdg-mime default slack.desktop x-scheme-handler/slack \
75+
&& echo " slack:// now opens the official Slack again." \
76+
|| { printf '\033[1;33mwarning:\033[0m could not restore the slack:// handler\n' >&2; fail=1; }
77+
else
78+
printf '\033[1;33mwarning:\033[0m xdg-mime not found; could not restore the slack:// handler\n' >&2
79+
fail=1
80+
fi
81+
82+
step "Removing desktop integration"
83+
rm -f "$DESKTOP_FILE"
84+
for size in "${ICON_SIZES[@]}"; do
85+
rm -f "$HOME/.local/share/icons/hicolor/${size}x${size}/apps/slick.png"
86+
done
87+
if command -v update-desktop-database >/dev/null 2>&1; then
88+
update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true
89+
fi
90+
if command -v gtk-update-icon-cache >/dev/null 2>&1; then
91+
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" >/dev/null 2>&1 || true
92+
fi
93+
94+
step "Removing Slick"
95+
rm -rf "$TARGET" "$TARGET.old"
96+
97+
step "Purging Slick data"
98+
rm -rf "$PROFILE"
99+
find "${TMPDIR:-/tmp}" -maxdepth 1 -type d -name 'slick-update-*' -exec rm -rf {} + 2>/dev/null || true
100+
101+
if [ "$fail" -ne 0 ]; then
102+
printf '\n\033[1;33mSlick was partially removed, see the warnings above.\033[0m\n'
103+
exit 1
104+
fi
105+
printf '\n\033[1;32mSlick has been fully removed.\033[0m\n'
106+
exit 0
107+
}
108+
47109
while [ $# -gt 0 ]; do
48110
case "$1" in
49111
--no-launch) NO_LAUNCH=1 ;;
50112
--from-release) FROM_RELEASE=1 ;;
113+
--uninstall) UNINSTALL=1 ;;
51114
--restore-handler)
52115
command -v xdg-mime >/dev/null 2>&1 || die "xdg-mime not found; can't manage the slack:// handler on this system."
53116
xdg-mime default slack.desktop x-scheme-handler/slack &&
@@ -62,6 +125,9 @@ while [ $# -gt 0 ]; do
62125
shift
63126
done
64127

128+
[ "$(uname -s)" = "Linux" ] || die "install-linux.sh only supports Linux."
129+
[ "$UNINSTALL" -eq 1 ] && do_uninstall
130+
65131
find_slack() {
66132
local dir
67133
for dir in "${SLACK_PATHS[@]}"; do
@@ -135,16 +201,20 @@ EOF
135201
}
136202

137203
step "Checking prerequisites"
138-
[ "$(uname -s)" = "Linux" ] || die "install-linux.sh only supports Linux."
139204

140205
SLACK="$(find_slack)" || die "Slack not found. Install the official Slack .deb from https://slack.com/downloads/linux, then rerun."
141206
echo " Slack resources: $SLACK/resources"
142207

208+
if [ "$CLONED" -eq 0 ] && [ "$FROM_RELEASE" -eq 0 ]; then
209+
echo " no local clone found; installing the prebuilt release"
210+
FROM_RELEASE=1
211+
fi
212+
143213
if [ "$FROM_RELEASE" -eq 1 ]; then
144214
ARCH="$(uname -m)"
145215
case "$ARCH" in
146216
x86_64 | amd64) ARCH=x64 ;;
147-
*) die "prebuilt Linux releases are x86_64-only (this machine is $(uname -m)). Build from source instead." ;;
217+
*) die "prebuilt Linux releases are x86_64-only (this machine is $(uname -m)). Clone the repo and build from source instead." ;;
148218
esac
149219

150220
step "Finding the latest release"
@@ -223,22 +293,32 @@ else
223293
VERSION="1.0.$BUILD"
224294

225295
step "Building $TARGET (Build $BUILD)"
296+
mkdir -p "$(dirname "$TARGET")"
226297
node "$ROOT/scripts/byoe/build-handoff-linux.js" --target "$TARGET" \
227298
--app-version "$VERSION" --build-number "$BUILD" --force >/dev/null
228299
fi
229300

230301
step "Installing desktop integration"
231-
mkdir -p "$HOME/.local/share/icons/hicolor/256x256/apps" "$HOME/.local/share/applications"
232-
if [ -f "$ROOT/assets/icon.png" ]; then
233-
cp "$ROOT/assets/icon.png" "$HOME/.local/share/icons/hicolor/256x256/apps/slick.png"
234-
elif [ ! -f "$HOME/.local/share/icons/hicolor/256x256/apps/slick.png" ]; then
235-
echo " note: no assets/icon.png; desktop icon may be missing."
236-
fi
302+
mkdir -p "$HOME/.local/share/applications"
303+
for size in "${ICON_SIZES[@]}"; do
304+
ICON_DIR="$HOME/.local/share/icons/hicolor/${size}x${size}/apps"
305+
mkdir -p "$ICON_DIR"
306+
SRC_ICON="$ROOT/assets/desktop-linux/$size.png"
307+
if [ "$CLONED" -eq 1 ] && [ -f "$SRC_ICON" ]; then
308+
cp "$SRC_ICON" "$ICON_DIR/slick.png"
309+
elif ! curl -fsSL "$RAW_BASE/assets/desktop-linux/$size.png" -o "$ICON_DIR/slick.png" 2>/dev/null; then
310+
rm -f "$ICON_DIR/slick.png"
311+
echo " note: could not fetch the ${size}x${size} icon"
312+
fi
313+
done
237314
[ -f "$TARGET/slick.desktop" ] || write_desktop_file "$TARGET"
238-
cp "$TARGET/slick.desktop" "$HOME/.local/share/applications/dev.slick.byoe.desktop"
315+
cp "$TARGET/slick.desktop" "$DESKTOP_FILE"
239316
if command -v update-desktop-database >/dev/null 2>&1; then
240317
update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true
241318
fi
319+
if command -v gtk-update-icon-cache >/dev/null 2>&1; then
320+
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" >/dev/null 2>&1 || true
321+
fi
242322
if command -v xdg-mime >/dev/null 2>&1; then
243323
xdg-mime default dev.slick.byoe.desktop x-scheme-handler/slack || true
244324
else
@@ -247,15 +327,17 @@ fi
247327

248328
if [ "$NO_LAUNCH" -eq 0 ]; then
249329
step "Launching Slick"
250-
"$ROOT/scripts/launch-linux.sh"
330+
SLICK_LAUNCH_T0="$(date +%s%3N 2>/dev/null || echo '')"
331+
export SLICK_LAUNCH_T0
332+
"$TARGET/electron" --no-sandbox
251333
fi
252334

253335
printf '\n\033[1;32mYippee!\033[0m Slick is installed at %s\n' "$TARGET"
254336
cat <<EOF
255337
Things to know:
256338
- First launch shows a sign-in screen (separate profile from official Slack). Sign in once; it persists.
257339
- Configure at Preferences -> Slick.
258-
- Manual launch: ./scripts/launch-linux.sh
259-
- Prebuilt install: ./install-linux.sh --from-release
340+
- Manual launch: $TARGET/electron --no-sandbox
341+
- Uninstall: ./install-linux.sh --uninstall (or curl -fsSL $RAW_BASE/install-linux.sh | bash -s -- --uninstall)
260342
- Make slack:// open the official Slack again: ./install-linux.sh --restore-handler
261343
EOF

packaging/flatpak/dev.slick.Slick.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ modules:
5151
- install -Dm755 flatpak/slick.sh /app/bin/slick
5252
- install -Dm644 flatpak/dev.slick.Slick.desktop /app/share/applications/dev.slick.Slick.desktop
5353
- install -Dm644 flatpak/dev.slick.Slick.metainfo.xml /app/share/metainfo/dev.slick.Slick.metainfo.xml
54-
- install -Dm644 slick/assets/icon.png /app/share/icons/hicolor/1024x1024/apps/dev.slick.Slick.png
54+
- install -Dm644 slick/assets/desktop-linux/1024.png /app/share/icons/hicolor/1024x1024/apps/dev.slick.Slick.png
5555
sources:
5656
- type: dir
5757
path: ../..

0 commit comments

Comments
 (0)