Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions fix-wm-class.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
#!/bin/sh
WM_CLASS="$([ "$2" ] && echo "$2" || echo "$1")"
xdotool search --sync --name "$1" set_window --classname "$WM_CLASS" --class "$WM_CLASS" %@
#!/usr/bin/env sh

LOG_FILE="/tmp/steam_watcher.log"

WM_NAME=$1
echo "WM_NAME: $WM_NAME" > $LOG_FILE
shift
WM_NAME_ALT=$1
echo "WM_NAME_ALT: $WM_NAME_ALT" >> $LOG_FILE
shift

WM_CLASS=$WM_NAME_ALT

echo "Starting process: $@" >> $LOG_FILE
"$@" &

PID=$!
echo "Process ID: $PID" >> $LOG_FILE

while kill -0 $PID 2> /dev/null; do
xdotool search --sync --name "$WM_NAME" set_window --classname "$WM_CLASS" --class "$WM_CLASS" %@
echo "Process still running: $(date)" >> $LOG_FILE
sleep 1
done
exit 0
21 changes: 14 additions & 7 deletions sif.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,24 @@ def fix_launch_option(app_id, wm_name, wm_name_alt=""):
app = apps[app_id]
if "LaunchOptions" not in app.keys():
app["LaunchOptions"] = ""
app["LaunchOptions"] = sub("&\\s/.*fix-wm-class\\.sh.*?;", "", app["LaunchOptions"])
app["LaunchOptions"] = sub("\\s/.*fix-wm-class\\.sh.*?;", "", app["LaunchOptions"])
app["LaunchOptions"] = sub("%command%", "", app["LaunchOptions"])
launch_options = app["LaunchOptions"].strip()
script = str(WM_CLASS_FIXER_SCRIPT)
if wm_name_alt:
app["LaunchOptions"] += '& %s "%s" "%s";' % (
app["LaunchOptions"] = '%s %s "%s" "%s" %%command%%;' % (
launch_options,
script,
wm_name,
wm_name_alt,
)
elif wm_name == "Pillars of Eternity":
app["LaunchOptions"] += '& sleep 5 && %s "%s";' % (script, wm_name)
else:
app["LaunchOptions"] += '& %s "%s";' % (script, wm_name)
app["LaunchOptions"] = '%s %s "%s" "%s" %%command%%;' % (
launch_options,
script,
wm_name,
wm_name,
)
vdf.dump(loaded, open(conf_file, "w"), pretty=True)


Expand All @@ -231,7 +237,8 @@ def restore_launch_options():
for app_id in apps.keys():
app = apps[app_id]
if "LaunchOptions" in app.keys():
app["LaunchOptions"] = sub("&\\s/.*fix-wm-class\\.sh.*?;", "", app["LaunchOptions"])
app["LaunchOptions"] = sub("\\s/.*fix-wm-class\\.sh.*?;", " %command%", app["LaunchOptions"])
app["LaunchOptions"] = app["LaunchOptions"].strip()
vdf.dump(loaded, open(conf_file, "w"), pretty=True)


Expand Down Expand Up @@ -717,7 +724,7 @@ def quit_handler(_, __):
if steam_detected:
print_warning("\nSome games couldn't be fixed due to running Steam.\nExit Steam and try it again.")
else:
print("\n * - added fix to game launch options")
print("\n * - added fix to game launch options. Double check your launch options just in case.")

if options.pretend:
print_warning("\nNo changes were made because --pretend option was used.")
Expand Down