Rewrote vesktop to use sources and reliably clean up when closed

This commit is contained in:
Siina Mashek 2024-04-22 06:06:41 +03:00
parent 973af06df4
commit 6444dc65c1

View file

@ -1,23 +1,55 @@
#!/bin/sh #!/bin/sh
arRPCdir="$HOME/.local/share/vesktop/arrpc" arRPCdir="$HOME/src/arRPC"
# check if arRPC is installed and autoinstall if necessary Vesktopdir="$HOME/src/Vesktop"
install_arRPC () { install_arRPC () {
echo "Installing arRPC"
git clone https://github.com/OpenAsar/arRPC "$arRPCdir" git clone https://github.com/OpenAsar/arRPC "$arRPCdir"
cd "$arRPCdir" && npm install cd "$arRPCdir" && npm install
echo "arRPC installed"
}
install_vesktop () {
echo "Installing Vesktop"
export COREPACK_ENABLE_STRICT=0
git clone https://github.com/Vencord/Vesktop $Vesktopdir
cd $Vesktopdir
pnpm i
echo "Vesktop installed"
}
run_arRPC () {
# skip if already running
if [ $(pgrep -f 'node src') ]; then return; fi
echo "Starting arRPC"
cd "$arRPCdir"
node src &
}
run_vesktop () {
echo "Starting Vesktop"
if [ ! -d $HOME/src/Vesktop ]; then install_vesktop; fi
cd $HOME/src/Vesktop/dist/linux-unpacked
./vesktop \
--enable-features=UseOzonePlatform,WaylandWindowDecorations \
--ozone-platform-hint=auto
} }
if [ ! -d "$arRPCdir" ]; then if [ ! -d "$arRPCdir" ]; then
install_arRPC install_arRPC
fi fi
# start arRPC run_arRPC
cd "$arRPCdir" && node src &
arRPCPID=$(pgrep -f 'node src') arRPCPID=$(pgrep -f 'node src')
# start Vesktop run_vesktop
$HOME/.local/share/vesktop/vesktop --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto
echo "Killing arRPC"
# exit arRPC when Vesktop closes # exit arRPC when Vesktop closes
pkill -9 $arRPCPID echo "Trying to kill $arRPCPID"
killall node -n $arRPCPID
if [ ! $(pgrep -f 'node src' ) ]; then
echo "arRPC killed"
else
echo "arRPC could not be killed"
fi