Fix Steam patch detection and preserve desktop overrides

This commit is contained in:
Scott Jones committed 2026-09-22 20:21:53 -04:00
1 parent 7721248925
commit 947eeea0dd
4 files changed
+49 -7

No files matched your search

+3 -3
View File
@@ -1,15 +1,15 @@
pkgname=omarchy-steam-fex
pkgver=1.0.0
pkgrel=2
pkgrel=3
pkgdesc='Steam launcher with login workarounds for Apple Silicon using muvm and FEX'
arch=('aarch64')
url='https://github.com/omacom/omarchy-pkgs/tree/master/pkgbuilds/omarchy-steam-fex'
license=('MIT')
checkdepends=('python')
source=('omarchy-launch-steam' 'LICENSE' 'test-launcher.py')
sha256sums=('d89559ef88b3589e7d972b44a4a29e418605542f44f2756afd24ed3ce3227609'
sha256sums=('37ad2e8a863e90c2b3248f22d93b548c6070f396f631ad39cefc4745478515b4'
'717ba1949502290f8e47688ae2e323acd06c8ca47aec9f7596b15f678c1af4a2'
'1d31b9ed09292b79dc86d9d4b3fff01d19e8210fdc5e3b13e78b846671808ed5')
'fbab0f88ecdf3238bfb95a1523eef7de2ded2928c91c90e4e06435696dd86cdb')
check() {
python test-launcher.py
+2 -2
View File
@@ -4,7 +4,7 @@
The launcher runs Steam through `muvm` and `FEXBash` with the CEF occlusion workaround. Once Steam's client files are present, it also disables bootstrap verification and repair and patches the Steam UI network initialization block that can leave login waiting indefinitely. Initial bootstrap keeps the normal bootstrap flags. If the FEX launcher is unavailable, it falls back to `steam`.
`omarchy-launch-steam --prepare` writes the current user's desktop override with `Exec=omarchy-launch-steam %U` and applies the same UI patch. Each matching chunk is backed up as `.omarchy-bak` before its first patch; existing backups are preserved, and already-patched and unrecognized chunks are left unchanged. The regex depends on Valve's client code and may need updating when that code changes.
`omarchy-launch-steam --prepare` creates the current user's desktop override with `Exec=omarchy-launch-steam %U` if it is missing, and applies the same UI patch. Existing overrides and symlinks are preserved on preparation and launch. If an existing override uses a different command, edit its `Exec` entry to use `omarchy-launch-steam %U` when you want this launcher. Each matching chunk is backed up as `.omarchy-bak` before its first patch; existing backups are preserved. The regex matches the original network initialization block, so a patched block is not changed again. An unrelated connected-state assignment elsewhere in the chunk does not suppress the fix. The regex depends on Valve's client code and may need updating when that code changes.
Only the launcher and license are installed. Steam's system desktop entry and downloaded client files remain outside this package's ownership; preparation runs as the desktop user, never in a package installation hook. A downstream Omarchy package that already owns the launcher must release that path before this package is installed, or in the same upgrade transaction.
@@ -14,4 +14,4 @@ Runtime dependencies are declared in `package()` so assembling the scripts does
python pkgbuilds/omarchy-steam-fex/test-launcher.py
```
The launcher was extracted from [omarchy-mx-mac commit 5e8e1188](https://github.com/scottjones/omarchy-mx-mac/commit/5e8e1188e39fae70cf4f7bda1a1d85d66eccae51), credited to Scott Jones, dl-alexandre, and Santeri Hernejärvi. The extraction replaces `omarchy-cmd-present` with `command -v`, removing the dependency on Omarchy itself. The launcher matches the version published in [omarchy-pkgs-aarch64](https://github.com/omarchy-mac/omarchy-pkgs-aarch64/tree/main/pkgbuilds/omarchy-steam-fex).
The launcher was extracted from [omarchy-mx-mac commit 5e8e1188](https://github.com/scottjones/omarchy-mx-mac/commit/5e8e1188e39fae70cf4f7bda1a1d85d66eccae51), credited to Scott Jones, dl-alexandre, and Santeri Hernejärvi. The extraction replaces `omarchy-cmd-present` with `command -v`, removing the dependency on Omarchy itself. Subsequent fixes preserve user desktop overrides and avoid false positives when checking whether the network block needs patching.
@@ -10,6 +10,9 @@ steam_root="$HOME/.local/share/Steam"
write_steam_desktop() {
local app_dir="$HOME/.local/share/applications"
# This is a user-owned override. Create it once without replacing existing
# customizations, including a symlink managed by the user.
[[ -e $app_dir/steam.desktop || -L $app_dir/steam.desktop ]] && return 0
mkdir -p "$app_dir"
cat >"$app_dir/steam.desktop" <<'EOF'
[Desktop Entry]
@@ -63,8 +66,8 @@ replacement = (
for path in sorted(steamui.glob("chunk~*.js")):
text = path.read_text(errors="replace")
if "m_bIsConnectedToANetwork=!0" in text and "RegisterForDeviceChanges" in text:
continue
# The exact original block no longer matches after replacement. A generic
# connected-state assignment elsewhere in the chunk is not a patch marker.
updated, count = pattern.subn(replacement, text, count=1)
if count != 1:
continue
@@ -143,6 +143,45 @@ class SteamLauncherTests(unittest.TestCase):
self.assertEqual(path.read_text(), content)
self.assertFalse(path.with_suffix('.js.omarchy-bak').exists())
def test_unrelated_connected_state_does_not_skip_original_block(self):
original = 'other.m_bIsConnectedToANetwork=!0;' + ORIGINAL
path = self.chunk(original)
self.run_launcher('--prepare')
self.assertIn('catch(e){}', path.read_text())
self.assertTrue(path.read_text().startswith('other.m_bIsConnectedToANetwork=!0;'))
self.assertEqual(path.with_suffix('.js.omarchy-bak').read_text(), original)
patched, modified = path.read_bytes(), path.stat().st_mtime_ns
self.run_launcher('--prepare')
self.assertEqual(path.read_bytes(), patched)
self.assertEqual(path.stat().st_mtime_ns, modified)
def test_existing_desktop_override_is_preserved_during_prepare_and_launch(self):
self.client_ready()
self.chunk()
self.desktop.parent.mkdir(parents=True)
customized = '[Desktop Entry]\nName=My Steam\nExec=my-steam-wrapper %U\nX-User-Setting=keep\n'
self.desktop.write_text(customized)
modified = self.desktop.stat().st_mtime_ns
for args in [('--prepare',), ()]:
self.run_launcher(*args)
self.assertEqual(self.desktop.read_text(), customized)
self.assertEqual(self.desktop.stat().st_mtime_ns, modified)
def test_existing_desktop_symlink_is_preserved_even_with_missing_target(self):
self.desktop.parent.mkdir(parents=True)
target = self.user_home / 'custom-steam.desktop'
self.desktop.symlink_to(target)
self.run_launcher('--prepare')
self.assertTrue(self.desktop.is_symlink())
self.assertFalse(target.exists())
def test_repeated_prepare_does_not_rewrite_created_desktop_override(self):
self.run_launcher('--prepare')
original, modified = self.desktop.read_bytes(), self.desktop.stat().st_mtime_ns
self.run_launcher('--prepare')
self.assertEqual(self.desktop.read_bytes(), original)
self.assertEqual(self.desktop.stat().st_mtime_ns, modified)
def test_only_first_matching_block_is_patched(self):
path = self.chunk(ORIGINAL + ORIGINAL)
self.run_launcher('--prepare')