Skip to content

Commit

Permalink
Flatpak controls revamped
Browse files Browse the repository at this point in the history
  • Loading branch information
GleammerRay committed Apr 18, 2024
1 parent 7212bf5 commit 5a9c209
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 20 deletions.
1 change: 1 addition & 0 deletions read_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if [ "x$WINESTEAM_DATA" = "x" ]; then
fi

export WINESTEAM_PKGS="$WINESTEAM_DATA/packages"
echo "export WINESTEAM_VERSION=\"v0.2.0\""
echo "export WINEARCH=win64"
echo "export WINESTEAM_CFG=\"$WINESTEAM_CFG\""
echo "export WINESTEAM_BIN=\"$PWD\""
Expand Down
2 changes: 1 addition & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ "x$1" = "xflatpak" ]; then
rm "$PWD/WineSteam.flatpak"
wsNotify '[1/2] [1/1] Downloading WineSteam flatpak... [⟱]]'
echo '=========================================================='
curl -o WineSteam.flatpak.gz -L https://github.com/GleammerRay/WineSteam/releases/download/v0.1.1/DO-NOT-INSTALL-WineSteam.flatpak.gz
curl -o WineSteam.flatpak.gz -L https://github.com/GleammerRay/WineSteam/releases/download/$WINESTEAM_FLATPAK_VERSION/DO-NOT-INSTALL-WineSteam.flatpak.gz
gzip -d WineSteam.flatpak.gz
if [ ! -f ./WineSteam.flatpak ]; then
wsInfo 'F: Download failed.'
Expand Down
53 changes: 34 additions & 19 deletions winesteam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,20 @@ wsSetup() {
wsControls() {
WS_CONTROLS_MSG="WineSteam is now starting up! Feel free to close this window.\n\nHere you can control your running WineSteam instance."
while true; do
if [ "$INPUT_BACKEND" = "zenity" ]; then
ANS="`zenity --window-icon "$WINESTEAM_BIN/winesteam.png" --list --radiolist --height 250 --width 500 --title "WineSteam controls" --text "$WS_CONTROLS_MSG" --column "" --column "Options" TRUE "Open WineSteam" FALSE "Launch NEOTOKYO°" FALSE "Exit WineSteam"`"
if [ "x$FLATPAK_ID" = "xio.github.gleammerray.WineSteam" ]; then
sleep 100
elif [ "$INPUT_BACKEND" = "zenity" ]; then
ANS="`zenity --window-icon "$WINESTEAM_BIN/winesteam.png" --list --radiolist --height 300 --width 500 --title "WineSteam controls" --text "$WS_CONTROLS_MSG" --column "" --column "Options" TRUE "Open WineSteam" FALSE "Launch NEOTOKYO°" FALSE "Update WineSteam" FALSE "Exit WineSteam"`"
if [ "$ANS" = "Open WineSteam" ]; then
echo "wine \"$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe\"" > "$WINESTEAM_IPC_PATH"
wsNotify "Opening WineSteam..."
elif [ "$ANS" = "Launch NEOTOKYO°" ]; then
echo "wine \"$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe\" -applaunch 244630" > "$WINESTEAM_IPC_PATH"
wsNotify "Launching NEOTOKYO°..."
elif [ "$ANS" = "Update WineSteam" ]; then
wsNotify "Updating WineSteam..."
"$WINESTEAM_BIN"/update.sh
wsNotify "WineSteam updated, restart it for changes to take effect."
elif [ "$ANS" = "Exit WineSteam" ]; then
if [ "x$WINESTEAM_INSTALL_MODE" = "xflatpak" ]; then
flatpak kill io.github.gleammerray.WineSteam
Expand All @@ -98,14 +104,18 @@ wsControls() {
exit
fi
elif [ "$INPUT_BACKEND" = "kdialog" ]; then
ANS="`kdialog --geometry=500x100 --icon "$WINESTEAM_BIN/winesteam.png" --title "WineSteam controls" --cancel-label "Exit" --radiolist "$WS_CONTROLS_MSG" 1 "Open WineSteam" on 2 "Launch NEOTOKYO°" off 3 "Exit WineSteam" off`"
ANS="`kdialog --geometry=500x250 --icon "$WINESTEAM_BIN/winesteam.png" --title "WineSteam controls" --cancel-label "Exit" --radiolist "$WS_CONTROLS_MSG" 1 "Open WineSteam" on 2 "Launch NEOTOKYO°" off 3 "Update WineSteam" off 4 "Exit WineSteam" off`"
if [ "$ANS" = "1" ]; then
echo "wine \"$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe\"" > "$WINESTEAM_IPC_PATH"
wsNotify "Opening WineSteam..."
elif [ "$ANS" = "2" ]; then
echo "wine \"$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe\" -applaunch 244630" > "$WINESTEAM_IPC_PATH"
wsNotify "Launching NEOTOKYO°..."
elif [ "$ANS" = "3" ]; then
wsNotify "Updating WineSteam..."
"$WINESTEAM_BIN"/update.sh
wsNotify "WineSteam updated, restart it for changes to take effect."
elif [ "$ANS" = "4" ]; then
if [ "x$WINESTEAM_INSTALL_MODE" = "xflatpak" ]; then
flatpak kill io.github.gleammerray.WineSteam
wsNotify "Stopping WineSteam... 【=˶◡˳ ◡˶✿=】ᶻ 𝗓 𐰁"
Expand Down Expand Up @@ -153,33 +163,38 @@ if [ "x$1" != "x" ]; then
fi
fi

if [ ! -d "$WINESTEAM_DATA" ]; then mkdir -p "$WINESTEAM_DATA"; fi
if [ -d "$PWD/prefix" ]; then mv "$PWD/prefix" "$WINESTEAM_DATA"; fi
if [ -d "$PWD/packages" ]; then mv "$PWD/packages" "$WINESTEAM_DATA"; fi
if [ "x$FLATPAK_ID" != "xio.github.gleammerray.WineSteam" ]; then
if [ "x$WINESTEAM_INSTALL_MODE" = "xflatpak" ]; then
if [ -f "$WINESTEAM_FLATPAK_PID_PATH" ]; then
export WS_RUNNER_PID=$(cat "$WINESTEAM_FLATPAK_PID_PATH")
if [ "x$WS_RUNNER_PID" = "x" ]; then
rm "$WINESTEAM_FLATPAK_PID_PATH"
elif [ -d "/proc/$WS_RUNNER_PID" ]; then
flatpak run io.github.gleammerray.WineSteam
wsCleanup
exit
else
rm "$WINESTEAM_FLATPAK_PID_PATH"
fi
WS_RUNNER_PID=`flatpak ps --columns=pid,application | grep io.github.gleammerray.WineSteam | awk '{print $1}'`
export WINESTEAM_DATA="`flatpak run io.github.gleammerray.WineSteam data`"
export WINEPREFIX="$WINESTEAM_DATA/prefix"
WINEPREFIX_LS="`ls -A "$WINEPREFIX"`"
export WINESTEAM_RUNNER_PID_PATH="$WINESTEAM_DATA/ws_runner_pid"
export WINESTEAM_IPC_PATH="$WINESTEAM_DATA/winesteam_ipc.txt"
if [ "x$WS_RUNNER_PID" != "x" ]; then
wsControls &
export WS_CONTROLS_PID=$!
wsCleanup
exit
fi
echo "Running WineSteam flatpak."
unshare --user --map-current-user --net --mount "$WINESTEAM_BIN/ws_flatpak_runner.sh" $1 &
export WS_RUNNER_PID=$!
sleep 1
slirp4netns --configure --mtu=65520 --disable-host-loopback $WS_RUNNER_PID tap0 &
sleep 20
WS_RUNNER_PID=`flatpak ps --columns=pid,application | grep io.github.gleammerray.WineSteam | awk '{print $1}'`
if [ "x$WINEPREFIX_LS" != "x" ]; then
wsControls &
export WS_CONTROLS_PID=$!
fi
wsCleanup
exit
fi
fi

if [ ! -d "$WINESTEAM_DATA" ]; then mkdir -p "$WINESTEAM_DATA"; fi
if [ -d "$PWD/prefix" ]; then mv "$PWD/prefix" "$WINESTEAM_DATA"; fi
if [ -d "$PWD/packages" ]; then mv "$PWD/packages" "$WINESTEAM_DATA"; fi
if [ -d "$WINEPREFIX" ]; then
if [ -f "$WINESTEAM_RUNNER_PID_PATH" ]; then
export WS_RUNNER_PID=$(cat "$WINESTEAM_RUNNER_PID_PATH")
Expand Down Expand Up @@ -266,7 +281,7 @@ if [ "x$WINESTEAM_INSTALL_DXVK" = "x" ]; then
rm "$PWD/WineSteam.flatpak"
wsNotify '[1/2] [1/2] Downloading WineSteam flatpak... [⟱]]'
echo '=========================================================='
curl -o WineSteam.flatpak.gz -L https://github.com/GleammerRay/WineSteam/releases/download/v0.1.1/DO-NOT-INSTALL-WineSteam.flatpak.gz
curl -o WineSteam.flatpak.gz -L https://github.com/GleammerRay/WineSteam/releases/download/$WINESTEAM_VERSION/DO-NOT-INSTALL-WineSteam.flatpak.gz
gzip -d WineSteam.flatpak.gz
if [ ! -f ./WineSteam.flatpak ]; then
wsInfo 'F: Download failed.'
Expand Down

0 comments on commit 5a9c209

Please sign in to comment.