From 6444dc65c15841784b9cce737ed39726832c2a4f Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Mon, 22 Apr 2024 06:06:41 +0300 Subject: [PATCH] Rewrote vesktop to use sources and reliably clean up when closed --- apsalar/vesktop | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/apsalar/vesktop b/apsalar/vesktop index 8cc7fd7..cbbfd41 100755 --- a/apsalar/vesktop +++ b/apsalar/vesktop @@ -1,23 +1,55 @@ #!/bin/sh -arRPCdir="$HOME/.local/share/vesktop/arrpc" -# check if arRPC is installed and autoinstall if necessary +arRPCdir="$HOME/src/arRPC" +Vesktopdir="$HOME/src/Vesktop" install_arRPC () { + echo "Installing arRPC" git clone https://github.com/OpenAsar/arRPC "$arRPCdir" 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 install_arRPC fi -# start arRPC -cd "$arRPCdir" && node src & +run_arRPC arRPCPID=$(pgrep -f 'node src') -# start Vesktop -$HOME/.local/share/vesktop/vesktop --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto +run_vesktop +echo "Killing arRPC" # 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