mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Linux: Make Discord Rich Presence work (#998)
* Linux: Make Discord Rich Presence work * Fix file already exists * Fix chmod file name
This commit is contained in:
@@ -27,10 +27,25 @@ namespace VRCX
|
|||||||
var isGameRunning = false;
|
var isGameRunning = false;
|
||||||
var isSteamVRRunning = false;
|
var isSteamVRRunning = false;
|
||||||
|
|
||||||
|
if (Wine.GetIfWine())
|
||||||
|
{
|
||||||
|
var wineTmpPath = Path.Combine(Program.AppDataDirectory, "wine.tmp");
|
||||||
|
if (File.Exists(wineTmpPath))
|
||||||
|
{
|
||||||
|
var wineTmp = File.ReadAllText(wineTmpPath);
|
||||||
|
if (wineTmp.Contains("isGameRunning=true"))
|
||||||
|
{
|
||||||
|
isGameRunning = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (ProcessMonitor.Instance.IsProcessRunning("VRChat"))
|
if (ProcessMonitor.Instance.IsProcessRunning("VRChat"))
|
||||||
{
|
{
|
||||||
isGameRunning = true;
|
isGameRunning = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ProcessMonitor.Instance.IsProcessRunning("vrserver"))
|
if (ProcessMonitor.Instance.IsProcessRunning("vrserver"))
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace VRCX;
|
namespace VRCX
|
||||||
|
{
|
||||||
public static class Wine
|
public static class Wine
|
||||||
{
|
{
|
||||||
[DllImport("ntdll.dll")]
|
[DllImport("ntdll.dll")]
|
||||||
@@ -20,4 +20,4 @@ public static class Wine
|
|||||||
catch { return false; }
|
catch { return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -83,6 +83,11 @@ cp seguiemj.ttf "$WINEPREFIX/drive_c/windows/Fonts"
|
|||||||
WINEPREFIX=$WINEPREFIX wine reg add 'HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts' /v 'seguiemj' /t REG_SZ /d 'seguiemj.ttf' /f
|
WINEPREFIX=$WINEPREFIX wine reg add 'HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts' /v 'seguiemj' /t REG_SZ /d 'seguiemj.ttf' /f
|
||||||
rm seguiemj.ttf
|
rm seguiemj.ttf
|
||||||
|
|
||||||
|
curl -L https://raw.githubusercontent.com/vrcx-team/VRCX/master/Linux/vrcx.sh -o $WINEPREFIX/drive_c/vrcx.sh
|
||||||
|
chmod +x $WINEPREFIX/drive_c/vrcx.sh
|
||||||
|
|
||||||
|
curl -L https://raw.githubusercontent.com/vrcx-team/VRCX/master/Linux/winediscordipcbridge.exe -o $WINEPREFIX/drive_c/winediscordipcbridge.exe
|
||||||
|
|
||||||
echo "Install VRCX.png to $XDG_DATA_HOME/icons"
|
echo "Install VRCX.png to $XDG_DATA_HOME/icons"
|
||||||
curl -L https://raw.githubusercontent.com/vrcx-team/VRCX/master/VRCX.png -o "$XDG_DATA_HOME/icons/VRCX.png"
|
curl -L https://raw.githubusercontent.com/vrcx-team/VRCX/master/VRCX.png -o "$XDG_DATA_HOME/icons/VRCX.png"
|
||||||
|
|
||||||
@@ -91,7 +96,7 @@ echo "[Desktop Entry]
|
|||||||
Type=Application
|
Type=Application
|
||||||
Name=VRCX
|
Name=VRCX
|
||||||
Categories=Utility;
|
Categories=Utility;
|
||||||
Exec=WINEPREFIX=$WINEPREFIX wine '$INSTALL_LOCATION/VRCX.exe'
|
Exec=$WINEPREFIX/drive_c/vrcx.sh
|
||||||
Icon=VRCX
|
Icon=VRCX
|
||||||
" > $XDG_DATA_HOME/applications/vrcx.exe.desktop
|
" > $XDG_DATA_HOME/applications/vrcx.exe.desktop
|
||||||
|
|
||||||
|
|||||||
Executable
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
export WINEPREFIX=~/.local/share/vrcx
|
||||||
|
|
||||||
|
wine ~/.local/share/vrcx/drive_c/winediscordipcbridge.exe &
|
||||||
|
IPCBRIDGE_PID=$!
|
||||||
|
|
||||||
|
wine ~/.local/share/vrcx/drive_c/vrcx/VRCX.exe &
|
||||||
|
VRCX_PID=$!
|
||||||
|
|
||||||
|
while kill -0 $VRCX_PID 2>/dev/null; do
|
||||||
|
if ps -A | grep -i "VRChat.exe" > /dev/null; then
|
||||||
|
isGameRunning=true
|
||||||
|
else
|
||||||
|
isGameRunning=false
|
||||||
|
fi
|
||||||
|
echo "isGameRunning=$isGameRunning" > "$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/VRCX/wine.tmp"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "isGameRunning=false" > "$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/VRCX/wine.tmp"
|
||||||
|
|
||||||
|
kill $IPCBRIDGE_PID 2>/dev/null
|
||||||
Binary file not shown.
@@ -22,7 +22,8 @@ export default class extends baseClass {
|
|||||||
ipcTimeout: 0,
|
ipcTimeout: 0,
|
||||||
nextClearVRCXCacheCheck: 0,
|
nextClearVRCXCacheCheck: 0,
|
||||||
nextDiscordUpdate: 0,
|
nextDiscordUpdate: 0,
|
||||||
nextAutoStateChange: 0
|
nextAutoStateChange: 0,
|
||||||
|
nextGameRunningCheck: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
_methods = {
|
_methods = {
|
||||||
@@ -75,6 +76,10 @@ export default class extends baseClass {
|
|||||||
this.nextAutoStateChange = 3;
|
this.nextAutoStateChange = 3;
|
||||||
this.updateAutoStateChange();
|
this.updateAutoStateChange();
|
||||||
}
|
}
|
||||||
|
if (--this.nextGameRunningCheck <= 0) {
|
||||||
|
this.nextGameRunningCheck = 3;
|
||||||
|
AppApi.CheckGameRunning();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
API.isRefreshFriendsLoading = false;
|
API.isRefreshFriendsLoading = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user