This repository was archived by the owner on Feb 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·116 lines (99 loc) · 3.65 KB
/
install.sh
File metadata and controls
executable file
·116 lines (99 loc) · 3.65 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
#!/usr/bin/env bash
set -euo pipefail
# Check if being ran with Sudo
if [ "$(id -u)" -eq 0 ]; then
echo "Joe must NOT be installed as root or via sudo."
exit 1
fi
APP_NAME="Joe"
APP_ID="soberjoe"
SOBER_ID="org.vinegarhq.Sober"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_BIN="$HOME/.local/bin/soberjoe"
DESKTOP_DIR="$HOME/.local/share/applications"
DESKTOP_FILE="$DESKTOP_DIR/${APP_ID}.desktop"
echo "Installing $APP_NAME for user: $USER"
# -------------------------------
# 1) Check for Sober (Flatpak)
# -------------------------------
if command -v flatpak >/dev/null 2>&1; then
if flatpak info "$SOBER_ID" >/dev/null 2>&1; then
echo "Sober is installed via Flatpak"
else
echo "Sober not found! Make sure to install it via Flatpak!"
fi
else
echo "Flatpak not found! Make sure it and Sober are installed first!"
fi
# -------------------------------
# 2) Check for Node.js
# -------------------------------
if ! command -v node >/dev/null 2>&1; then
echo "Node.js not found! Please install it with your distro's package manager!"
exit 1
else
NODE_BIN="$(command -v node)"
echo "Node.js is installed at: $NODE_BIN"
fi
# -------------------------------
# 3) Install needed files
# -------------------------------
echo "Installing files..."
mkdir -p "$INSTALL_BIN"
cp "$SCRIPT_DIR/joe.png" "$INSTALL_BIN/soberjoe-icon.png"
cp "$SCRIPT_DIR/soberjoe.js" "$INSTALL_BIN/soberjoe.js"
cp "$SCRIPT_DIR/soberjoe-wrapper.sh" "$INSTALL_BIN/soberjoe-wrapper.sh"
# Make the wrapper executable
chmod +x "$INSTALL_BIN/soberjoe-wrapper.sh"
# Patch wrapper to use detected node and correct JS path
# This assumes the top of soberjoe-wrapper.sh has lines starting with NODE= and SCRIPT=
if grep -q '^NODE=' "$INSTALL_BIN/soberjoe-wrapper.sh"; then
sed -i "s|^NODE=.*$|NODE=\"$NODE_BIN\"|" "$INSTALL_BIN/soberjoe-wrapper.sh"
fi
if grep -q '^SCRIPT=' "$INSTALL_BIN/soberjoe-wrapper.sh"; then
sed -i "s|^SCRIPT=.*$|SCRIPT=\"$INSTALL_BIN/soberjoe.js\"|" "$INSTALL_BIN/soberjoe-wrapper.sh"
fi
# -------------------------------
# 4) Install .desktop file
# -------------------------------
mkdir -p "$DESKTOP_DIR"
cat >"$DESKTOP_FILE" <<EOF
[Desktop Entry]
Type=Application
Name=Joe
Comment=A Roblox URL handler that makes things work as it should, no matter what app tries to launch Sober.
Exec=$INSTALL_BIN/soberjoe-wrapper.sh %u
Terminal=false
MimeType=x-scheme-handler/roblox;x-scheme-handler/roblox-player;
Categories=Game;
NoDisplay=true
Icon=$INSTALL_BIN/soberjoe-icon.png
EOF
# -------------------------------
# 5) Register as handler for roblox:// and roblox-player://
# -------------------------------
if command -v xdg-mime >/dev/null 2>&1; then
echo "Registering as default Roblox handler for: $USER"
xdg-mime default "${APP_ID}.desktop" x-scheme-handler/roblox || true
xdg-mime default "${APP_ID}.desktop" x-scheme-handler/roblox-player || true
else
echo "xdg-mime not found! Could not register URL handlers!"
fi
if [ -f "$HOME/.local/share/applications/$SOBER_ID.desktop" ]; then
echo "Unregistering Sober as a Roblox handler..."
sed -i "/^MimeType=.*x-scheme-handler\/roblox/s/^/#/" "$HOME/.local/share/applications/$SOBER_ID.desktop"
fi
# Try to update desktop database (optional)
if command -v update-desktop-database >/dev/null 2>&1; then
rm ~/.local/share/applications/mimeinfo.cache || true
update-desktop-database ~/.local/share/applications || true
fi
echo
echo "Done!"
echo
echo "Installed at: $INSTALL_BIN"
echo "Desktop file is at: $DESKTOP_FILE"
echo
echo "If Roblox links aren't opening with Joe yet, make sure it's set as the default"
echo "handler in your desktop's 'Default Applications' settings. If it is, try logging out then back in."
echo