From e8d7d9eb15466a88e755aafc7ddda5029ef83524 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 12 Nov 2026 11:37:13 +0900
Subject: [PATCH 01/27] change: abstract flatpak ps command
---
dzgui/init/proc.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dzgui/init/proc.py b/dzgui/init/proc.py
index 0c1a2a06..7717f077 100644
--- a/dzgui/init/proc.py
+++ b/dzgui/init/proc.py
@@ -30,16 +30,19 @@ def is_steam_running(cmd: str) -> bool:
def is_sandboxed() -> bool:
return bool(os.environ.get("FLATPAK_ID"))
+def get_flatpak_output() -> list[str]:
+ proc = subprocess.check_output(
+ [FLATPAK_CMD, "ps", "--columns=application"], text=True
+ )
+ lines = proc.splitlines()
+ return lines
def is_flatpak_steam_running() -> bool:
if is_sandboxed():
return True
if has_cmd(FLATPAK_CMD) is False:
return False
- proc = subprocess.check_output(
- [FLATPAK_CMD, "ps", "--columns=application"], text=True
- )
- lines = proc.splitlines()
+ lines = get_flatpak_output()
if FLATPAK_APPID in lines:
return True
return False
From 77682cacd459e2aa47cbb26ae3df95a8922ad694 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 12 Nov 2026 11:37:49 +0900
Subject: [PATCH 02/27] change: refactor test for readability
---
tests/test_process_detection.py | 139 +++++++++++++++++---------------
1 file changed, 76 insertions(+), 63 deletions(-)
diff --git a/tests/test_process_detection.py b/tests/test_process_detection.py
index f57ced35..097790d4 100644
--- a/tests/test_process_detection.py
+++ b/tests/test_process_detection.py
@@ -1,80 +1,93 @@
import pytest
-import unittest
-from unittest.mock import patch
-from typing import Any
+from typing import Literal, TYPE_CHECKING
from dzgui.const.constants import (
FLATPAK_APPID,
FLATPAK_ROOT_PATH,
- FLATPAK_RUN_CMD,
- FLATPAK_SANDBOX,
)
from dzgui.init import proc
+if TYPE_CHECKING:
+ from _pytest.monkeypatch import MonkeyPatch
+
pytestmark = pytest.mark.flatpak
-class TestSteamDetection(unittest.TestCase):
- def test_flatpak_detection_with_multiple_running_apps(self) -> None:
- def flatpak_output(args: Any, *, text: str) -> str:
- # Default 'flatpak ps' includes instance, PID, app and runtime columns.
- if args == ["flatpak", "ps", "--columns=application"]:
- return f"com.spotify.Client\n{FLATPAK_APPID}\n{FLATPAK_APPID}\n"
- return f"3904921611\t1257689\t{FLATPAK_APPID}\torg.freedesktop.Platform\n"
+def mock_has_cmd(cmd: str) -> Literal[True]:
+ return True
- with (
- patch.object(proc, "has_cmd", return_value=True),
- patch.object(proc.subprocess, "check_output", side_effect=flatpak_output),
- ):
- for client in (FLATPAK_RUN_CMD, FLATPAK_SANDBOX):
- with self.subTest(client=client):
- self.assertTrue(proc.is_steam_running(client))
- def test_flatpak_not_running(self) -> None:
- with patch.object(proc, "has_cmd", return_value=True):
- for output in ("", "com.spotify.Client\n", f"{FLATPAK_APPID}Helper\n"):
- with (
- self.subTest(output=output),
- patch.object(proc.subprocess, "check_output", return_value=output),
- ):
- self.assertFalse(proc.is_flatpak_steam_running())
+def mock_has_not_cmd(cmd: str) -> Literal[False]:
+ return False
- def test_flatpak_not_installed(self) -> None:
- with (
- patch.object(proc, "has_cmd", return_value=False),
- patch.object(proc.subprocess, "check_output") as check_output,
- ):
- self.assertFalse(proc.is_flatpak_steam_running())
- check_output.assert_not_called()
- def test_native_steam(self) -> None:
- with patch.object(proc, "has_cmd", return_value=True):
- for output, expected in (
- (
- [
- [FLATPAK_ROOT_PATH],
- "/home/user/.local/share/Steam/ubuntu12_64/steamwebhelper",
- ],
- True,
- ),
- ([[FLATPAK_ROOT_PATH]], False),
- ([[FLATPAK_ROOT_PATH], ["steam-runtime-launcher-service"]], False),
- ([["/home/user/.local/share/Steam/ubuntu12_64/steamwebhelper"]], True),
- (
- [
- ["/home/user/.local/share/Steam/ubuntu12_64/steamwebhelper"],
- "steam-runtime-launcher-service",
- ],
- True,
- ),
- ):
- with (
- self.subTest(running=output),
- patch.object(proc, "get_steam_procs", return_value=output),
- ):
- self.assertEqual(proc.is_native_steam_running(), expected)
+def mock_get_flatpak_output() -> list[str]:
+ lines = ["Application", "com.freedesktop.Platform", f"{FLATPAK_APPID}"]
+ return lines
- def test_invalid_client(self) -> None:
- with self.assertRaises(TypeError):
- proc.is_steam_running("invalid-client")
+
+@pytest.mark.parametrize(
+ "output, expected",
+ [
+ (
+ [
+ [f"/home/user/{FLATPAK_ROOT_PATH}/.local/share/Steam"],
+ ["/home/user/.local/share/Steam/ubuntu12_64/steamwebhelper"],
+ ],
+ True,
+ ),
+ (
+ [
+ [f"/home/user/{FLATPAK_ROOT_PATH}/.local/share/Steam"],
+ ["steam-runtime-launcher-service"],
+ ],
+ False,
+ ),
+ ([[f"/home/user/{FLATPAK_ROOT_PATH}/.local/share/Steam"]], False),
+ ([["/home/user/.local/share/Steam/ubuntu12_64/steamwebhelper"]], True),
+ (
+ [
+ ["/home/user/.local/share/Steam/ubuntu12_64/steamwebhelper"],
+ ["steam-runtime-launcher-service"],
+ ],
+ True,
+ ),
+ ],
+)
+def test_native_steam_running(
+ monkeypatch: "MonkeyPatch", output: list[list[str]], expected: bool
+) -> None:
+ def mock_get_steam_procs() -> list[list[str]]:
+ return output
+
+ monkeypatch.setattr("dzgui.init.proc.has_cmd", mock_has_cmd)
+ monkeypatch.setattr("dzgui.init.proc.get_steam_procs", mock_get_steam_procs)
+ assert proc.is_native_steam_running() == expected
+
+
+def test_flatpak_running(monkeypatch: "MonkeyPatch") -> None:
+ monkeypatch.setattr("dzgui.init.proc.has_cmd", mock_has_cmd)
+ monkeypatch.setattr("dzgui.init.proc.get_flatpak_output", mock_get_flatpak_output)
+ assert proc.is_flatpak_steam_running()
+
+
+def test_flatpak_sandboxed(monkeypatch: "MonkeyPatch") -> None:
+ monkeypatch.setattr("dzgui.init.proc.has_cmd", mock_has_not_cmd)
+ monkeypatch.setenv("FLATPAK_ID", FLATPAK_APPID)
+ assert proc.is_flatpak_steam_running()
+
+
+def test_flatpak_not_installed(monkeypatch: "MonkeyPatch") -> None:
+ monkeypatch.setattr("dzgui.init.proc.has_cmd", mock_has_not_cmd)
+ assert not proc.is_flatpak_steam_running()
+
+
+def test_steam_not_installed(monkeypatch: "MonkeyPatch") -> None:
+ monkeypatch.setattr("dzgui.init.proc.has_cmd", mock_has_not_cmd)
+ assert not proc.is_native_steam_running()
+
+
+def test_invalid_client() -> None:
+ with pytest.raises(TypeError):
+ proc.is_steam_running("invalid-client")
From d2208787b4b2ddc17e6111009ecf1075562430da Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 12 Nov 2026 12:01:59 +0900
Subject: [PATCH 03/27] chore: clear typehinting errors in build scripts
---
scripts/parse_toml.py | 3 ++-
scripts/prebuild.py | 6 +++---
scripts/release.py | 4 ++--
scripts/scrot.py | 14 ++++++++++----
scripts/untracked.py | 17 +++++++----------
5 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/scripts/parse_toml.py b/scripts/parse_toml.py
index e4b52109..612f832d 100644
--- a/scripts/parse_toml.py
+++ b/scripts/parse_toml.py
@@ -1,8 +1,9 @@
import tomllib
from shared import get_git_root
+from typing import Any
-def get_entrypoint() -> None:
+def get_entrypoint() -> Any:
root = get_git_root()
p = root.joinpath("pyproject.toml")
with open(p, "rb") as f:
diff --git a/scripts/prebuild.py b/scripts/prebuild.py
index 143bc564..cdf97f2c 100644
--- a/scripts/prebuild.py
+++ b/scripts/prebuild.py
@@ -52,7 +52,7 @@ def untar(file: str, glob: str, renamed: str) -> None:
os.rename(_dir, build_dir.joinpath(renamed))
-def install_deps() -> None:
+def install_deps() -> int:
pip = build_dir.joinpath(f"{CPYTHON_BUILD}/bin/pip")
proc = subprocess.run([pip, "install", root])
return proc.returncode
@@ -65,12 +65,12 @@ def repackage() -> None:
tar.add(build_dir.joinpath(CPYTHON_BUILD), arcname="python")
-def rebuild_cpython() -> None:
+def rebuild_cpython() -> str:
if cpython_dir.is_dir() is False:
get_cpython()
code = install_deps()
if code != 0:
- return
+ return ""
repackage()
return get_packaged_version()
diff --git a/scripts/release.py b/scripts/release.py
index 2afaf47c..934ef7c9 100644
--- a/scripts/release.py
+++ b/scripts/release.py
@@ -92,8 +92,8 @@ with tarfile.open(tarpath, "w:gz") as tar:
tar.add(subfolder, arcname=appname, filter=update_uname)
print(f"Wrote tarfile to '{tarpath}'")
-proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
-assert proc.stdout.rstrip() == version
+built_proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
+assert str(built_proc.stdout).rstrip() == version
# TODO: clean up staging directory
release_exe.unlink()
diff --git a/scripts/scrot.py b/scripts/scrot.py
index 38001972..be400d49 100644
--- a/scripts/scrot.py
+++ b/scripts/scrot.py
@@ -8,7 +8,13 @@ def get_image_path() -> Path:
return get_git_root().joinpath("dzgui/data/images/example.png")
-p = get_image_path()
-app = build_gui("", False)
-app.set_automation_param("screenshot_path", p)
-app.run(None)
+def take_screenshot() -> None:
+ p = get_image_path()
+ app = build_gui("", False)
+ if app is None:
+ return
+ app.set_automation_param("screenshot_path", p)
+ app.run(None)
+
+
+take_screenshot()
diff --git a/scripts/untracked.py b/scripts/untracked.py
index f53714d0..d77fa261 100644
--- a/scripts/untracked.py
+++ b/scripts/untracked.py
@@ -3,14 +3,11 @@ import subprocess
import sys
cmd = ["git", "ls-files", "--others", "--exclude-standard"]
-result = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
+result = subprocess.run(
+ cmd, capture_output=True, text=True
)
-with open(".gitignore", "r") as f:
- ignored = [line.rstrip() for line in f]
-
-untracked = [os.path.basename(line.rstrip()) for line in result.stdout]
-for file in untracked:
- if not any(file in item for item in ignored):
- print(f"File '{file}' is untracked. Add to .gitignore file if this is intended.")
- sys.exit(1)
+untracked = [os.path.basename(line.rstrip()) for line in result.stdout.splitlines()]
+if bool(untracked):
+ print(f"The following files are untracked. Add to .gitignore if this is intended.")
+ print("\n".join(untracked))
+ sys.exit(1)
From 6adecbedaa4189555fc37c271addb16227e2a1ca Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 01:44:12 +0900
Subject: [PATCH 04/27] fix: parse custom xdg path correctly
---
dzgui/api/steam.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py
index 23357f2b..2d52ed34 100644
--- a/dzgui/api/steam.py
+++ b/dzgui/api/steam.py
@@ -67,11 +67,11 @@ def get_steam_paths() -> list[tuple[Path, str]]:
HOME = Path.home()
env = os.environ.get("XDG_DATA_HOME")
if env is not None:
- XDG_DATA_HOME = env
+ XDG_DATA_HOME = Path(env)
+ DEFAULT_PATH = XDG_DATA_HOME.joinpath("Steam")
else:
- XDG_DATA_HOME = DEFAULT_STEAM_PATH
+ DEFAULT_PATH = HOME.joinpath(DEFAULT_STEAM_PATH)
- DEFAULT_PATH = HOME.joinpath(XDG_DATA_HOME)
FLATPAK_PATH = HOME.joinpath(FLATPAK_STEAM_PATH)
UBUNTU_PATH = HOME.joinpath(UBUNTU_STEAM_PATH)
DEBIAN_PATH = HOME.joinpath(DEBIAN_STEAM_PATH)
From d694aa56e8d8d3666f62fb7b2dcfc484295154c2 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 01:44:23 +0900
Subject: [PATCH 05/27] chore: clear typehinting errors
---
docs/source/conf.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 4c746e2a..63611680 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -15,7 +15,7 @@ author = 'aclist'
extensions = []
templates_path = ['_templates']
-exclude_patterns = []
+exclude_patterns = [] # type: ignore[var-annotated]
From da474e274ff614d6a282e37c3abd0b23bd2b2e96 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 01:45:26 +0900
Subject: [PATCH 06/27] chore: update tests
---
tests/test_default_steam_paths.py | 43 +++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 tests/test_default_steam_paths.py
diff --git a/tests/test_default_steam_paths.py b/tests/test_default_steam_paths.py
new file mode 100644
index 00000000..a7136f25
--- /dev/null
+++ b/tests/test_default_steam_paths.py
@@ -0,0 +1,43 @@
+import pytest
+import tempfile
+
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+from dzgui.api.steam import get_steam_paths
+
+if TYPE_CHECKING:
+ from _pytest.monkeypatch import MonkeyPatch
+
+
+def test_custom_xdg_path(monkeypatch: "MonkeyPatch") -> None:
+ tmp = tempfile.TemporaryDirectory(delete=False).name
+ custom_path = Path(tmp).joinpath("xdg_data_home")
+ monkeypatch.setenv("XDG_DATA_HOME", str(custom_path))
+
+ vdf_path = custom_path.joinpath("Steam/steamapps")
+ vdf_path.mkdir(parents=True, exist_ok=True)
+ vdf_path.joinpath("libraryfolders.vdf").touch()
+
+ resolved_paths = get_steam_paths()
+ expect = custom_path.joinpath("Steam")
+ assert any(expect in el for el in resolved_paths)
+
+
+def test_default_xdg_path() -> None:
+ resolved_paths = get_steam_paths()
+ expect = Path.home().joinpath(".local/share/Steam")
+ assert any(expect in el for el in resolved_paths)
+
+
+def test_ubuntu_path() -> None:
+ resolved_paths = get_steam_paths()
+ expect = Path.home().joinpath(".steam/steam")
+ assert any(expect in el for el in resolved_paths)
+
+
+@pytest.mark.flatpak
+def test_flatpak_path() -> None:
+ resolved_paths = get_steam_paths()
+ expect = Path.home().joinpath(".var/app/com.valvesoftware.Steam/data/steam")
+ assert any(expect in el for el in resolved_paths)
From ea41503dad9ab4e5d671df3b6c6999779c00e35e Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 02:10:38 +0900
Subject: [PATCH 07/27] change: swallow stderr
---
dzgui/init/prereqs.py | 2 +-
dzgui/init/proc.py | 17 +++++++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dzgui/init/prereqs.py b/dzgui/init/prereqs.py
index 9266bfbe..7e2a41f1 100644
--- a/dzgui/init/prereqs.py
+++ b/dzgui/init/prereqs.py
@@ -23,7 +23,7 @@ def has_flatpak_client() -> bool:
else:
return False
except Exception as e:
- logger.critical(e)
+ logger.debug(e)
return False
diff --git a/dzgui/init/proc.py b/dzgui/init/proc.py
index 7717f077..483c8fe1 100644
--- a/dzgui/init/proc.py
+++ b/dzgui/init/proc.py
@@ -30,6 +30,7 @@ def is_steam_running(cmd: str) -> bool:
def is_sandboxed() -> bool:
return bool(os.environ.get("FLATPAK_ID"))
+
def get_flatpak_output() -> list[str]:
proc = subprocess.check_output(
[FLATPAK_CMD, "ps", "--columns=application"], text=True
@@ -37,15 +38,23 @@ def get_flatpak_output() -> list[str]:
lines = proc.splitlines()
return lines
+
def is_flatpak_steam_running() -> bool:
if is_sandboxed():
return True
if has_cmd(FLATPAK_CMD) is False:
return False
- lines = get_flatpak_output()
- if FLATPAK_APPID in lines:
- return True
- return False
+ try:
+ proc = subprocess.check_output(
+ [FLATPAK_CMD, "ps", "--columns=application"], text=True
+ )
+ lines = proc.splitlines()
+ if FLATPAK_APPID in lines:
+ return True
+ return False
+ except Exception as e:
+ logger.debug(e)
+ return False
def get_steam_procs() -> list[list[str]]:
From d47d7075e9e0939498c55a1856dddd11d8606c21 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 02:13:29 +0900
Subject: [PATCH 08/27] change: move try statement to outer function
---
dzgui/init/proc.py | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/dzgui/init/proc.py b/dzgui/init/proc.py
index 483c8fe1..ac1051cc 100644
--- a/dzgui/init/proc.py
+++ b/dzgui/init/proc.py
@@ -31,12 +31,16 @@ def is_sandboxed() -> bool:
return bool(os.environ.get("FLATPAK_ID"))
-def get_flatpak_output() -> list[str]:
- proc = subprocess.check_output(
- [FLATPAK_CMD, "ps", "--columns=application"], text=True
- )
- lines = proc.splitlines()
- return lines
+def get_flatpak_output() -> list[str] | None:
+ try:
+ proc = subprocess.check_output(
+ [FLATPAK_CMD, "ps", "--columns=application"], text=True
+ )
+ lines = proc.splitlines()
+ return lines
+ except Exception as e:
+ logger.debug(e)
+ return None
def is_flatpak_steam_running() -> bool:
@@ -44,17 +48,12 @@ def is_flatpak_steam_running() -> bool:
return True
if has_cmd(FLATPAK_CMD) is False:
return False
- try:
- proc = subprocess.check_output(
- [FLATPAK_CMD, "ps", "--columns=application"], text=True
- )
- lines = proc.splitlines()
- if FLATPAK_APPID in lines:
- return True
- return False
- except Exception as e:
- logger.debug(e)
+ lines = get_flatpak_output()
+ if lines is None:
return False
+ if FLATPAK_APPID in lines:
+ return True
+ return False
def get_steam_procs() -> list[list[str]]:
From dfef2cfd752c7bf6302eb1168a967defd399c415 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 02:13:56 +0900
Subject: [PATCH 09/27] drop: unused f-string
---
scripts/untracked.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/scripts/untracked.py b/scripts/untracked.py
index d77fa261..198345ff 100644
--- a/scripts/untracked.py
+++ b/scripts/untracked.py
@@ -3,11 +3,9 @@ import subprocess
import sys
cmd = ["git", "ls-files", "--others", "--exclude-standard"]
-result = subprocess.run(
- cmd, capture_output=True, text=True
-)
+result = subprocess.run(cmd, capture_output=True, text=True)
untracked = [os.path.basename(line.rstrip()) for line in result.stdout.splitlines()]
if bool(untracked):
- print(f"The following files are untracked. Add to .gitignore if this is intended.")
+ print("The following files are untracked. Add to .gitignore if this is intended.")
print("\n".join(untracked))
sys.exit(1)
From a32c99b3eba50891f6afaa9a4d75eb9fc083986a Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 02:22:59 +0900
Subject: [PATCH 10/27] feat: support Ubuntu Snap path
---
dzgui/api/steam.py | 11 ++++++++++-
dzgui/const/constants.py | 1 +
dzgui/strings/wizard.py | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py
index 2d52ed34..1e8dee4f 100644
--- a/dzgui/api/steam.py
+++ b/dzgui/api/steam.py
@@ -27,6 +27,7 @@ from dzgui.const.constants import (
FLATPAK_STEAM_PATH,
LIBRARYFOLDERS_PATH,
REQUEST_TIMEOUT,
+ UBUNTU_SNAP_STEAM_PATH,
UBUNTU_STEAM_PATH,
VDF_PATH,
)
@@ -75,15 +76,23 @@ def get_steam_paths() -> list[tuple[Path, str]]:
FLATPAK_PATH = HOME.joinpath(FLATPAK_STEAM_PATH)
UBUNTU_PATH = HOME.joinpath(UBUNTU_STEAM_PATH)
DEBIAN_PATH = HOME.joinpath(DEBIAN_STEAM_PATH)
+ UBUNTU_SNAP_PATH = HOME.joinpath(UBUNTU_SNAP_STEAM_PATH)
human = {
DEFAULT_PATH: wizard.desc_default_path,
FLATPAK_PATH: wizard.desc_flatpak_path,
UBUNTU_PATH: wizard.desc_ubuntu_path,
+ UBUNTU_SNAP_PATH: wizard.desc_ubuntu_snap_path,
DEBIAN_PATH: wizard.desc_debian_path,
}
- for path in DEFAULT_PATH, FLATPAK_PATH, UBUNTU_PATH, DEBIAN_PATH:
+ for path in (
+ DEFAULT_PATH,
+ FLATPAK_PATH,
+ UBUNTU_PATH,
+ UBUNTU_SNAP_PATH,
+ DEBIAN_PATH,
+ ):
if path is FLATPAK_PATH and has_flatpak_client() is False:
continue
if path is not FLATPAK_PATH and has_steam_client() is False:
diff --git a/dzgui/const/constants.py b/dzgui/const/constants.py
index daed17e6..f2dca4b1 100644
--- a/dzgui/const/constants.py
+++ b/dzgui/const/constants.py
@@ -60,6 +60,7 @@ DEFAULT_STEAM_PATH = ".local/share/Steam"
FLATPAK_ROOT_PATH = ".var/app/com.valvesoftware.Steam"
FLATPAK_STEAM_PATH = FLATPAK_ROOT_PATH + "/data/Steam"
UBUNTU_STEAM_PATH = ".steam/steam"
+UBUNTU_SNAP_STEAM_PATH = "snap/steam/common/" + DEFAULT_STEAM_PATH
DEBIAN_STEAM_PATH = ".steam/debian-installation"
LOG_FILTERS = ("CRITICAL", "WARNING", "INFO", "DEBUG")
diff --git a/dzgui/strings/wizard.py b/dzgui/strings/wizard.py
index de837620..47a20c52 100644
--- a/dzgui/strings/wizard.py
+++ b/dzgui/strings/wizard.py
@@ -17,6 +17,7 @@ desc_flatpak_path = (
"This is the default Steam path if you are using Flatpak Steam."
)
desc_ubuntu_path = "This is the default Steam path on Ubuntu-based systems."
+desc_ubuntu_snap_path = "This is the default Steam path on Ubuntu-based systems using Snap packages."
desc_debian_path = "This is the default Steam path on Debian-based systems."
no_valid_paths = (
"No valid Steam path or Steam command found on system. Please install Steam to continue."
From 45c412e1ad58e210d4ab12cb341f05451eb33013 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Tue, 17 Nov 2026 03:12:05 +0900
Subject: [PATCH 11/27] change: make reference to snap more generic
---
dzgui/api/steam.py | 8 ++++----
dzgui/const/constants.py | 2 +-
dzgui/strings/wizard.py | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py
index 1e8dee4f..82708df3 100644
--- a/dzgui/api/steam.py
+++ b/dzgui/api/steam.py
@@ -27,7 +27,7 @@ from dzgui.const.constants import (
FLATPAK_STEAM_PATH,
LIBRARYFOLDERS_PATH,
REQUEST_TIMEOUT,
- UBUNTU_SNAP_STEAM_PATH,
+ SNAP_STEAM_PATH,
UBUNTU_STEAM_PATH,
VDF_PATH,
)
@@ -76,13 +76,13 @@ def get_steam_paths() -> list[tuple[Path, str]]:
FLATPAK_PATH = HOME.joinpath(FLATPAK_STEAM_PATH)
UBUNTU_PATH = HOME.joinpath(UBUNTU_STEAM_PATH)
DEBIAN_PATH = HOME.joinpath(DEBIAN_STEAM_PATH)
- UBUNTU_SNAP_PATH = HOME.joinpath(UBUNTU_SNAP_STEAM_PATH)
+ SNAP_PATH = HOME.joinpath(SNAP_STEAM_PATH)
human = {
DEFAULT_PATH: wizard.desc_default_path,
FLATPAK_PATH: wizard.desc_flatpak_path,
UBUNTU_PATH: wizard.desc_ubuntu_path,
- UBUNTU_SNAP_PATH: wizard.desc_ubuntu_snap_path,
+ SNAP_PATH: wizard.desc_snap_path,
DEBIAN_PATH: wizard.desc_debian_path,
}
@@ -90,7 +90,7 @@ def get_steam_paths() -> list[tuple[Path, str]]:
DEFAULT_PATH,
FLATPAK_PATH,
UBUNTU_PATH,
- UBUNTU_SNAP_PATH,
+ SNAP_PATH,
DEBIAN_PATH,
):
if path is FLATPAK_PATH and has_flatpak_client() is False:
diff --git a/dzgui/const/constants.py b/dzgui/const/constants.py
index f2dca4b1..6c8a6092 100644
--- a/dzgui/const/constants.py
+++ b/dzgui/const/constants.py
@@ -60,7 +60,7 @@ DEFAULT_STEAM_PATH = ".local/share/Steam"
FLATPAK_ROOT_PATH = ".var/app/com.valvesoftware.Steam"
FLATPAK_STEAM_PATH = FLATPAK_ROOT_PATH + "/data/Steam"
UBUNTU_STEAM_PATH = ".steam/steam"
-UBUNTU_SNAP_STEAM_PATH = "snap/steam/common/" + DEFAULT_STEAM_PATH
+SNAP_STEAM_PATH = "snap/steam/common/" + DEFAULT_STEAM_PATH
DEBIAN_STEAM_PATH = ".steam/debian-installation"
LOG_FILTERS = ("CRITICAL", "WARNING", "INFO", "DEBUG")
diff --git a/dzgui/strings/wizard.py b/dzgui/strings/wizard.py
index 47a20c52..03ab4484 100644
--- a/dzgui/strings/wizard.py
+++ b/dzgui/strings/wizard.py
@@ -17,7 +17,7 @@ desc_flatpak_path = (
"This is the default Steam path if you are using Flatpak Steam."
)
desc_ubuntu_path = "This is the default Steam path on Ubuntu-based systems."
-desc_ubuntu_snap_path = "This is the default Steam path on Ubuntu-based systems using Snap packages."
+desc_snap_path = "This is the default Steam path on systems using Snap packages."
desc_debian_path = "This is the default Steam path on Debian-based systems."
no_valid_paths = (
"No valid Steam path or Steam command found on system. Please install Steam to continue."
From 29223a8a1fc027cc7baa39353cca4d563822d9e0 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Wed, 18 Nov 2026 16:27:11 +0900
Subject: [PATCH 12/27] change: disambiguate custom XDG_DATA_HOME
---
dzgui/api/steam.py | 4 +++-
dzgui/strings/wizard.py | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py
index 82708df3..cf320ac0 100644
--- a/dzgui/api/steam.py
+++ b/dzgui/api/steam.py
@@ -70,8 +70,10 @@ def get_steam_paths() -> list[tuple[Path, str]]:
if env is not None:
XDG_DATA_HOME = Path(env)
DEFAULT_PATH = XDG_DATA_HOME.joinpath("Steam")
+ default_label = wizard.desc_custom_path
else:
DEFAULT_PATH = HOME.joinpath(DEFAULT_STEAM_PATH)
+ default_label = wizard.desc_default_path
FLATPAK_PATH = HOME.joinpath(FLATPAK_STEAM_PATH)
UBUNTU_PATH = HOME.joinpath(UBUNTU_STEAM_PATH)
@@ -79,7 +81,7 @@ def get_steam_paths() -> list[tuple[Path, str]]:
SNAP_PATH = HOME.joinpath(SNAP_STEAM_PATH)
human = {
- DEFAULT_PATH: wizard.desc_default_path,
+ DEFAULT_PATH: default_label,
FLATPAK_PATH: wizard.desc_flatpak_path,
UBUNTU_PATH: wizard.desc_ubuntu_path,
SNAP_PATH: wizard.desc_snap_path,
diff --git a/dzgui/strings/wizard.py b/dzgui/strings/wizard.py
index 03ab4484..8bf12f73 100644
--- a/dzgui/strings/wizard.py
+++ b/dzgui/strings/wizard.py
@@ -12,6 +12,7 @@ blurb_steam_path = """
DZGUI needs to find the location to your default Steam installation.
This will be used to determine whether (and where) DayZ is installed.
"""
+desc_custom_path = "This is the expected Steam path if you set a custom XDG_DATA_HOME directory."
desc_default_path = "This is the default Steam path on most distributions."
desc_flatpak_path = (
"This is the default Steam path if you are using Flatpak Steam."
From 0f28885e7b81f9e279a81d15df913f06c7c28e36 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Wed, 18 Nov 2026 16:31:57 +0900
Subject: [PATCH 13/27] chore: update thanks page
---
dzgui/util/strings.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dzgui/util/strings.py b/dzgui/util/strings.py
index 79512986..575175c5 100644
--- a/dzgui/util/strings.py
+++ b/dzgui/util/strings.py
@@ -347,7 +347,9 @@ thanks = Thanks(
"scandalouss",
"SnackSBR",
"StevelDusa",
+ "sylvaingirardbe",
"Thoughtduck216",
+ "u-alexandru",
],
)
From 00741b0b60d7ea5cd3014acd9bf4f91c1e919593 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 06:10:24 +0900
Subject: [PATCH 14/27] fix: parse real home in sandbox
---
dzgui/config/xdg.py | 10 +++++-----
dzgui/init/prereqs.py | 4 ++--
dzgui/init/proc.py | 14 ++++++++++++--
dzgui/strings/wizard.py | 2 +-
tests/test_home_in_sandbox.py | 23 +++++++++++++++++++++++
5 files changed, 43 insertions(+), 10 deletions(-)
create mode 100644 tests/test_home_in_sandbox.py
diff --git a/dzgui/config/xdg.py b/dzgui/config/xdg.py
index eac3dcf4..1250dbbd 100644
--- a/dzgui/config/xdg.py
+++ b/dzgui/config/xdg.py
@@ -6,10 +6,9 @@ from dataclasses import dataclass
from dzgui.const.constants import (
APP_NAME_LOWER,
DEBUG_LOG,
- FLATPAK_ROOT_PATH,
SYSTEM_LOG,
)
-from dzgui.init.proc import is_sandboxed
+from dzgui.init.proc import is_flatpak_sandbox, is_snap_sandbox
@dataclass(slots=True, frozen=True)
@@ -53,6 +52,10 @@ def is_writeable(path_str: str) -> bool:
def get_xdg_paths() -> dict[str, Path]:
home = Path.home()
+ if resolved := os.environ.get("SNAP_REAL_HOME"): # Snap
+ home = Path(resolved)
+ elif resolved := os.environ.get("HOME"): # Flatpak
+ home = Path(resolved)
xdg_paths = {
"XDG_CONFIG_HOME": home / ".config",
"XDG_STATE_HOME": home / ".local" / "state",
@@ -62,9 +65,6 @@ def get_xdg_paths() -> dict[str, Path]:
resolved_paths = {}
for path in xdg_paths:
real_path = os.environ.get(path)
- if real_path is not None and is_sandboxed():
- search_string = FLATPAK_ROOT_PATH + "/"
- real_path = real_path.replace(search_string, "")
if real_path is not None and is_writeable(real_path):
new_path = Path(real_path)
else:
diff --git a/dzgui/init/prereqs.py b/dzgui/init/prereqs.py
index 7e2a41f1..122ebb68 100644
--- a/dzgui/init/prereqs.py
+++ b/dzgui/init/prereqs.py
@@ -3,13 +3,13 @@ import shutil
import subprocess
from dzgui.const.constants import APP_NAME, FLATPAK_APPID, FLATPAK_CMD, STEAM_CMD
-from dzgui.init.proc import is_sandboxed
+from dzgui.init.proc import is_flatpak_sandbox
logger = logging.getLogger(APP_NAME)
def has_flatpak_client() -> bool:
- if is_sandboxed():
+ if is_flatpak_sandbox():
return True
try:
res = subprocess.run(
diff --git a/dzgui/init/proc.py b/dzgui/init/proc.py
index ac1051cc..dbf3bf55 100644
--- a/dzgui/init/proc.py
+++ b/dzgui/init/proc.py
@@ -27,10 +27,20 @@ def is_steam_running(cmd: str) -> bool:
raise TypeError("Not a valid Steam client selection")
-def is_sandboxed() -> bool:
+def is_snap_sandbox() -> bool:
+ return bool(os.environ.get("SNAP"))
+
+
+def is_flatpak_sandbox() -> bool:
return bool(os.environ.get("FLATPAK_ID"))
+def is_sandboxed() -> bool:
+ if is_snap_sandbox() or is_flatpak_sandbox():
+ return True
+ return False
+
+
def get_flatpak_output() -> list[str] | None:
try:
proc = subprocess.check_output(
@@ -44,7 +54,7 @@ def get_flatpak_output() -> list[str] | None:
def is_flatpak_steam_running() -> bool:
- if is_sandboxed():
+ if is_flatpak_sandbox():
return True
if has_cmd(FLATPAK_CMD) is False:
return False
diff --git a/dzgui/strings/wizard.py b/dzgui/strings/wizard.py
index de837620..54497080 100644
--- a/dzgui/strings/wizard.py
+++ b/dzgui/strings/wizard.py
@@ -3,7 +3,7 @@ title_intro = "Welcome"
blurb_intro = """
This wizard will help you set up some common config options before launching the application.
"""
-error_sandbox = "Setup cannot be run from inside Flatpak sandbox.\nPlease launch the application directly."
+error_sandbox = "Setup cannot be run from inside a sandboxed version of Steam (Snap/Flatpak).\nPlease launch the application directly first."
welcome = "Welcome to {0}!"
### SteamPathPage
diff --git a/tests/test_home_in_sandbox.py b/tests/test_home_in_sandbox.py
new file mode 100644
index 00000000..4404b62a
--- /dev/null
+++ b/tests/test_home_in_sandbox.py
@@ -0,0 +1,23 @@
+import pytest
+import tempfile
+
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+from dzgui.config.xdg import get_xdg_paths
+
+if TYPE_CHECKING:
+ from _pytest.monkeypatch import MonkeyPatch
+
+
+@pytest.mark.parametrize("env", ["SNAP_REAL_HOME", "HOME"])
+def test_sandbox_home_resolution(monkeypatch: "MonkeyPatch", env: str) -> None:
+ with tempfile.NamedTemporaryFile(delete=False) as f:
+ monkeypatch.setenv(env, f.name)
+ paths = get_xdg_paths()
+ assert paths["XDG_CONFIG_HOME"] == Path(f.name).joinpath(".config/dzgui")
+
+
+def test_home_fallback() -> None:
+ paths = get_xdg_paths()
+ assert paths["XDG_CONFIG_HOME"] == Path.home().joinpath(".config/dzgui")
From dee566932a5e9cb6cecfe64e551ee31706baa77b Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 06:10:49 +0900
Subject: [PATCH 15/27] fix: wrap long error labels
---
dzgui/views/dialogs/boot.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dzgui/views/dialogs/boot.py b/dzgui/views/dialogs/boot.py
index 5a8a7181..a737caac 100644
--- a/dzgui/views/dialogs/boot.py
+++ b/dzgui/views/dialogs/boot.py
@@ -19,7 +19,7 @@ from dzgui.views.components.buttons import ClipboardButton
from dzgui.views.mixins.colorscheme import ColorAwareApp
gi.require_version("Gtk", "3.0")
-from gi.repository import Gtk, GLib, Gdk
+from gi.repository import Gtk, GLib, Gdk, Pango
if TYPE_CHECKING:
from dzgui.config.xdg import Xdg
@@ -95,7 +95,7 @@ class BootDialog(ColorAwareApp, Gtk.Dialog): # type: ignore
margin_top=30,
margin_bottom=30,
)
- self.error_label = Gtk.Label(margin_start=15, margin_end=15)
+ self.error_label = Gtk.Label(margin_start=15, margin_end=15, wrap=True, wrap_mode=Pango.WrapMode.WORD)
# TODO: abstract class
self.copy_button = ClipboardButton(self.error_label.get_text)
From 5853e15b8eba19c569fde5e114d371f0f07f5a10 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 06:22:05 +0900
Subject: [PATCH 16/27] fix: return empty list if mod dir is missing
---
dzgui/api/mods.py | 4 ++++
dzgui/util/symlink.py | 2 ++
2 files changed, 6 insertions(+)
diff --git a/dzgui/api/mods.py b/dzgui/api/mods.py
index 1d595280..55bdd64a 100644
--- a/dzgui/api/mods.py
+++ b/dzgui/api/mods.py
@@ -35,6 +35,9 @@ def get_local_mod_path(steam_path: Path) -> Path:
def get_local_mods(workshop_path: Path) -> list[Path]:
+ # NOTE: user may not have staged mods before
+ if workshop_path.is_dir() is False:
+ return []
mods = [file for file in workshop_path.iterdir() if file.is_dir()]
return mods
@@ -123,6 +126,7 @@ def remove_stale_signatures(
path = lookup(config, Preferences.DEFAULT)
steam_path = Path(path)
+
if ids is None:
local_ids = get_local_mod_ids(steam_path)
diff --git a/dzgui/util/symlink.py b/dzgui/util/symlink.py
index 574ec2bd..9049f91a 100644
--- a/dzgui/util/symlink.py
+++ b/dzgui/util/symlink.py
@@ -35,6 +35,8 @@ def rebuild_symlinks(config: Path) -> None:
expunge_link(file)
workshop = get_local_mod_path(steam_path)
+ if workshop.is_dir() is False:
+ return
# NOTE: create symlinks for missing mods
for mod_id in get_local_mod_ids(steam_path):
uid = str(mod_id)
From 663e57b8cd7d98c6a8e4c5307b069523a98f678e Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 06:41:05 +0900
Subject: [PATCH 17/27] chore: cherry pick changes from test-typehints branch
---
dzgui/config/xdg.py | 10 +++++-----
dzgui/init/prereqs.py | 4 ++--
dzgui/strings/wizard.py | 2 +-
tests/test_home_in_sandbox.py | 23 +++++++++++++++++++++++
4 files changed, 31 insertions(+), 8 deletions(-)
create mode 100644 tests/test_home_in_sandbox.py
diff --git a/dzgui/config/xdg.py b/dzgui/config/xdg.py
index eac3dcf4..1250dbbd 100644
--- a/dzgui/config/xdg.py
+++ b/dzgui/config/xdg.py
@@ -6,10 +6,9 @@ from dataclasses import dataclass
from dzgui.const.constants import (
APP_NAME_LOWER,
DEBUG_LOG,
- FLATPAK_ROOT_PATH,
SYSTEM_LOG,
)
-from dzgui.init.proc import is_sandboxed
+from dzgui.init.proc import is_flatpak_sandbox, is_snap_sandbox
@dataclass(slots=True, frozen=True)
@@ -53,6 +52,10 @@ def is_writeable(path_str: str) -> bool:
def get_xdg_paths() -> dict[str, Path]:
home = Path.home()
+ if resolved := os.environ.get("SNAP_REAL_HOME"): # Snap
+ home = Path(resolved)
+ elif resolved := os.environ.get("HOME"): # Flatpak
+ home = Path(resolved)
xdg_paths = {
"XDG_CONFIG_HOME": home / ".config",
"XDG_STATE_HOME": home / ".local" / "state",
@@ -62,9 +65,6 @@ def get_xdg_paths() -> dict[str, Path]:
resolved_paths = {}
for path in xdg_paths:
real_path = os.environ.get(path)
- if real_path is not None and is_sandboxed():
- search_string = FLATPAK_ROOT_PATH + "/"
- real_path = real_path.replace(search_string, "")
if real_path is not None and is_writeable(real_path):
new_path = Path(real_path)
else:
diff --git a/dzgui/init/prereqs.py b/dzgui/init/prereqs.py
index 9266bfbe..91278048 100644
--- a/dzgui/init/prereqs.py
+++ b/dzgui/init/prereqs.py
@@ -3,13 +3,13 @@ import shutil
import subprocess
from dzgui.const.constants import APP_NAME, FLATPAK_APPID, FLATPAK_CMD, STEAM_CMD
-from dzgui.init.proc import is_sandboxed
+from dzgui.init.proc import is_flatpak_sandbox
logger = logging.getLogger(APP_NAME)
def has_flatpak_client() -> bool:
- if is_sandboxed():
+ if is_flatpak_sandbox():
return True
try:
res = subprocess.run(
diff --git a/dzgui/strings/wizard.py b/dzgui/strings/wizard.py
index 8bf12f73..7537d654 100644
--- a/dzgui/strings/wizard.py
+++ b/dzgui/strings/wizard.py
@@ -3,7 +3,7 @@ title_intro = "Welcome"
blurb_intro = """
This wizard will help you set up some common config options before launching the application.
"""
-error_sandbox = "Setup cannot be run from inside Flatpak sandbox.\nPlease launch the application directly."
+error_sandbox = "Setup cannot be run from inside a sandboxed version of Steam (Snap/Flatpak).\nPlease launch the application directly first."
welcome = "Welcome to {0}!"
### SteamPathPage
diff --git a/tests/test_home_in_sandbox.py b/tests/test_home_in_sandbox.py
new file mode 100644
index 00000000..4404b62a
--- /dev/null
+++ b/tests/test_home_in_sandbox.py
@@ -0,0 +1,23 @@
+import pytest
+import tempfile
+
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+from dzgui.config.xdg import get_xdg_paths
+
+if TYPE_CHECKING:
+ from _pytest.monkeypatch import MonkeyPatch
+
+
+@pytest.mark.parametrize("env", ["SNAP_REAL_HOME", "HOME"])
+def test_sandbox_home_resolution(monkeypatch: "MonkeyPatch", env: str) -> None:
+ with tempfile.NamedTemporaryFile(delete=False) as f:
+ monkeypatch.setenv(env, f.name)
+ paths = get_xdg_paths()
+ assert paths["XDG_CONFIG_HOME"] == Path(f.name).joinpath(".config/dzgui")
+
+
+def test_home_fallback() -> None:
+ paths = get_xdg_paths()
+ assert paths["XDG_CONFIG_HOME"] == Path.home().joinpath(".config/dzgui")
From 8aca23cf766f107bc2dbd4902acd2cf2a9b45f9f Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 06:41:05 +0900
Subject: [PATCH 18/27] chore: cherry pick changes from test-typehints branch
---
dzgui/config/xdg.py | 9 ++++-----
dzgui/init/prereqs.py | 4 ++--
dzgui/init/proc.py | 33 +++++++++++++++++++++++++++------
dzgui/strings/wizard.py | 2 +-
tests/test_home_in_sandbox.py | 23 +++++++++++++++++++++++
5 files changed, 57 insertions(+), 14 deletions(-)
create mode 100644 tests/test_home_in_sandbox.py
diff --git a/dzgui/config/xdg.py b/dzgui/config/xdg.py
index eac3dcf4..c23f4529 100644
--- a/dzgui/config/xdg.py
+++ b/dzgui/config/xdg.py
@@ -6,10 +6,8 @@ from dataclasses import dataclass
from dzgui.const.constants import (
APP_NAME_LOWER,
DEBUG_LOG,
- FLATPAK_ROOT_PATH,
SYSTEM_LOG,
)
-from dzgui.init.proc import is_sandboxed
@dataclass(slots=True, frozen=True)
@@ -53,6 +51,10 @@ def is_writeable(path_str: str) -> bool:
def get_xdg_paths() -> dict[str, Path]:
home = Path.home()
+ if resolved := os.environ.get("SNAP_REAL_HOME"): # Snap
+ home = Path(resolved)
+ elif resolved := os.environ.get("HOME"): # Flatpak
+ home = Path(resolved)
xdg_paths = {
"XDG_CONFIG_HOME": home / ".config",
"XDG_STATE_HOME": home / ".local" / "state",
@@ -62,9 +64,6 @@ def get_xdg_paths() -> dict[str, Path]:
resolved_paths = {}
for path in xdg_paths:
real_path = os.environ.get(path)
- if real_path is not None and is_sandboxed():
- search_string = FLATPAK_ROOT_PATH + "/"
- real_path = real_path.replace(search_string, "")
if real_path is not None and is_writeable(real_path):
new_path = Path(real_path)
else:
diff --git a/dzgui/init/prereqs.py b/dzgui/init/prereqs.py
index 9266bfbe..91278048 100644
--- a/dzgui/init/prereqs.py
+++ b/dzgui/init/prereqs.py
@@ -3,13 +3,13 @@ import shutil
import subprocess
from dzgui.const.constants import APP_NAME, FLATPAK_APPID, FLATPAK_CMD, STEAM_CMD
-from dzgui.init.proc import is_sandboxed
+from dzgui.init.proc import is_flatpak_sandbox
logger = logging.getLogger(APP_NAME)
def has_flatpak_client() -> bool:
- if is_sandboxed():
+ if is_flatpak_sandbox():
return True
try:
res = subprocess.run(
diff --git a/dzgui/init/proc.py b/dzgui/init/proc.py
index 0c1a2a06..dbf3bf55 100644
--- a/dzgui/init/proc.py
+++ b/dzgui/init/proc.py
@@ -27,19 +27,40 @@ def is_steam_running(cmd: str) -> bool:
raise TypeError("Not a valid Steam client selection")
-def is_sandboxed() -> bool:
+def is_snap_sandbox() -> bool:
+ return bool(os.environ.get("SNAP"))
+
+
+def is_flatpak_sandbox() -> bool:
return bool(os.environ.get("FLATPAK_ID"))
+def is_sandboxed() -> bool:
+ if is_snap_sandbox() or is_flatpak_sandbox():
+ return True
+ return False
+
+
+def get_flatpak_output() -> list[str] | None:
+ try:
+ proc = subprocess.check_output(
+ [FLATPAK_CMD, "ps", "--columns=application"], text=True
+ )
+ lines = proc.splitlines()
+ return lines
+ except Exception as e:
+ logger.debug(e)
+ return None
+
+
def is_flatpak_steam_running() -> bool:
- if is_sandboxed():
+ if is_flatpak_sandbox():
return True
if has_cmd(FLATPAK_CMD) is False:
return False
- proc = subprocess.check_output(
- [FLATPAK_CMD, "ps", "--columns=application"], text=True
- )
- lines = proc.splitlines()
+ lines = get_flatpak_output()
+ if lines is None:
+ return False
if FLATPAK_APPID in lines:
return True
return False
diff --git a/dzgui/strings/wizard.py b/dzgui/strings/wizard.py
index 8bf12f73..7537d654 100644
--- a/dzgui/strings/wizard.py
+++ b/dzgui/strings/wizard.py
@@ -3,7 +3,7 @@ title_intro = "Welcome"
blurb_intro = """
This wizard will help you set up some common config options before launching the application.
"""
-error_sandbox = "Setup cannot be run from inside Flatpak sandbox.\nPlease launch the application directly."
+error_sandbox = "Setup cannot be run from inside a sandboxed version of Steam (Snap/Flatpak).\nPlease launch the application directly first."
welcome = "Welcome to {0}!"
### SteamPathPage
diff --git a/tests/test_home_in_sandbox.py b/tests/test_home_in_sandbox.py
new file mode 100644
index 00000000..4404b62a
--- /dev/null
+++ b/tests/test_home_in_sandbox.py
@@ -0,0 +1,23 @@
+import pytest
+import tempfile
+
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+from dzgui.config.xdg import get_xdg_paths
+
+if TYPE_CHECKING:
+ from _pytest.monkeypatch import MonkeyPatch
+
+
+@pytest.mark.parametrize("env", ["SNAP_REAL_HOME", "HOME"])
+def test_sandbox_home_resolution(monkeypatch: "MonkeyPatch", env: str) -> None:
+ with tempfile.NamedTemporaryFile(delete=False) as f:
+ monkeypatch.setenv(env, f.name)
+ paths = get_xdg_paths()
+ assert paths["XDG_CONFIG_HOME"] == Path(f.name).joinpath(".config/dzgui")
+
+
+def test_home_fallback() -> None:
+ paths = get_xdg_paths()
+ assert paths["XDG_CONFIG_HOME"] == Path.home().joinpath(".config/dzgui")
From 16578eaeb3a4f1440049651dfd4ac9e33cc840d3 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 07:01:07 +0900
Subject: [PATCH 19/27] chore: update changelog
---
CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d65c8c8c..0c694eb3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -58,6 +58,7 @@
- Validate mods via Mod page to pull in updates
- Support for Nasdara (Badlands) DLC
- Load offline mods
+- Support Snap package version of Steam
### Changed
- Conform to PEP 440 versioning for beta versions
@@ -101,6 +102,8 @@
- Steam Flatpak cannot run DZGUI as a non-Steam game
- Collisions between native Steam and Steam Flatpak clients
- Sticky toggle signal on radio buttons when reloading Options
+- Handle missing mods directory if not installed previously
+- Filters not blocked by keyboard keys when filters are disabled
### Developer-facing
- Options -> Dev page
From b42be20dc3a7cfc41958d30f5910fa58f431d457 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 07:50:29 +0900
Subject: [PATCH 20/27] change: parse real home in sandbox
---
dzgui/api/steam.py | 9 +++++----
dzgui/config/freedesktop.py | 4 +++-
dzgui/config/xdg.py | 8 ++++++--
dzgui/init/migrate.py | 11 +++++++----
dzgui/views/dialogs/wizard.py | 4 +++-
5 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py
index cf320ac0..1af28860 100644
--- a/dzgui/api/steam.py
+++ b/dzgui/api/steam.py
@@ -12,9 +12,7 @@ from typing import Any, Generator, Union
from warnings import deprecated
from dzgui.api.acf import ACF
-from dzgui.const.endpoints import VALIDATE
-from dzgui.init.prereqs import has_any_client
-from dzgui.init.prereqs import has_flatpak_client, has_steam_client
+from dzgui.config.xdg import get_real_home
from dzgui.const.constants import (
APPID_DAYZ,
APPID_DAYZ_EXP,
@@ -36,7 +34,10 @@ from dzgui.const.endpoints import (
STEAM_PUBLISHED_FILES,
STEAM_SUB,
STEAM_UNSUB,
+ VALIDATE,
)
+from dzgui.init.prereqs import has_any_client
+from dzgui.init.prereqs import has_flatpak_client, has_steam_client
from dzgui.strings import wizard
from dzgui.strings.errors import api_validation_error, workshop_endpoint_error
from dzgui.util.bash import concat_bash_args
@@ -65,7 +66,7 @@ class VDFLoadError(Exception):
def get_steam_paths() -> list[tuple[Path, str]]:
paths = []
if has_any_client():
- HOME = Path.home()
+ HOME = get_real_home()
env = os.environ.get("XDG_DATA_HOME")
if env is not None:
XDG_DATA_HOME = Path(env)
diff --git a/dzgui/config/freedesktop.py b/dzgui/config/freedesktop.py
index de38ee8e..4053fa01 100644
--- a/dzgui/config/freedesktop.py
+++ b/dzgui/config/freedesktop.py
@@ -3,6 +3,7 @@ import textwrap
from pathlib import Path
+from dzgui.config.xdg import get_real_home
from dzgui.util.dirs import copy_dzgui_to_xdg_data, find_icon_resource, make_parents
@@ -36,7 +37,8 @@ def write_desktop_file(exe_path: Path) -> Path:
def write_desktop_shortcut(desktop_file: Path) -> None:
# NOTE: necessarily depends on the above (UI blocks creation without XDG entry first)
- link = Path.home().joinpath("Desktop/dzgui.desktop")
+ home = get_real_home()
+ link = home.joinpath("Desktop/dzgui.desktop")
make_parents(link)
if link.exists():
link.unlink()
diff --git a/dzgui/config/xdg.py b/dzgui/config/xdg.py
index c23f4529..3a41659c 100644
--- a/dzgui/config/xdg.py
+++ b/dzgui/config/xdg.py
@@ -48,13 +48,17 @@ def is_writeable(path_str: str) -> bool:
file.unlink()
return True
-
-def get_xdg_paths() -> dict[str, Path]:
+def get_real_home() -> Path:
home = Path.home()
if resolved := os.environ.get("SNAP_REAL_HOME"): # Snap
home = Path(resolved)
elif resolved := os.environ.get("HOME"): # Flatpak
home = Path(resolved)
+ return home
+
+
+def get_xdg_paths() -> dict[str, Path]:
+ home = get_real_home()
xdg_paths = {
"XDG_CONFIG_HOME": home / ".config",
"XDG_STATE_HOME": home / ".local" / "state",
diff --git a/dzgui/init/migrate.py b/dzgui/init/migrate.py
index 0ff3ce22..3b2b8ce2 100644
--- a/dzgui/init/migrate.py
+++ b/dzgui/init/migrate.py
@@ -12,13 +12,15 @@ from dzgui.const.constants import (
LEGACY_IPS_PATH,
)
from dzgui.config.convert import rc2json
+from dzgui.config.xdg import get_real_home
from dzgui.util._json import read_json, write_json
logger = logging.getLogger(APP_NAME)
def migrate_legacy_conf(config: Path) -> Any:
- old_conf = Path.home() / LEGACY_CONFIG_PATH
+ home = get_real_home()
+ old_conf = home / LEGACY_CONFIG_PATH
j = rc2json(old_conf)
return json.loads(j)
@@ -44,7 +46,8 @@ def convert_cols_file(res: Path) -> Any | None:
def migrate_cols_file(res: Path) -> None:
# NOTE: filename "dzg.columns.json" is API 7 spec
- old_res = Path.home() / LEGACY_COLS_PATH
+ home = get_real_home()
+ old_res = home / LEGACY_COLS_PATH
if old_res.is_file():
j = convert_cols_file(old_res)
if j is not None:
@@ -52,7 +55,7 @@ def migrate_cols_file(res: Path) -> None:
def copy_state_files(state_path: Path) -> None:
- home = Path.home()
+ home = get_real_home()
legacy = home / ".local/state/dzgui"
to_copy = [
"dzg.res.json",
@@ -71,7 +74,7 @@ def copy_state_files(state_path: Path) -> None:
def copy_ipdb(ips_path: Path) -> None:
- home = Path.home()
+ home = get_real_home()
legacy = home / LEGACY_IPS_PATH
if ips_path == legacy:
return
diff --git a/dzgui/views/dialogs/wizard.py b/dzgui/views/dialogs/wizard.py
index 82d84f08..768ea147 100644
--- a/dzgui/views/dialogs/wizard.py
+++ b/dzgui/views/dialogs/wizard.py
@@ -16,6 +16,7 @@ from dzgui.const.constants import (
LEGACY_CONFIG_PATH,
TMP_PATH,
)
+from dzgui.config.xdg import get_real_home
from dzgui.const.boilerplate import config_boilerplate
from dzgui.const.endpoints import STEAM_API_SETUP
from dzgui.config import freedesktop
@@ -506,7 +507,8 @@ class Assistant(Gtk.Assistant):
self.pages: dict[EnumeratedWizardPage, int] = {}
- legacy_path = Path.home().joinpath(LEGACY_CONFIG_PATH)
+ home = get_real_home()
+ legacy_path = home.joinpath(LEGACY_CONFIG_PATH)
self.has_legacy_config = legacy_path.is_file()
for page in (
self.page_intro,
From da718c684d7e59274633ad6c73b5240935f26401 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 08:51:30 +0900
Subject: [PATCH 21/27] change: block shortcut creation on snap client
---
dzgui/strings/wizard.py | 6 ++----
dzgui/views/dialogs/wizard.py | 5 +++++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dzgui/strings/wizard.py b/dzgui/strings/wizard.py
index 7537d654..613b1d2a 100644
--- a/dzgui/strings/wizard.py
+++ b/dzgui/strings/wizard.py
@@ -20,9 +20,7 @@ desc_flatpak_path = (
desc_ubuntu_path = "This is the default Steam path on Ubuntu-based systems."
desc_snap_path = "This is the default Steam path on systems using Snap packages."
desc_debian_path = "This is the default Steam path on Debian-based systems."
-no_valid_paths = (
- "No valid Steam path or Steam command found on system. Please install Steam to continue."
-)
+no_valid_paths = "No valid Steam path or Steam command found on system. Please install Steam to continue."
button_scan = "Scan for Steam"
### ConfigMigrationPage
@@ -75,7 +73,7 @@ checkbox_steam_shortcut = (
"This creates a standalone copy of DZGUI and adds it to Steam. "
"You must restart Steam for the shortcut to appear. This will not replace or update existing shortcuts. "
"If you update DZGUI when it is launched via Steam, updates will be applied to the Steam version. "
- "Not available if you selected the Flatpak client as your Steam default."
+ "Not available if you selected the Snap client as your Steam default."
),
)
checkbox_start_menu = (
diff --git a/dzgui/views/dialogs/wizard.py b/dzgui/views/dialogs/wizard.py
index 768ea147..fab56121 100644
--- a/dzgui/views/dialogs/wizard.py
+++ b/dzgui/views/dialogs/wizard.py
@@ -14,6 +14,7 @@ from dzgui.const.constants import (
HERO_PATH,
FLATPAK_ROOT_PATH,
LEGACY_CONFIG_PATH,
+ SNAP_STEAM_PATH,
TMP_PATH,
)
from dzgui.config.xdg import get_real_home
@@ -701,6 +702,7 @@ class ShortcutCreationPage(OptionalPageMixin, EnumeratedWizardPage): # type: ig
self.add_start(self.checks_area)
self.show_all()
+
self.connect("map", self._on_map)
def _on_start_menu_toggled(self, button: Gtk.CheckButton) -> None:
@@ -711,6 +713,9 @@ class ShortcutCreationPage(OptionalPageMixin, EnumeratedWizardPage): # type: ig
def set_steam_path(self, path: Path) -> None:
self.steam_path = path
+ if SNAP_STEAM_PATH in self.steam_path:
+ self.steam_checkbox.set_active(False)
+ self.steam_checkbox.set_sensitive(False)
def is_steam_checkbox_active(self) -> bool:
return self.steam_checkbox.get_active()
From 2a6a8f0cb08c41d164cff2a769ed1e1804b0a847 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Thu, 19 Nov 2026 08:52:18 +0900
Subject: [PATCH 22/27] chore: clear typehinting errors
---
dzgui/views/dialogs/wizard.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dzgui/views/dialogs/wizard.py b/dzgui/views/dialogs/wizard.py
index fab56121..a06b614f 100644
--- a/dzgui/views/dialogs/wizard.py
+++ b/dzgui/views/dialogs/wizard.py
@@ -713,7 +713,7 @@ class ShortcutCreationPage(OptionalPageMixin, EnumeratedWizardPage): # type: ig
def set_steam_path(self, path: Path) -> None:
self.steam_path = path
- if SNAP_STEAM_PATH in self.steam_path:
+ if SNAP_STEAM_PATH in str(self.steam_path):
self.steam_checkbox.set_active(False)
self.steam_checkbox.set_sensitive(False)
From f3007865468e69008085212f18a1703df5d5a116 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Sat, 21 Nov 2026 17:59:14 +0900
Subject: [PATCH 23/27] feat: descend into path when making parents
---
dzgui/util/dirs.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dzgui/util/dirs.py b/dzgui/util/dirs.py
index 5707f211..e2720a85 100644
--- a/dzgui/util/dirs.py
+++ b/dzgui/util/dirs.py
@@ -10,8 +10,9 @@ from dzgui.const.constants import APP_NAME, APP_NAME_LOWER, IMAGES_PATH
logger = logging.getLogger(APP_NAME)
-def make_parents(path: "Path") -> None:
- path.parent.mkdir(parents=True, exist_ok=True)
+def make_parents(path: "Path", descend: bool = False) -> None:
+ p = path if descend else path.parent
+ p.mkdir(parents=True, exist_ok=True)
def copy_dzgui_to_xdg_data(exe_path: Path) -> None:
From 97c90b435b057b142ad5f27273fdae49f69bd2d7 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Sat, 21 Nov 2026 17:59:34 +0900
Subject: [PATCH 24/27] chore: log additional exceptions
---
dzgui/api/mods.py | 1 +
dzgui/api/steam.py | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dzgui/api/mods.py b/dzgui/api/mods.py
index 55bdd64a..8b73c98f 100644
--- a/dzgui/api/mods.py
+++ b/dzgui/api/mods.py
@@ -37,6 +37,7 @@ def get_local_mod_path(steam_path: Path) -> Path:
def get_local_mods(workshop_path: Path) -> list[Path]:
# NOTE: user may not have staged mods before
if workshop_path.is_dir() is False:
+ logger.debug("Mod directory not yet present, returning empty list")
return []
mods = [file for file in workshop_path.iterdir() if file.is_dir()]
return mods
diff --git a/dzgui/api/steam.py b/dzgui/api/steam.py
index 1af28860..22fefa42 100644
--- a/dzgui/api/steam.py
+++ b/dzgui/api/steam.py
@@ -497,11 +497,11 @@ def is_dayz_downloading(steam_path: Path, appid: int) -> bool:
def get_app_path(folders_path: Path, appid: int) -> Path:
app_path = None
-
try:
with open(folders_path / LIBRARYFOLDERS_PATH) as f:
folders = vdf.load(f)
- except Exception:
+ except Exception as e:
+ logger.debug(e)
raise VDFLoadError("Failed to parse libraryfolders")
for obj in folders["libraryfolders"]:
From a3068324fa61eef71ae162284b4ed2e7df6ab7ec Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Sat, 21 Nov 2026 18:00:20 +0900
Subject: [PATCH 25/27] chore: add test
---
.../fixtures/api/steamapps/libraryfolders.vdf | 12 ++++++++
tests/test_mod_directory.py | 30 +++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 tests/fixtures/api/steamapps/libraryfolders.vdf
create mode 100644 tests/test_mod_directory.py
diff --git a/tests/fixtures/api/steamapps/libraryfolders.vdf b/tests/fixtures/api/steamapps/libraryfolders.vdf
new file mode 100644
index 00000000..668ef502
--- /dev/null
+++ b/tests/fixtures/api/steamapps/libraryfolders.vdf
@@ -0,0 +1,12 @@
+"libraryfolders"
+{
+ "0"
+ {
+ "path" ""
+ "label" ""
+ "apps"
+ {
+ "221100" "11111"
+ }
+ }
+}
diff --git a/tests/test_mod_directory.py b/tests/test_mod_directory.py
new file mode 100644
index 00000000..bde040e9
--- /dev/null
+++ b/tests/test_mod_directory.py
@@ -0,0 +1,30 @@
+import pytest
+import vdf
+
+from pathlib import Path
+
+from dzgui.api.mods import get_local_mod_ids
+from dzgui.util.dirs import make_parents
+from tests.fixtures import fixture_path
+
+@pytest.fixture
+def libraryfolders() -> Path:
+ return fixture_path("api/steamapps/libraryfolders.vdf")
+
+def test_missing_mod_dir(tmp_path, libraryfolders: Path) -> None:
+ """
+ Updates fixture file key with tmp path value serializes to file,
+ then tests for missing mod directory returning an empty list
+ """
+ folders = tmp_path.joinpath("steamapps/libraryfolders.vdf")
+ workshop = tmp_path.joinpath("steamapps/workshop/content")
+ make_parents(folders)
+ make_parents(workshop, descend=True)
+
+ with open(libraryfolders, "r") as f:
+ data = vdf.load(f)
+ data["libraryfolders"]["0"]["path"] = tmp_path
+ with open(folders, "w") as f:
+ vdf.dump(data, f, pretty=True)
+ ids = get_local_mod_ids(tmp_path)
+ assert len(ids) == 0
From 3f74e71a107503e9aeb74bc80179eb00b108d016 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Sun, 22 Nov 2026 13:50:13 +0900
Subject: [PATCH 26/27] feat: export debug log to a named file
---
dzgui/const/enum.py | 6 ++++--
dzgui/controllers/mc.py | 33 ++++++++++++++++++++++---------
dzgui/init/prereqs.py | 2 +-
dzgui/strings/filepickers.py | 2 ++
dzgui/strings/rows.py | 5 ++++-
dzgui/views/dialogs/filepicker.py | 19 ++++++++++++++----
dzgui/views/trees/tree_menu.py | 23 +++++++++++----------
7 files changed, 61 insertions(+), 29 deletions(-)
create mode 100644 dzgui/strings/filepickers.py
diff --git a/dzgui/const/enum.py b/dzgui/const/enum.py
index d7c89110..dd1ac37d 100644
--- a/dzgui/const/enum.py
+++ b/dzgui/const/enum.py
@@ -207,7 +207,8 @@ class RowType(Enum):
CHANGELOG = RowMeta(rows.changelog_label, rows.changelog_status)
SHOW_LOG = RowMeta(rows.log_label, rows.log_status)
SEPARATOR = RowMeta(rows.separator_label, rows.separator_status)
- DUMP_LOG = RowMeta(rows.system_log_label, rows.system_log_status)
+ DUMP_DIAGNOSTIC = RowMeta(rows.system_log_label, rows.system_log_status)
+ DUMP_DEBUG = RowMeta(rows.debug_log_label, rows.debug_log_status)
DOCS = RowMeta(rows.docs_label, rows.docs_status)
DOCS_FALLBACK = RowMeta(rows.docs_fallback_label, rows.docs_fallback_status)
BUGS = RowMeta(rows.bugs_label, rows.bugs_status)
@@ -302,7 +303,8 @@ class ButtonType(Enum):
HELP_MENU_ROWS = (
RowType.CHANGELOG,
RowType.SHOW_LOG,
- RowType.DUMP_LOG,
+ RowType.DUMP_DIAGNOSTIC,
+ RowType.DUMP_DEBUG,
RowType.SEPARATOR,
RowType.DOCS,
RowType.DOCS_FALLBACK,
diff --git a/dzgui/controllers/mc.py b/dzgui/controllers/mc.py
index 169c72a2..b60e67dd 100644
--- a/dzgui/controllers/mc.py
+++ b/dzgui/controllers/mc.py
@@ -2,6 +2,7 @@ import gi
import logging
import threading
+from pathlib import Path
from typing import Any, TYPE_CHECKING, Union
from dzgui.config.userprefs import UserPrefs
@@ -23,7 +24,7 @@ from dzgui.model.servers import ServerModelManager
from dzgui.util.diag import write_diagnostic
from dzgui.util.format import format_exception, format_player_count
from dzgui.util.open_links import open_user_workshop, open_workshop_page
-from dzgui.views.dialogs.filepicker import FilePicker
+from dzgui.views.dialogs.filepicker import DebugLogPicker, DiagnosticLogPicker
from dzgui.views.dialogs.generic import ExceptionDialog
gi.require_version("Gtk", "3.0")
@@ -297,15 +298,29 @@ class Controller(GObject.GObject):
return self.get_active_treeview().get_filter_man()
def dump_diagnostics(self) -> None:
- picker = FilePicker(self.mediator.window)
+ picker = DiagnosticLogPicker(self.mediator.window)
file = picker.pick_file()
- if file is not None:
- try:
- write_diagnostic(self.prefs.paths.config, file)
- except Exception as e:
- dialog = ExceptionDialog(self, str(e))
- dialog.show_all()
- dialog.run() # type: ignore[no-untyped-call]
+ if file is None:
+ return
+ try:
+ write_diagnostic(self.prefs.paths.config, file)
+ except Exception as e:
+ dialog = ExceptionDialog(self, str(e))
+ dialog.show_all()
+ dialog.run() # type: ignore[no-untyped-call]
+
+ def dump_log(self) -> None:
+ picker = DebugLogPicker(self.mediator.window)
+ file = picker.pick_file()
+ if file is None:
+ return
+ try:
+ log = self.prefs.paths.debug.read_text()
+ Path(file).write_text(log)
+ except Exception as e:
+ dialog = ExceptionDialog(self, str(e))
+ dialog.show_all()
+ dialog.run() # type: ignore[no-untyped-call]
def update_steam_api_key(self, text: str) -> None:
self.config_man.update_steam_api_key(text)
diff --git a/dzgui/init/prereqs.py b/dzgui/init/prereqs.py
index 122ebb68..91278048 100644
--- a/dzgui/init/prereqs.py
+++ b/dzgui/init/prereqs.py
@@ -23,7 +23,7 @@ def has_flatpak_client() -> bool:
else:
return False
except Exception as e:
- logger.debug(e)
+ logger.critical(e)
return False
diff --git a/dzgui/strings/filepickers.py b/dzgui/strings/filepickers.py
new file mode 100644
index 00000000..dadfb6e1
--- /dev/null
+++ b/dzgui/strings/filepickers.py
@@ -0,0 +1,2 @@
+debug_picker_title = "Save the debug log to a file"
+diagnostic_picker_title = "Save system diagnostics to a file"
diff --git a/dzgui/strings/rows.py b/dzgui/strings/rows.py
index 636dd7f0..627dcc94 100644
--- a/dzgui/strings/rows.py
+++ b/dzgui/strings/rows.py
@@ -7,9 +7,12 @@ log_status = "Read the DZGUI log generated since startup"
separator_label = "SEPARATOR"
separator_status = ""
-system_log_label = "Output system info to log file"
+system_log_label = "Output system info to a file"
system_log_status = "Dump diagnostic data for troubleshooting"
+debug_log_label = "Output debug log to a file"
+debug_log_status = "Dump a summary of errors/events since DZGUI started"
+
docs_label = "Documentation/help files (GitHub) ⧉"
docs_status = "Open the DZGUI documentation in a browser"
diff --git a/dzgui/views/dialogs/filepicker.py b/dzgui/views/dialogs/filepicker.py
index 2c0e3ccf..a7c912c4 100644
--- a/dzgui/views/dialogs/filepicker.py
+++ b/dzgui/views/dialogs/filepicker.py
@@ -1,6 +1,7 @@
from pathlib import Path
-from dzgui.util.strings import picker
+from dzgui.const.constants import DEBUG_LOG, SYSTEM_LOG
+from dzgui.strings.filepickers import diagnostic_picker_title, debug_picker_title
import gi
@@ -9,9 +10,9 @@ from gi.repository import Gtk
class FilePicker(Gtk.FileChooserDialog):
- def __init__(self, parent: Gtk.Window) -> None:
+ def __init__(self, parent: Gtk.Window, title: str, placeholder: str) -> None:
super().__init__(
- title=picker.title,
+ title=title,
action=Gtk.FileChooserAction.SAVE,
transient_for=parent,
resizable=True,
@@ -20,7 +21,7 @@ class FilePicker(Gtk.FileChooserDialog):
self.add_buttons("_Save", Gtk.ResponseType.OK) # type: ignore[no-untyped-call]
self.set_default_response(Gtk.ResponseType.OK)
- self.set_current_name(picker.placeholder)
+ self.set_current_name(placeholder)
def pick_file(self) -> Path | None:
res = self.run() # type: ignore[no-untyped-call]
@@ -35,6 +36,16 @@ class FilePicker(Gtk.FileChooserDialog):
return None
+class DiagnosticLogPicker(FilePicker):
+ def __init__(self, parent: Gtk.Window) -> None:
+ super().__init__(parent, diagnostic_picker_title, SYSTEM_LOG)
+
+
+class DebugLogPicker(FilePicker):
+ def __init__(self, parent: Gtk.Window) -> None:
+ super().__init__(parent, debug_picker_title, DEBUG_LOG)
+
+
class FolderPicker(Gtk.FileChooserDialog):
def __init__(self, parent: Gtk.Window, title: str) -> None:
super().__init__(
diff --git a/dzgui/views/trees/tree_menu.py b/dzgui/views/trees/tree_menu.py
index c64b371f..6ed70692 100644
--- a/dzgui/views/trees/tree_menu.py
+++ b/dzgui/views/trees/tree_menu.py
@@ -56,19 +56,18 @@ class MenuTreeView(TreeView):
self.controller.populate_log()
case RowType.CHANGELOG:
self.controller.open_page(NotebookPage.CHANGELOG)
- case RowType.DUMP_LOG:
+ case RowType.DUMP_DIAGNOSTIC:
self.controller.dump_diagnostics()
- pass
-
- docs = [
- RowType.DOCS,
- RowType.DOCS_FALLBACK,
- RowType.BUGS,
- RowType.FORUM,
- RowType.SPONSOR,
- ]
- if row_type in docs:
- open_link_by_rowtype(row_type)
+ case RowType.DUMP_DEBUG:
+ self.controller.dump_log()
+ case (
+ RowType.DOCS
+ | RowType.DOCS_FALLBACK
+ | RowType.BUGS
+ | RowType.FORUM
+ | RowType.SPONSOR
+ ):
+ open_link_by_rowtype(row_type)
def get_row_enum(self) -> str:
# NOTE: col 1 contains a RowType enum
From cdfe59ce384e80f6fe7ca6616d74666c56481027 Mon Sep 17 00:00:00 2001
From: aclist <92275929+aclist@users.noreply.github.com>
Date: Sun, 22 Nov 2026 13:52:37 +0900
Subject: [PATCH 27/27] chore: revert change
---
dzgui/init/prereqs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dzgui/init/prereqs.py b/dzgui/init/prereqs.py
index 91278048..122ebb68 100644
--- a/dzgui/init/prereqs.py
+++ b/dzgui/init/prereqs.py
@@ -23,7 +23,7 @@ def has_flatpak_client() -> bool:
else:
return False
except Exception as e:
- logger.critical(e)
+ logger.debug(e)
return False