a2qlinux 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/CHANGELOG.md +26 -0
  2. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/PKG-INFO +1 -1
  3. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/_version.py +2 -2
  4. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/bin/questlog_ctl.exe +0 -0
  5. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/bin/wpcap.dll +0 -0
  6. a2qlinux-0.4.0/a2qlinux/kde_overlays.py +250 -0
  7. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/launcher.py +67 -5
  8. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/setup_desktop.py +19 -2
  9. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/docs/ARCHITECTURE.md +163 -5
  10. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/docs/INSTALL.md +3 -1
  11. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/docs/TROUBLESHOOTING.md +6 -0
  12. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/docs/USING.md +63 -3
  13. a2qlinux-0.4.0/tests/test_kde_overlays.py +193 -0
  14. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_launcher.py +89 -0
  15. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/.gitignore +0 -0
  16. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/LICENSE +0 -0
  17. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/README.md +0 -0
  18. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/__init__.py +0 -0
  19. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/config.py +0 -0
  20. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/desktop.py +0 -0
  21. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/pcap_bridge.py +0 -0
  22. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/steam.py +0 -0
  23. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/tray.py +0 -0
  24. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/a2qlinux/update.py +0 -0
  25. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/bridge/build.sh +0 -0
  26. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/bridge/questlog_ctl.c +0 -0
  27. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/bridge/tests/bridge_client_test.c +0 -0
  28. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/bridge/tests/zorder_guard_test.c +0 -0
  29. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/bridge/wpcap_bridge.c +0 -0
  30. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/docs/README.md +0 -0
  31. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/docs/RELEASE.md +0 -0
  32. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/docs/UPDATING.md +0 -0
  33. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/pyproject.toml +0 -0
  34. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/__init__.py +0 -0
  35. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_config.py +0 -0
  36. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_desktop.py +0 -0
  37. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_pcap_bridge.py +0 -0
  38. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_replay_stream.py +0 -0
  39. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_setup_desktop.py +0 -0
  40. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_steam.py +0 -0
  41. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tests/test_update.py +0 -0
  42. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tools/__init__.py +0 -0
  43. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tools/pcap2questlog.py +0 -0
  44. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tools/replay_stream.py +0 -0
  45. {a2qlinux-0.3.0 → a2qlinux-0.4.0}/tools/tcp_owner_probe.c +0 -0
@@ -3,6 +3,32 @@
3
3
  What changed for players, release by release. Technical details are in
4
4
  `docs/ARCHITECTURE.md`.
5
5
 
6
+ ## [0.4.0] — 2026-11-09
7
+
8
+ ### Added
9
+ - After updating on KDE Plasma 6, run `a2qlinux-setup` once more to make
10
+ two Questlog features work that stayed hidden behind the full-screen game
11
+ on Linux:
12
+ - the **Black Market Cards** overlay, which writes Questlog's notes onto
13
+ the cards of the in-game Black Market shop (your pet's level and souls,
14
+ what an item unlocks or completes, the deals worth taking, how rare an
15
+ item is);
16
+ - moving and resizing overlays with **Alt+E**, which until now showed only
17
+ a brief flash over the game.
18
+ The setup explains the change and asks (Enter means yes); these then show
19
+ while the game is in front and hide when another program is.
20
+ `a2qlinux-setup --no-kde-overlays` takes it back out.
21
+ **Tested and working on KDE Plasma 6.8.2 (Wayland).** Other Plasma 6
22
+ versions may behave differently; on other desktops nothing is changed and
23
+ these two features are not guaranteed to work. If they do not work,
24
+ nothing else is affected.
25
+
26
+ ### Fixed
27
+ - **Quit Questlog** in the tray while AION 2 was running froze the game,
28
+ which then had to be ended. The game now keeps running, and Questlog can
29
+ be started again from the menu during play; its meter and Tracker Map
30
+ show the game again after the next zone change.
31
+
6
32
  ## [0.3.0] — 2026-11-08
7
33
 
8
34
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: a2qlinux
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Questlog Desktop (AION 2 damage meter) on Linux under Proton, with live game traffic.
5
5
  Project-URL: homepage, https://github.com/raman78/A2Qlinux
6
6
  Project-URL: repository, https://github.com/raman78/A2Qlinux
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.3.0'
22
- __version_tuple__ = version_tuple = (0, 3, 0)
21
+ __version__ = version = '0.4.0'
22
+ __version_tuple__ = version_tuple = (0, 4, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -0,0 +1,250 @@
1
+ """KDE Plasma 6: show Questlog's full-screen overlay layer above AION 2 (docs/ARCHITECTURE.md §6.8).
2
+
3
+ Questlog draws some overlays - Black Market Cards on the game's own shop
4
+ cards, the overlay controls icon - in one transparent window that covers the
5
+ whole screen, and in its overlay editing mode (Alt+E) every overlay is drawn
6
+ there. Wine hands a window of that size to the window manager, and
7
+ KWin keeps the active full-screen game above it, so those overlays stay
8
+ hidden behind the game. Questlog's smaller overlay windows (meter, alerts)
9
+ are not affected: Wine keeps them out of the window manager's hands.
10
+
11
+ Two pieces, both installed by a2qlinux-setup with the user's consent and
12
+ removed by `a2qlinux-setup --no-kde-overlays`:
13
+
14
+ - a KWin window rule (group RULE in kwinrulesrc, appended to the rule list
15
+ `Order`) that puts that one window in KWin's overlay layer and never gives
16
+ it focus; it matches Wine's window class `steam_proton` and the window
17
+ title Questlog's page gives it (HUD_TITLE);
18
+ - a KWin script (SCRIPT, in ~/.local/share/kwin/scripts) that makes the
19
+ window transparent while AION 2 is not the active window, so the overlays
20
+ do not stay above other programs after Alt+Tab.
21
+
22
+ Anything that fails here leaves the overlays as they were; nothing else of
23
+ A2Qlinux depends on it.
24
+ """
25
+
26
+ import json
27
+ import os
28
+ from pathlib import Path
29
+ import shutil
30
+ import subprocess
31
+
32
+ APPID = 3393110
33
+ RULE = "a2qlinux-questlog-hud"
34
+ SCRIPT = "a2qlinux-questlog-hud"
35
+ HUD_TITLE = "questlog.gg - Wiki" # Questlog's default page title: "<domain> - Wiki, Builds, Guides, …"
36
+ TOOLS = ("kwriteconfig6", "kreadconfig6", "dbus-send")
37
+
38
+ RULE_KEYS = {
39
+ "Description": "A2Qlinux: Questlog's full-screen overlay layer above AION 2",
40
+ "wmclass": "steam_proton",
41
+ "wmclassmatch": "1", # exact
42
+ "wmclasscomplete": "false",
43
+ "title": HUD_TITLE,
44
+ "titlematch": "2", # substring
45
+ "layer": "overlay",
46
+ "layerrule": "2", # force
47
+ "acceptfocus": "false",
48
+ "acceptfocusrule": "2", # force
49
+ }
50
+
51
+ SCRIPT_JS = """\
52
+ // A2Qlinux: the window rule "%(rule)s" keeps Questlog's full-screen overlay
53
+ // layer above AION 2. This shows the layer only while AION 2 (or the layer
54
+ // itself) is the active window, as on Windows, so its overlays do not stay
55
+ // above other programs after Alt+Tab.
56
+ const GAME = "steam_app_%(appid)d";
57
+ function isLayer(w) {
58
+ return !!w && w.resourceClass == "steam_proton" && w.caption.indexOf(%(title)s) >= 0;
59
+ }
60
+ function apply() {
61
+ const active = workspace.activeWindow;
62
+ const show = !!active && (active.resourceClass == GAME || isLayer(active));
63
+ for (const w of workspace.windowList()) {
64
+ if (isLayer(w)) {
65
+ const opacity = show ? 1.0 : 0.0;
66
+ if (w.opacity != opacity)
67
+ w.opacity = opacity;
68
+ }
69
+ }
70
+ }
71
+ workspace.windowActivated.connect(apply);
72
+ workspace.windowAdded.connect(function (w) {
73
+ w.captionChanged.connect(apply);
74
+ apply();
75
+ });
76
+ apply();
77
+ """ % {"rule": RULE, "appid": APPID, "title": json.dumps(HUD_TITLE)}
78
+
79
+ METADATA = {
80
+ "KPlugin": {
81
+ "Id": SCRIPT,
82
+ "Name": "A2Qlinux: Questlog overlays above AION 2",
83
+ "Description": "Shows Questlog's full-screen overlay layer only while AION 2 is the active window.",
84
+ "Authors": [{"Name": "A2Qlinux"}],
85
+ "License": "MIT",
86
+ "Version": "1",
87
+ },
88
+ "X-Plasma-API": "javascript",
89
+ "X-Plasma-MainScript": "code/main.js",
90
+ "KPackageStructure": "KWin/Script",
91
+ }
92
+
93
+ EXPLANATION = """\
94
+ KDE Plasma: Questlog draws some of its overlays - Black Market Cards on the
95
+ shop's cards, the overlay controls icon, and every overlay while you move
96
+ them with Alt+E - in one window that covers the whole screen, and KDE keeps
97
+ the full-screen game above that window, so you do not see them. A2Qlinux can
98
+ add a KDE window rule and a small KDE script for that one window: it is then
99
+ shown above AION 2 while the game is active, and hidden when you switch to
100
+ another program. Nothing else in KDE changes; `a2qlinux-setup
101
+ --no-kde-overlays` removes both. Tested on KDE Plasma 6.8.2; on other
102
+ versions it may not work, and then the overlays stay as before."""
103
+
104
+
105
+ def script_dir():
106
+ data = os.environ.get("XDG_DATA_HOME") or str(Path.home() / ".local" / "share")
107
+ return Path(data) / "kwin" / "scripts" / SCRIPT
108
+
109
+
110
+ def plasma6(env=os.environ):
111
+ """True on a KDE Plasma 6 (or later) session."""
112
+ desktops = env.get("XDG_CURRENT_DESKTOP", "").upper().split(":")
113
+ version = env.get("KDE_SESSION_VERSION", "")
114
+ return "KDE" in desktops and version.isdigit() and int(version) >= 6
115
+
116
+
117
+ def missing_tools():
118
+ return [tool for tool in TOOLS if not shutil.which(tool)]
119
+
120
+
121
+ def _run(command):
122
+ done = subprocess.run(command, stdin=subprocess.DEVNULL, capture_output=True, text=True, check=False)
123
+ if done.returncode:
124
+ raise RuntimeError(f"{' '.join(command[:1])} failed: {(done.stderr or done.stdout).strip()}")
125
+ return done.stdout.strip()
126
+
127
+
128
+ def _read(file, group, key):
129
+ return _run(["kreadconfig6", "--file", file, "--group", group, "--key", key])
130
+
131
+
132
+ def _write(file, group, key, value):
133
+ _run(["kwriteconfig6", "--file", file, "--group", group, "--key", key, value])
134
+
135
+
136
+ def _delete(file, group, key):
137
+ _run(["kwriteconfig6", "--file", file, "--group", group, "--key", key, "--delete"])
138
+
139
+
140
+ def _rule_list():
141
+ """KWin's rule list. Plasma 6.8 reads `Order`; a file that only has the
142
+ older `rules` list keeps those rules when `Order` is first written."""
143
+ order = _read("kwinrulesrc", "General", "Order")
144
+ if not order:
145
+ order = _read("kwinrulesrc", "General", "rules")
146
+ return [name for name in order.split(",") if name]
147
+
148
+
149
+ def _reconfigure():
150
+ _run(["dbus-send", "--session", "--type=method_call", "--dest=org.kde.KWin", "/KWin",
151
+ "org.kde.KWin.reconfigure"])
152
+
153
+
154
+ def installed():
155
+ return RULE in _rule_list() or script_dir().exists()
156
+
157
+
158
+ def install(log=print):
159
+ """Write (or refresh) the rule and the script, enable the script, reload KWin."""
160
+ for key, value in RULE_KEYS.items():
161
+ _write("kwinrulesrc", RULE, key, value)
162
+ rules = _rule_list()
163
+ if RULE not in rules:
164
+ _write("kwinrulesrc", "General", "Order", ",".join(rules + [RULE]))
165
+ code = script_dir() / "contents" / "code"
166
+ code.mkdir(parents=True, exist_ok=True)
167
+ (script_dir() / "metadata.json").write_text(json.dumps(METADATA, indent=4) + "\n")
168
+ (code / "main.js").write_text(SCRIPT_JS)
169
+ _write("kwinrc", "Plugins", f"{SCRIPT}Enabled", "true")
170
+ _reconfigure()
171
+ log(f"KDE: window rule '{RULE}' in ~/.config/kwinrulesrc and script {script_dir()} are in place.")
172
+
173
+
174
+ RESTORE_JS = """\
175
+ for (const w of workspace.windowList())
176
+ if (w.resourceClass == "steam_proton" && w.caption.indexOf(%s) >= 0)
177
+ w.opacity = 1.0;
178
+ """ % json.dumps(HUD_TITLE)
179
+
180
+
181
+ def _restore_opacity():
182
+ """Undo the script's transparency on a running Questlog, through a one-off script."""
183
+ path = Path(os.environ.get("XDG_RUNTIME_DIR") or "/tmp") / f"{SCRIPT}-restore.js"
184
+ path.write_text(RESTORE_JS)
185
+ try:
186
+ reply = _run(["dbus-send", "--session", "--print-reply", "--type=method_call", "--dest=org.kde.KWin",
187
+ "/Scripting", "org.kde.kwin.Scripting.loadScript", f"string:{path}",
188
+ f"string:{SCRIPT}-restore"])
189
+ number = reply.split()[-1]
190
+ if number.lstrip("-").isdigit() and int(number) >= 0:
191
+ _run(["dbus-send", "--session", "--print-reply", "--type=method_call", "--dest=org.kde.KWin",
192
+ f"/Scripting/Script{number}", "org.kde.kwin.Script.run"])
193
+ _run(["dbus-send", "--session", "--print-reply", "--type=method_call", "--dest=org.kde.KWin",
194
+ "/Scripting", "org.kde.kwin.Scripting.unloadScript", f"string:{SCRIPT}-restore"])
195
+ finally:
196
+ path.unlink(missing_ok=True)
197
+
198
+
199
+ def remove(log=print):
200
+ """Take out exactly what install wrote, then reload KWin."""
201
+ for key in RULE_KEYS:
202
+ _delete("kwinrulesrc", RULE, key)
203
+ rules = _rule_list()
204
+ if RULE in rules:
205
+ _write("kwinrulesrc", "General", "Order", ",".join(name for name in rules if name != RULE))
206
+ _delete("kwinrc", "Plugins", f"{SCRIPT}Enabled")
207
+ _reconfigure()
208
+ # A reload alone left the script running once its files were gone; unload it by name.
209
+ _run(["dbus-send", "--session", "--print-reply", "--type=method_call", "--dest=org.kde.KWin",
210
+ "/Scripting", "org.kde.kwin.Scripting.unloadScript", f"string:{SCRIPT}"])
211
+ shutil.rmtree(script_dir(), ignore_errors=True)
212
+ _restore_opacity()
213
+ log(f"KDE: removed the window rule '{RULE}' and the script {SCRIPT}.")
214
+
215
+
216
+ def setup_step(want, ask, interactive, log=print, env=os.environ):
217
+ """a2qlinux-setup's step. want: True (--kde-overlays), False (--no-kde-overlays) or None.
218
+
219
+ Returns a problem to list, or None.
220
+ """
221
+ try:
222
+ if want is False:
223
+ if installed():
224
+ remove(log)
225
+ else:
226
+ log("KDE overlays: nothing to remove.")
227
+ return None
228
+ if not plasma6(env):
229
+ return "--kde-overlays works on KDE Plasma 6 only" if want else None
230
+ missing = missing_tools()
231
+ if missing:
232
+ return (f"KDE overlays need {', '.join(missing)}, which are part of KDE Plasma and dbus; "
233
+ "without them Questlog's full-screen overlays stay behind the game")
234
+ if installed():
235
+ install(log) # refresh to this version's rule and script
236
+ return None
237
+ if not want:
238
+ if not interactive:
239
+ log("KDE overlays are not set up; to show Black Market Cards above the game, run "
240
+ "a2qlinux-setup --kde-overlays")
241
+ return None
242
+ log("\n" + EXPLANATION)
243
+ answer = ask("Set this up now? [Y/n] ").strip().lower()
244
+ if answer not in ("", "y", "yes", "t", "tak"):
245
+ log("Not set up; run a2qlinux-setup --kde-overlays to do it later.")
246
+ return None
247
+ install(log)
248
+ return None
249
+ except (OSError, RuntimeError) as error:
250
+ return f"KDE overlays: {error}; Questlog's full-screen overlays stay behind the game"
@@ -29,6 +29,7 @@ import os
29
29
  from pathlib import Path
30
30
  import re
31
31
  import shutil
32
+ import shlex
32
33
  import signal
33
34
  import socket
34
35
  import stat
@@ -966,7 +967,50 @@ def close_questlog(prefix, protontricks, log_path):
966
967
  ender.wait(timeout=5)
967
968
 
968
969
 
969
- def launch_questlog(executable, server, protontricks, log_path, hidden=False):
970
+ class QuestlogLaunch:
971
+ """Questlog started so that its launch outlives it while the Wine session is in use (§5.1).
972
+
973
+ protontricks ends the Steam Runtime container of a call once the call's
974
+ command returns, and everything started in it with it. Questlog's launch
975
+ usually brings up the prefix's Wine session - wineserver, services,
976
+ explorer.exe - inside that container, and the game joins it; a call that
977
+ ended with Questlog took the game's session along and froze the game. So
978
+ the call runs `wine Questlog.exe …; echo $? > exit_file; wineserver -w`:
979
+ the shell records Questlog's own exit code, then waits until the session
980
+ has ended. poll(), wait() and returncode follow Questlog itself - the
981
+ exit file - or the call, if that ends first (protontricks failed).
982
+ """
983
+
984
+ def __init__(self, process, exit_file):
985
+ self.process = process
986
+ self.exit_file = Path(exit_file)
987
+ self.returncode = None
988
+
989
+ def poll(self):
990
+ if self.returncode is None:
991
+ text = _read(self.exit_file).strip()
992
+ if text:
993
+ self.returncode = int(text) if text.lstrip("-").isdigit() else -1
994
+ elif self.process.poll() is not None:
995
+ self.returncode = self.process.returncode
996
+ return self.returncode
997
+
998
+ def wait(self, timeout=None):
999
+ deadline = None if timeout is None else time.monotonic() + timeout
1000
+ while self.poll() is None:
1001
+ if deadline is not None and time.monotonic() >= deadline:
1002
+ raise subprocess.TimeoutExpired("Questlog", timeout)
1003
+ time.sleep(0.2)
1004
+ return self.returncode
1005
+
1006
+
1007
+ def launch_questlog(executable, server, protontricks, log_path, hidden=False, hold_session=True):
1008
+ """Start Questlog in the game prefix; a QuestlogLaunch (hold_session) or the bare launch.
1009
+
1010
+ hold_session=False is for a second start that only hands a request over
1011
+ to the running Questlog and ends at once (show_questlog_window): it must
1012
+ not wait for the session.
1013
+ """
970
1014
  env = os.environ.copy()
971
1015
  env["QUESTLOG_PROTON_BRIDGE"] = server.environment_value()
972
1016
  # Wine ships a builtin wpcap.dll and loads it instead of ours even when
@@ -980,9 +1024,27 @@ def launch_questlog(executable, server, protontricks, log_path, hidden=False):
980
1024
  # the Windows security boundaries that sandbox relies on in any case.
981
1025
  # --hidden is Questlog's own switch: start with its window hidden, tray only.
982
1026
  extra = ["--hidden"] if hidden else []
983
- return subprocess.Popen([protontricks, "--appid", str(APPID), str(executable), "--no-sandbox", *extra],
984
- cwd=str(executable.parent), env=env, start_new_session=True,
985
- stdin=subprocess.DEVNULL, stdout=log_path.open("ab"), stderr=subprocess.STDOUT)
1027
+ output = dict(cwd=str(executable.parent), env=env, start_new_session=True,
1028
+ stdin=subprocess.DEVNULL, stdout=log_path.open("ab"), stderr=subprocess.STDOUT)
1029
+ if not hold_session:
1030
+ return subprocess.Popen([protontricks, "--appid", str(APPID), str(executable), "--no-sandbox", *extra],
1031
+ **output)
1032
+ exit_file = log_path.with_name("questlog.exit")
1033
+ exit_file.unlink(missing_ok=True)
1034
+ command = " ".join(["wine", shlex.quote(str(executable)), "--no-sandbox", *extra]) \
1035
+ + f"; echo $? > {shlex.quote(str(exit_file))}; wineserver -w"
1036
+ beside = Path(protontricks).with_name("protontricks")
1037
+ tool = str(beside) if beside.is_file() else (shutil.which("protontricks") or "protontricks")
1038
+ # No background wineserver: its keepalive program stays in the session until
1039
+ # the call ends, and `wineserver -w` would wait for it for ever.
1040
+ call = [tool, "--no-background-wineserver", "-c", command, str(APPID)]
1041
+ # A scope of its own: whatever ends the launcher - a quit, or the
1042
+ # systemd-run service the Steam launch option starts it in - must not take
1043
+ # the session along. The call stays this process's child either way.
1044
+ if shutil.which("systemd-run"):
1045
+ call = ["systemd-run", "--user", "--scope", "--quiet", "--collect",
1046
+ f"--unit=questlog-{os.getpid()}-{time.monotonic_ns()}", *call]
1047
+ return QuestlogLaunch(subprocess.Popen(call, **output), exit_file)
986
1048
 
987
1049
 
988
1050
  def main():
@@ -1069,7 +1131,7 @@ def main():
1069
1131
  return started
1070
1132
 
1071
1133
  def start_again():
1072
- return launch_questlog(executable, server, protontricks, log_path)
1134
+ return launch_questlog(executable, server, protontricks, log_path, hold_session=False)
1073
1135
 
1074
1136
  questlog = start_questlog()
1075
1137
  if auto_update:
@@ -1,6 +1,6 @@
1
1
  """a2qlinux-setup: the menu entry for Questlog (AION 2), and a check of what A2Qlinux needs.
2
2
 
3
- a2qlinux-setup [--questlog-dir DIR] [--desktop-shortcut]
3
+ a2qlinux-setup [--questlog-dir DIR] [--desktop-shortcut] [--kde-overlays | --no-kde-overlays]
4
4
 
5
5
  What it does, in order:
6
6
  1. Checks the programs A2Qlinux uses. For the missing ones it prints the
@@ -18,7 +18,12 @@ What it does, in order:
18
18
  its app.asar) - the icon is Questlog's and is not shipped here.
19
19
  7. Writes the menu entry "Questlog (AION 2)" (and, with --desktop-shortcut,
20
20
  the same on the desktop), running the `a2qlinux` command.
21
- 8. Prints the Steam launch option to set by hand.
21
+ 8. On KDE Plasma 6, offers the KDE overlays (a2qlinux.kde_overlays): a
22
+ window rule and a script that show Questlog's full-screen overlay layer
23
+ (Black Market Cards) above the game. It explains them and asks, with
24
+ yes as the default; --kde-overlays sets them up without asking,
25
+ --no-kde-overlays removes them. Once set up, a later run refreshes them.
26
+ 9. Prints the Steam launch option to set by hand.
22
27
 
23
28
  Run it again after fixing what it lists, and after moving Questlog's folder.
24
29
  """
@@ -32,6 +37,7 @@ import subprocess
32
37
  import sys
33
38
 
34
39
  from . import config
40
+ from . import kde_overlays
35
41
  from .desktop import TERMINALS, terminal_command
36
42
  from .update import install_fresh, read_asar_file
37
43
 
@@ -320,6 +326,12 @@ def main():
320
326
  "written into the settings file. Without Questlog.exe in it, the newest Questlog "
321
327
  "is installed there")
322
328
  parser.add_argument("--desktop-shortcut", action="store_true", help="also put the entry on the desktop")
329
+ kde = parser.add_mutually_exclusive_group()
330
+ kde.add_argument("--kde-overlays", dest="kde_overlays", action="store_const", const=True, default=None,
331
+ help="KDE Plasma 6: show Questlog's full-screen overlays (Black Market Cards) above the "
332
+ "game, without asking")
333
+ kde.add_argument("--no-kde-overlays", dest="kde_overlays", action="store_const", const=False,
334
+ help="remove what --kde-overlays set up")
323
335
  args = parser.parse_args()
324
336
  created = not config.CONFIG_PATH.exists()
325
337
  if args.questlog_dir:
@@ -393,6 +405,11 @@ def main():
393
405
  shortcut.chmod(0o755)
394
406
  print(f"Desktop shortcut: {shortcut}")
395
407
 
408
+ # A note, not a problem: everything else works without the KDE overlays.
409
+ kde_problem = kde_overlays.setup_step(args.kde_overlays, input, sys.stdin.isatty())
410
+ if kde_problem:
411
+ print(f"Note: {kde_problem}.", file=sys.stderr)
412
+
396
413
  print("\nSteam > AION 2 > Properties > General > Launch Options (optional, starts Questlog with the game):")
397
414
  print(f" {command('a2qlinux-steam')} %command%")
398
415
 
@@ -46,7 +46,7 @@ Terms used below:
46
46
  | | +- BridgeServer 127.0.0.1:port +---->| Questlog.exe --no-sandbox |
47
47
  | | (pcap_bridge, token) | TCP | +- wpcap.dll (ours, in |
48
48
  | +- Tray -> a2qlinux.tray (desktop) | | | System32\Npcap) |
49
- | +- protontricks-launch ------------+---->| | pcap_next_ex every 25 ms |
49
+ | +- protontricks -c (own scope) ----+---->| | pcap_next_ex every 25 ms |
50
50
  | +- protontricks-launch ------------+---->| +- window-order guard thread |
51
51
  | questlog_ctl.exe <command> | | questlog_ctl.exe (short-lived)|
52
52
  +-------------------------------------+ +-------------------------------+
@@ -119,8 +119,11 @@ All of A2Qlinux is one Python package, `a2qlinux`, installed with pipx
119
119
  (`BRIDGE_SIGNATURE`, kept from the project's first name: a new string
120
120
  would make an installed build look foreign). Any other file there, such as a real Npcap, is left
121
121
  alone and reported.
122
- 4. It starts Questlog in the prefix through `protontricks-launch`
123
- (`launch_questlog`), with:
122
+ 4. It starts Questlog in the prefix through protontricks
123
+ (`launch_questlog`): `protontricks -c 'wine Questlog.exe …; echo $? >
124
+ questlog.exit; wineserver -w'` in a systemd scope of its own, so that the
125
+ launch outlives Questlog for as long as the Wine session is in use (§5.1,
126
+ "The launch holds the session"). It passes:
124
127
  - `QUESTLOG_PROTON_BRIDGE=127.0.0.1:<port>:<token>`, read by the DLL;
125
128
  - `WINEDLLOVERRIDES=wpcap=n`, because Wine ships a builtin `wpcap` and
126
129
  loads it instead of a native file of that name, even when Questlog
@@ -374,6 +377,56 @@ the time Questlog's Wine session takes to come up. Waiting for it also keeps
374
377
  the two from bringing up the prefix's Wine at the same moment, which could
375
378
  make two separate sessions.
376
379
 
380
+ #### The launch holds the session
381
+
382
+ protontricks ends the Steam Runtime container of every call once the
383
+ call's command returns (`launcher_process.terminate()` in the `finally` of
384
+ its `run_command`), and everything started in that container goes with it.
385
+ Questlog's launch usually brings up the session: the `wineserver`, the
386
+ session's services (`services.exe`, `winedevice.exe`, `plugplay.exe`, …) and
387
+ the desktop process `explorer.exe /desktop` are all started from it and live
388
+ in its container. While Questlog was started as `protontricks-launch
389
+ Questlog.exe`, its call ended with Questlog, and a quit, crash or restart of
390
+ Questlog during play took the game's session along: the game froze
391
+ (10 November 2026, from **Quit Questlog** in the tray). A stand-in program
392
+ in place of the game showed the same, and the order of exits put the
393
+ container first: Questlog's call, its container, the `wineserver` and the
394
+ services all within the same 0.1 s. Killing only the `protontricks-launch`
395
+ process, so that its `finally` never ran, left the session running.
396
+
397
+ So `launch_questlog` runs Questlog as `protontricks
398
+ --no-background-wineserver -c 'wine Questlog.exe --no-sandbox; echo $? >
399
+ proton-stream/questlog.exit; wineserver -w' 3393110`:
400
+
401
+ - the shell writes Questlog's own exit code to `questlog.exit`, then
402
+ `wineserver -w` waits until the session has ended, so the call, and the
403
+ container holding the session, last as long as anything runs in it;
404
+ - `QuestlogLaunch` wraps the call for the launcher: `poll()`, `wait()` and
405
+ `returncode` follow Questlog itself through that file, or the call if it
406
+ ends first (protontricks failed), so the launcher's handling of Questlog
407
+ ending (quit, restart after the game, update trial) is unchanged;
408
+ - `--no-background-wineserver`, because protontricks' background wineserver
409
+ keeps a Windows program (`wineserver-keepalive.bat`) in the session until
410
+ the call ends, and `wineserver -w` would wait for it for ever;
411
+ - the call runs under `systemd-run --user --scope` (`questlog-<pid>-<n>`):
412
+ it stays the launcher's child, but in a cgroup of its own. The service
413
+ `a2qlinux-steam` starts the launcher in kills what is left in its cgroup
414
+ when the launcher exits, which would take the session along just the same.
415
+
416
+ A Questlog started again during play joins the running session. The calls
417
+ of earlier Questlog starts wait in their scopes until the session ends,
418
+ then end together with it. `show_questlog_window`'s second start, which
419
+ only hands a request to the running Questlog, keeps `protontricks-launch`
420
+ (`hold_session=False`): it must end at once.
421
+
422
+ Checked with a stand-in program for the game (10 November 2026): after
423
+ **Quit Questlog** the session, its services and the stand-in ran on;
424
+ Questlog started again from the menu joined the same `wineserver`; once the
425
+ stand-in ended, every waiting call ended within a second and nothing was
426
+ left. Checked with the game the same day: **Quit Questlog** during play, the
427
+ game ran on; Questlog started again from the menu read the game again (after
428
+ a zone change, see §7); after the game Steam was released as before (§6.7).
429
+
377
430
  Checked with the game (17 October 2026): Questlog opened without the game,
378
431
  then Play. The game started at once, with one `wineserver` shared by both.
379
432
  Checked with the game from Play alone (20 October 2026): Questlog came up in
@@ -593,6 +646,13 @@ Steam after the game would leave Steam showing AION 2 as running. While the
593
646
  game runs, or with no `steam.exe` of the game left, it does nothing and does
594
647
  not wait.
595
648
 
649
+ A quit during play ends Questlog only. The game's Wine session stays,
650
+ because Questlog's launch waits for the session to end before its
651
+ container goes (§5.1, "The launch holds the session"); the game runs on, and
652
+ Questlog started again from the menu joins it. Questlog then shows the game
653
+ in full only after a zone change, which is when it learns the character
654
+ (§7).
655
+
596
656
  Electron's auto-update would install on quit (`autoInstallOnAppQuit`); it is
597
657
  switched off (§6.6), and the session end would skip it anyway.
598
658
 
@@ -804,6 +864,92 @@ down during a restart, the game may join a session that is closing. Not
804
864
  observed; the window is a few seconds, and only after a game that started
805
865
  the session itself.
806
866
 
867
+ ### 6.8 Questlog's full-screen overlay layer on KDE Plasma
868
+
869
+ **Symptom.** On KDE Plasma, with the game full screen, the **Black Market
870
+ Cards** overlay (Questlog's notes drawn on the shop's own cards) and the
871
+ overlay controls icon never show, while the meter, alerts and the Black
872
+ Market panel do; and Questlog's overlay editing mode (Alt+E) shows only a
873
+ brief flash, with nothing to move.
874
+
875
+ **Cause.** Questlog keeps one transparent window over the game, the HUD
876
+ (class `steam_proton`, title `questlog.gg - Wiki, Builds, Guides, Database and
877
+ Tools for Aion 2`, Questlog's default page title, ex-style `WS_EX_TOPMOST |
878
+ WS_EX_NOACTIVATE | WS_EX_LAYERED | WS_EX_TRANSPARENT`). Each overlay widget
879
+ gets a small window of its own, owned by the HUD, but the cards and the
880
+ controls icon are drawn in the HUD itself, which covers the whole screen,
881
+ and so is every widget while the editing mode is on (Questlog's renderer
882
+ opens a widget's own window only outside editing).
883
+ In Wine's own window order the HUD is above the game. winex11 hands a popup
884
+ window that covers the whole screen to the window manager (a *managed* X
885
+ window); small owned popups stay *unmanaged* (override-redirect) and so
886
+ above everything. KWin puts the active full-screen game in its active
887
+ layer, above any managed window that is not active, so the game hides the
888
+ HUD. Measured with a test program in a throwaway prefix under `xvfb-run`
889
+ with Proton's Wine (9-10 November 2026): a full-screen popup became
890
+ managed, one a pixel shorter stayed unmanaged, and a window that had once
891
+ been managed stayed managed after shrinking, and after hiding, shrinking
892
+ and showing again. Nothing outside Questlog's browser process, which
893
+ creates the HUD, can change that.
894
+
895
+ **Remedy, KDE Plasma 6 only** (`a2qlinux/kde_overlays.py`), set up by
896
+ `a2qlinux-setup` with the user's consent:
897
+
898
+ - a KWin window rule `a2qlinux-questlog-hud` in `~/.config/kwinrulesrc`,
899
+ appended to the rule list `Order` (KWin 6.8 reads that list; a rule in
900
+ `rules` alone was not applied, checked through the window's `layer` as a
901
+ KWin script reads it). It matches class `steam_proton` exactly and the
902
+ title by the substring `questlog.gg - Wiki`, forces the layer `overlay`
903
+ and never gives the window focus. Questlog's main window is titled
904
+ `Questlog` and is not matched.
905
+ - a KWin script `a2qlinux-questlog-hud` in `~/.local/share/kwin/scripts`,
906
+ enabled in `kwinrc` (`[Plugins]`). The rule alone left the cards above
907
+ other programs after Alt+Tab with the shop open, since Questlog relies on
908
+ the HUD being ordered just above the game. The script sets the HUD's
909
+ opacity (compositor-side; Wine and Questlog do not see it) to 1 while the
910
+ active window is AION 2 (`steam_app_3393110`) or the HUD, else to 0. A
911
+ script cannot set the layer itself: KWin's `Window.layer` is read-only.
912
+
913
+ Both act on the HUD alone, matched by class and title, which keeps I2: the
914
+ game, Questlog's other windows and other programs' windows are neither
915
+ matched by the rule nor changed by the script, which only reads which
916
+ window is active. The rule list is appended to, never rewritten, so other
917
+ programs' rules (A2Tools adds three) stay as they were.
918
+
919
+ `a2qlinux-setup` on Plasma 6 (`XDG_CURRENT_DESKTOP` contains `KDE`,
920
+ `KDE_SESSION_VERSION` at least 6) explains this and asks, with yes as the
921
+ default; without a terminal it only names `--kde-overlays`. Once set up, a
922
+ later run refreshes both pieces without asking. `--kde-overlays` sets up
923
+ without asking, `--no-kde-overlays` removes: the rule's keys and its name in
924
+ `Order`, the `kwinrc` entry, the script (unloaded by name over D-Bus: a
925
+ reload alone left it running once its files were gone) and its folder, and
926
+ a one-off script sets the HUD's opacity back to 1. KWin is reloaded over
927
+ D-Bus (`org.kde.KWin.reconfigure`) each time. Checked on this desktop
928
+ (10 November 2026): install, cards shown, cards hidden over other programs, Alt+E editing
929
+ usable over the game (overlays moved),
930
+ removal left `kwinrulesrc` byte for byte as before and the HUD back below
931
+ the game.
932
+
933
+ On every other desktop, Plasma 5 included, nothing is written and the
934
+ overlays behave as before. Whatever fails here (a tool missing, KWin
935
+ refusing, a Questlog update changing the HUD's title so the rule no longer
936
+ matches) leaves the overlays as they were and nothing else changes; the
937
+ setup reports it as a note, not as a problem. The one case worse than
938
+ before: the rule working without the script, which leaves the cards above
939
+ other programs after Alt+Tab with the shop open, until the shop is closed.
940
+
941
+ **Cost.** GPU load and power with the game standing still, 15 s each, the
942
+ HUD below the game, above it, below again: 42 % and 133 W in all three
943
+ (RTX 3060 Ti, the game's frame rate capped). Questlog's widget windows
944
+ already sit above the game, so KWin composites over it in any case.
945
+
946
+ **Rejected.** Wine's `Managed` setting for Questlog alone
947
+ (`AppDefaults\Questlog.exe\X11 Driver`) would also unmanage Questlog's main
948
+ window, which then could not take keyboard focus. A HUD a pixel smaller
949
+ than the screen would stay unmanaged and fix this on every desktop; that is
950
+ Questlog's code, so it is a request to Questlog, not something A2Qlinux can
951
+ do.
952
+
807
953
  ## 7. Failure modes
808
954
 
809
955
  | Symptom | Cause | Where to look |
@@ -824,7 +970,10 @@ the session itself.
824
970
  | "Aion 2's traffic can't be read" before logging in | §7.3, harmless | — |
825
971
  | "A2Qlinux is already running in another window" | second launcher refused (I1) | use the running one |
826
972
  | "Questlog is already running in the game prefix without the capture bridge" | Questlog started outside A2Qlinux | quit it from its own tray icon |
827
- | Tracker Map overlay blank after restarting Questlog mid-game | Questlog learns the character's zone only at login or zone change | change zone |
973
+ | Tracker Map overlay blank, and no fights in the meter, after restarting Questlog mid-game | Questlog learns the character and its zone only at login or zone change | change zone |
974
+ | Black Market Cards (and the overlay controls icon) never show over the full-screen game; Alt+E only flashes | KDE keeps the game above Questlog's full-screen HUD (§6.8) | `a2qlinux-setup --kde-overlays` on Plasma 6; elsewhere none |
975
+ | `a2qlinux-setup`: "Note: KDE overlays: …" | a tool or KWin refused (§6.8); nothing else is affected | the reason in the note |
976
+ | game froze after **Quit Questlog** during play (A2Qlinux 0.3.0 and earlier) | Questlog's launch ended and protontricks took the game's session down with its container (§5.1, "The launch holds the session") | update A2Qlinux |
828
977
  | "Questlog update check failed (…)" | no network, CDN change | none; retried at the next check |
829
978
  | "Questlog X does not fit this A2Qlinux yet …" (notification) | a check of §10 failed | A2Qlinux needs a change for that version; the installed one stays |
830
979
  | "Questlog X ended within 60 s … going back" | the new version did not start under Proton | the previous version runs again; the failed one is in `<folder>-X-failed` |
@@ -920,6 +1069,8 @@ one** — §6.4.
920
1069
  | `questlog_ctl.exe` by hand | `protontricks-launch --appid 3393110 <package>/a2qlinux/bin/questlog_ctl.exe hide-tray` (or `show-tray`, `close-window`, `end-session`); `<package>` is printed by `python -c 'import a2qlinux; print(a2qlinux.__path__[0])'` in A2Qlinux's environment |
921
1070
  | `questlog_ctl.exe` without the game prefix | Questlog in a throwaway prefix: `wine Questlog.exe --no-sandbox --disable-gpu` under `xvfb-run`, then the commands through `wine` |
922
1071
  | who owns the game connection | `tools/tcp_owner_probe.exe` in the prefix |
1072
+ | KDE overlays (§6.8) | `tests/test_kde_overlays.py` runs against stand-ins for KDE's config tools and `dbus-send`, and, where `kwriteconfig6` is installed, checks with the real tools that removal gives the rule file back byte for byte; on the desktop, a one-off KWin script that prints the HUD's `layer` and `opacity` shows what KWin applied |
1073
+ | does the session survive a quit (§5.1) | without the game: a Windows program that only waits, started as `systemd-run --user --unit=<name> protontricks-launch --appid 3393110 <program>.exe`, plays the game; quit Questlog and check that the program, the `wineserver` and `explorer.exe /desktop` run on, and which unit holds them (`/proc/<pid>/cgroup`) |
923
1074
  | Wine's view of windows and focus | run `WINEDEBUG=+event,+x11drv,+win a2qlinux-run`; the log grows about 40 KB/s, so only briefly |
924
1075
 
925
1076
  Logs: the launcher's messages in its status window (the terminal); Questlog's and Wine's
@@ -1077,7 +1228,14 @@ where a number is expected is refused rather than read as 1/0.
1077
1228
 
1078
1229
  ## 14. Distributions and desktops
1079
1230
 
1080
- Developed and played on the one setup named at the top of this document. What depends on the
1231
+ Developed and played on the one setup named at the top of this document.
1232
+ Questlog's full-screen overlays (Black Market Cards, Alt+E editing) show
1233
+ above the full-screen game only on KDE Plasma 6, with the KDE overlays of
1234
+ §6.8, which were tested on Plasma 6.8.2 (Wayland) only: the rule list
1235
+ `Order` and the script API were checked on that version, and an earlier
1236
+ Plasma 6 that reads another list would leave the rule unapplied, that is,
1237
+ the overlays as before. On other desktops they stay behind the game and
1238
+ nothing is guaranteed. What depends on the
1081
1239
  distribution or desktop, how A2Qlinux copes with it, and how that was
1082
1240
  established. Package names per distribution are in `docs/INSTALL.md`; they
1083
1241
  were read from each distribution's package index (Debian, Ubuntu through
@@ -183,6 +183,7 @@ What the setup does, in order:
183
183
  | installs Questlog in its folder (`~/Games/Questlog`, or the one given with `--questlog-dir`) if it is not there yet (about 130 MB) | `Downloading Questlog …`, then `Installed Questlog …` |
184
184
  | takes Questlog's icon from it (A2Qlinux does not ship Questlog's logo) | `Icon: …` |
185
185
  | creates the "Questlog (AION 2)" entry in your applications menu | `Menu entry: …` |
186
+ | on KDE Plasma 6 only: explains the KDE overlays, which let Questlog's Black Market Cards show above the game, and asks whether to set them up (Enter means yes) | the explanation, `Set this up now? [Y/n]`, then `KDE: window rule … are in place.` |
186
187
  | prints the line for Steam's launch options, used in the optional last section | `Steam > AION 2 > …` |
187
188
 
188
189
  It runs nothing with `sudo` and changes nothing in the game; the commands
@@ -330,7 +331,8 @@ Next: [USING.md](USING.md).
330
331
 
331
332
  ## Removing A2Qlinux
332
333
 
333
- 1. Quit Questlog from the tray icon.
334
+ 1. Quit Questlog from the tray icon. On KDE, if you set up the KDE overlays,
335
+ remove them first with `a2qlinux-setup --no-kde-overlays`.
334
336
  2. Clear AION 2's launch options in Steam.
335
337
  3. Uninstall A2Qlinux:
336
338
  ```
@@ -17,6 +17,12 @@ A2Qlinux, what causes them and what to do, followed by common questions.
17
17
  | Steam keeps saying "launching" while Questlog is open | Play was pressed without the launch option | set the Steam launch option; meanwhile A2Qlinux closes Questlog, lets the game start and reopens it |
18
18
  | two Questlog icons in the tray | hiding Questlog's own icon failed | the status window says why; both icons work, but use A2Qlinux's |
19
19
  | clicks in the game open Questlog's window | the click fix did not start | look for lines starting `[a2qlinux]` in `~/Games/Questlog/proton-stream/questlog.log` |
20
+ | after starting Questlog again during play, the meter shows no fights and the Tracker Map is empty | Questlog learns your character only when you log in or change zone | change zone (teleport or walk into another area) |
21
+ | Black Market Cards never shows in the shop | the overlay is off in Questlog; on KDE, the KDE overlays are not set up; on other desktops it cannot show yet | see "Black Market Cards and moving overlays (Alt+E)" in [USING.md](USING.md) |
22
+ | Black Market Cards shows, but the notes sit beside the cards | the overlay's UI scale size differs from the game's interface size | set them to the same size ("Black Market Cards and moving overlays (Alt+E)" in [USING.md](USING.md)) |
23
+ | Alt+E shows only a brief flash, and overlays cannot be moved over the game | (KDE) the KDE overlays are not set up | see "Black Market Cards and moving overlays (Alt+E)" in [USING.md](USING.md) |
24
+ | (KDE) Black Market Cards stays over other programs after Alt+Tab | only half of the KDE overlays is working: the part that hides the cards when the game is not in front did not start | go back to the game and leave the shop; run `a2qlinux-setup --kde-overlays` again |
25
+ | `a2qlinux-setup` ends with "Note: KDE overlays: …" | KDE refused the change, or a KDE tool is missing; the note says which | everything else is set up; the cards stay hidden until the cause in the note is fixed |
20
26
  | Questlog closes right after starting | its graphics process failed | send `~/Games/Questlog/proton-stream/questlog.log` with your report |
21
27
  | notification "Questlog X does not fit this A2Qlinux yet" | the new Questlog changed something A2Qlinux relies on | keep using the current version; the reason is in the notification |
22
28
  | "Questlog update check failed" in the status window | no internet connection at that moment | nothing; it tries again later |
@@ -183,8 +183,68 @@ Questlog starts.
183
183
  - With Questlog's full window open behind the game, clicks in the game stay
184
184
  in the game. To work in Questlog's window, switch to it with Alt+Tab, the
185
185
  taskbar or the tray icon.
186
- - If you restart Questlog during a play session, the **Tracker Map** overlay
187
- stays empty until you change zone. That is when Questlog learns where your
188
- character is.
186
+ - You can quit Questlog during play and start it again from the menu; the
187
+ game keeps running. After such a restart the **Tracker Map** overlay stays
188
+ empty, and the meter shows no fights, until you change zone. That is when
189
+ Questlog learns who and where your character is.
189
190
  - Questlog's alerts work in the overlay. Its desktop pop-up notifications do
190
191
  not work under Proton.
192
+ - **Black Market Cards**, and moving overlays with Alt+E, need a step of
193
+ their own; see the next section.
194
+
195
+ ### Black Market Cards and moving overlays (Alt+E)
196
+
197
+ Black Market Cards is the Questlog overlay that writes its notes straight
198
+ onto the cards of the in-game Black Market shop: your pet's level and souls,
199
+ what an item unlocks or completes, the deals worth taking and how rare an
200
+ item is. It appears when you open a shop tab, while the game's mouse cursor
201
+ is visible. Once the cursor goes away, back in the game world, the notes
202
+ hide until you open a tab again.
203
+
204
+ **Why it needs extra help on Linux.** Most of Questlog's overlays (the
205
+ meter, alerts, the Black Market list) are small windows, and they always
206
+ stay above the game. The cards are drawn in one transparent window that
207
+ covers the whole screen, together with the small overlay-controls icon. So
208
+ is Questlog's overlay editing mode: while you move and resize overlays with
209
+ Alt+E, all of them are drawn in that one window.
210
+ Your desktop treats a window of that size like an ordinary program window
211
+ and keeps the full-screen game above it, so without help you never see the
212
+ cards, and Alt+E shows only a brief flash instead of overlays you can move.
213
+ On KDE Plasma 6, A2Qlinux can add a KDE window rule for that one
214
+ window, the "KDE overlays". The window then shows above AION 2 while the
215
+ game is the window in front, and turns invisible when you switch to another
216
+ program, so the notes never hang over your other windows.
217
+
218
+ | Your desktop | Black Market Cards | Alt+E (moving overlays) |
219
+ |---|---|---|
220
+ | KDE Plasma 6, KDE overlays set up | shown over the shop while the game is in front | works over the game |
221
+ | KDE Plasma 6, KDE overlays not set up | hidden behind the game | a brief flash, nothing to move |
222
+ | any other desktop | hidden behind the game; nothing is changed there | as before |
223
+
224
+ Warning: the KDE overlays were tested and work on KDE Plasma 6.8.2 in a
225
+ Wayland session. Other Plasma 6 versions may behave differently, and on
226
+ other desktops these two features are not expected to work. If the KDE
227
+ overlays do not work on your Plasma, nothing else is affected: the cards
228
+ and Alt+E simply stay hidden, as before, and `a2qlinux-setup
229
+ --no-kde-overlays` removes what was added.
230
+
231
+ To use the cards:
232
+
233
+ 1. In Questlog's overlay list, turn on **Black Market Cards**. If you had
234
+ saved your overlay list before this overlay existed, it is off: Questlog
235
+ does not add new overlays to a list you saved.
236
+ 2. On KDE Plasma 6, run `a2qlinux-setup` and answer the question about the
237
+ KDE overlays with Enter (yes). If you said no earlier, this sets them up
238
+ without asking:
239
+ ```
240
+ a2qlinux-setup --kde-overlays
241
+ ```
242
+ 3. In the overlay's options, set **UI scale size** to the size of the
243
+ game's interface: 1 = 75 %, 2 = 80 %, 3 = 85 %, 4 = 90 %, 5 = 100 %.
244
+ Questlog places the notes where the cards are at that size, so with the
245
+ wrong value they land beside the cards.
246
+ 4. Open a tab in the Black Market. The notes appear on the cards.
247
+
248
+ To remove the KDE overlays again, run `a2qlinux-setup --no-kde-overlays`.
249
+ It takes out exactly what was added and leaves the rest of your KDE
250
+ settings as they were.
@@ -0,0 +1,193 @@
1
+ import configparser
2
+ import os
3
+ import shutil
4
+ import subprocess
5
+ import tempfile
6
+ import unittest
7
+ from pathlib import Path
8
+
9
+ from a2qlinux import kde_overlays as k
10
+
11
+ # Stand-ins for KDE's config tools and dbus-send, so the tests run without
12
+ # KDE and never touch the real desktop: kreadconfig6/kwriteconfig6 on INI
13
+ # files under $XDG_CONFIG_HOME, dbus-send only recording its call.
14
+ FAKE_KCONFIG = r'''#!/usr/bin/env python3
15
+ import configparser, os, sys
16
+ args = sys.argv[1:]
17
+ def value(name):
18
+ return args[args.index(name) + 1]
19
+ path = os.path.join(os.environ["XDG_CONFIG_HOME"], value("--file"))
20
+ config = configparser.ConfigParser(interpolation=None, delimiters=("=",))
21
+ config.optionxform = str
22
+ config.read(path)
23
+ group, key = value("--group"), value("--key")
24
+ if sys.argv[0].endswith("kreadconfig6"):
25
+ print(config.get(group, key, fallback=""))
26
+ sys.exit(0)
27
+ if "--delete" in args:
28
+ if config.has_section(group):
29
+ config.remove_option(group, key)
30
+ if not config.options(group):
31
+ config.remove_section(group)
32
+ else:
33
+ if not config.has_section(group):
34
+ config.add_section(group)
35
+ config.set(group, key, args[args.index("--key") + 2])
36
+ with open(path, "w") as out:
37
+ config.write(out, space_around_delimiters=False)
38
+ '''
39
+ FAKE_DBUS = '#!/bin/sh\necho "$@" >> "$XDG_CONFIG_HOME/dbus-calls"\necho " int32 7"\n'
40
+
41
+ A2TOOLS = "[General]\nOrder=a2tools-overlay,a2tools-no-focus\n\n[a2tools-overlay]\nlayer=overlay\n"
42
+
43
+
44
+ class KdeOverlaysTest(unittest.TestCase):
45
+ def setUp(self):
46
+ self.tmp = tempfile.TemporaryDirectory()
47
+ root = Path(self.tmp.name)
48
+ self.config, self.data, bin_dir = root / "config", root / "data", root / "bin"
49
+ for folder in (self.config, self.data, bin_dir):
50
+ folder.mkdir()
51
+ for name, text in (("kreadconfig6", FAKE_KCONFIG), ("kwriteconfig6", FAKE_KCONFIG),
52
+ ("dbus-send", FAKE_DBUS)):
53
+ (bin_dir / name).write_text(text)
54
+ (bin_dir / name).chmod(0o755)
55
+ self.saved = {name: os.environ.get(name) for name in ("PATH", "XDG_CONFIG_HOME", "XDG_DATA_HOME",
56
+ "XDG_RUNTIME_DIR")}
57
+ os.environ.update(PATH=f"{bin_dir}:{self.saved['PATH']}", XDG_CONFIG_HOME=str(self.config),
58
+ XDG_DATA_HOME=str(self.data), XDG_RUNTIME_DIR=str(root))
59
+ self.rules = self.config / "kwinrulesrc"
60
+ self.logged = []
61
+
62
+ def tearDown(self):
63
+ for name, value in self.saved.items():
64
+ if value is None:
65
+ os.environ.pop(name, None)
66
+ else:
67
+ os.environ[name] = value
68
+ self.tmp.cleanup()
69
+
70
+ def read(self, file="kwinrulesrc"):
71
+ config = configparser.ConfigParser(interpolation=None)
72
+ config.optionxform = str
73
+ config.read(self.config / file)
74
+ return config
75
+
76
+ def test_install_appends_to_the_rule_list_and_keeps_other_rules(self):
77
+ self.rules.write_text(A2TOOLS)
78
+ k.install(self.logged.append)
79
+ rules = self.read()
80
+ self.assertEqual(rules["General"]["Order"], f"a2tools-overlay,a2tools-no-focus,{k.RULE}")
81
+ self.assertEqual(rules[k.RULE]["layer"], "overlay")
82
+ self.assertEqual(rules[k.RULE]["title"], k.HUD_TITLE)
83
+ self.assertEqual(rules["a2tools-overlay"]["layer"], "overlay")
84
+ self.assertEqual(self.read("kwinrc")["Plugins"][f"{k.SCRIPT}Enabled"], "true")
85
+ main_js = (k.script_dir() / "contents" / "code" / "main.js").read_text()
86
+ self.assertIn('"steam_app_3393110"', main_js)
87
+ self.assertIn(k.HUD_TITLE, main_js)
88
+ self.assertIn("org.kde.KWin.reconfigure", (self.config / "dbus-calls").read_text())
89
+
90
+ def test_installing_again_does_not_list_the_rule_twice(self):
91
+ self.rules.write_text(A2TOOLS)
92
+ k.install(self.logged.append)
93
+ k.install(self.logged.append)
94
+ self.assertEqual(self.read()["General"]["Order"].count(k.RULE), 1)
95
+
96
+ def test_remove_leaves_what_was_there_before(self):
97
+ self.rules.write_text(A2TOOLS)
98
+ before = {s: dict(self.read()[s]) for s in self.read().sections()}
99
+ k.install(self.logged.append)
100
+ k.remove(self.logged.append)
101
+ self.assertEqual({s: dict(self.read()[s]) for s in self.read().sections()}, before)
102
+ self.assertFalse(k.script_dir().exists())
103
+ self.assertNotIn("Plugins", self.read("kwinrc").sections())
104
+ calls = (self.config / "dbus-calls").read_text()
105
+ self.assertRegex(calls, rf"(?m)Scripting\.unloadScript string:{k.SCRIPT}$") # the running script stops
106
+ self.assertIn("Scripting.loadScript", calls) # opacity restored
107
+
108
+ def test_older_rule_list_is_kept_when_order_is_first_written(self):
109
+ self.rules.write_text("[General]\nrules=old-rule\ncount=1\n\n[old-rule]\nabove=true\n")
110
+ k.install(self.logged.append)
111
+ self.assertEqual(self.read()["General"]["Order"], f"old-rule,{k.RULE}")
112
+
113
+ def step(self, want, answer="", interactive=True, env=None):
114
+ asked = []
115
+
116
+ def ask(prompt):
117
+ asked.append(prompt)
118
+ return answer
119
+ problem = k.setup_step(want, ask, interactive, self.logged.append,
120
+ env if env is not None else {"XDG_CURRENT_DESKTOP": "KDE",
121
+ "KDE_SESSION_VERSION": "6"})
122
+ return problem, asked
123
+
124
+ def test_asks_with_yes_as_the_default(self):
125
+ problem, asked = self.step(None, answer="")
126
+ self.assertIsNone(problem)
127
+ self.assertEqual(len(asked), 1)
128
+ self.assertIn("[Y/n]", asked[0])
129
+ self.assertTrue(k.installed())
130
+ self.assertTrue(any("Black Market Cards" in line for line in self.logged)) # explained first
131
+
132
+ def test_no_means_nothing_is_written(self):
133
+ problem, _ = self.step(None, answer="n")
134
+ self.assertIsNone(problem)
135
+ self.assertFalse(self.rules.exists())
136
+ self.assertFalse(k.script_dir().exists())
137
+
138
+ def test_without_a_terminal_nothing_is_written_and_the_command_is_named(self):
139
+ problem, asked = self.step(None, interactive=False)
140
+ self.assertEqual(asked, [])
141
+ self.assertFalse(k.installed())
142
+ self.assertTrue(any("--kde-overlays" in line for line in self.logged))
143
+
144
+ def test_other_desktops_get_nothing(self):
145
+ problem, asked = self.step(None, env={"XDG_CURRENT_DESKTOP": "GNOME"})
146
+ self.assertIsNone(problem)
147
+ self.assertEqual(asked, [])
148
+ self.assertFalse(self.rules.exists())
149
+ problem, _ = self.step(True, env={"XDG_CURRENT_DESKTOP": "KDE", "KDE_SESSION_VERSION": "5"})
150
+ self.assertIn("Plasma 6 only", problem)
151
+ self.assertFalse(self.rules.exists())
152
+
153
+ def test_set_up_once_it_is_refreshed_without_asking(self):
154
+ self.step(True)
155
+ (k.script_dir() / "contents" / "code" / "main.js").write_text("old version")
156
+ problem, asked = self.step(None)
157
+ self.assertEqual(asked, [])
158
+ self.assertIn("steam_app_3393110", (k.script_dir() / "contents" / "code" / "main.js").read_text())
159
+
160
+ def test_no_kde_overlays_removes(self):
161
+ self.step(True)
162
+ self.step(False)
163
+ self.assertFalse(k.installed())
164
+
165
+ def test_a_failing_tool_is_a_note_and_nothing_else_breaks(self):
166
+ (Path(self.tmp.name) / "bin" / "kwriteconfig6").write_text("#!/bin/sh\necho 'cannot write' >&2\nexit 1\n")
167
+ problem, _ = self.step(True)
168
+ self.assertIn("cannot write", problem)
169
+ self.assertIn("stay behind the game", problem)
170
+
171
+
172
+ @unittest.skipUnless(shutil.which("kwriteconfig6") and shutil.which("kreadconfig6"), "needs KDE's config tools")
173
+ class RealKconfigToolsTest(unittest.TestCase):
174
+ """With KDE's real tools: removing gives back the file byte for byte (KWin itself is not called)."""
175
+
176
+ def test_round_trip_is_byte_identical(self):
177
+ with tempfile.TemporaryDirectory() as tmp:
178
+ root = Path(tmp)
179
+ bin_dir = root / "bin"
180
+ bin_dir.mkdir()
181
+ (bin_dir / "dbus-send").write_text(FAKE_DBUS)
182
+ (bin_dir / "dbus-send").chmod(0o755)
183
+ env = dict(os.environ, PATH=f"{bin_dir}:{os.environ['PATH']}", XDG_CONFIG_HOME=str(root),
184
+ XDG_DATA_HOME=str(root / "data"), XDG_RUNTIME_DIR=tmp)
185
+ original = "[General]\nOrder=a2tools-dps-meter-overlay\n\n[a2tools-dps-meter-overlay]\nlayer=overlay\n"
186
+ (root / "kwinrulesrc").write_text(original)
187
+ code = ("from a2qlinux import kde_overlays as k; k.install(lambda t: None); k.remove(lambda t: None)")
188
+ subprocess.run(["python3", "-c", code], env=env, check=True, cwd=Path(__file__).parent.parent)
189
+ self.assertEqual((root / "kwinrulesrc").read_text(), original)
190
+
191
+
192
+ if __name__ == "__main__":
193
+ unittest.main()
@@ -227,6 +227,95 @@ class AfterGameTest(unittest.TestCase):
227
227
  self.assertEqual(q.AfterGame(exited_at=100.0).next("free", 100.0), "free")
228
228
 
229
229
 
230
+ class QuestlogLaunchTest(unittest.TestCase):
231
+ """Questlog's launch waits for the Wine session to end; the launcher still sees Questlog itself end."""
232
+
233
+ def setUp(self):
234
+ self.tmp = tempfile.TemporaryDirectory()
235
+ self.dir = Path(self.tmp.name)
236
+ self.saved = q.shutil.which, q.os.environ.get("PATH")
237
+ # Stand-ins for protontricks, wine and wineserver: protontricks runs the
238
+ # command through the shell as the real one does; wine is "Questlog",
239
+ # exiting with code 7; `wineserver -w` lasts until the session-end file appears.
240
+ bin_dir = self.dir / "bin"
241
+ bin_dir.mkdir()
242
+ self.session_end = self.dir / "session-ended"
243
+ scripts = {
244
+ "protontricks": '#!/bin/bash\n[ "$1" = --no-background-wineserver ] || exit 90\nexec bash -c "$3"\n',
245
+ "protontricks-launch": "#!/bin/bash\nexit 0\n",
246
+ "wine": "#!/bin/bash\nexit 7\n",
247
+ # Also ends when the test's folder is gone, so a failed test leaves nothing running.
248
+ "wineserver": f'#!/bin/bash\nwhile [ ! -e {self.session_end} ] && [ -d {bin_dir} ]; do sleep 0.05; done\n',
249
+ }
250
+ for name, text in scripts.items():
251
+ (bin_dir / name).write_text(text)
252
+ (bin_dir / name).chmod(0o755)
253
+ q.os.environ["PATH"] = f"{bin_dir}:{self.saved[1]}"
254
+ q.shutil.which = lambda name: None if name == "systemd-run" else self.saved[0](name)
255
+ self.exe = self.dir / "Questlog.exe"
256
+ self.exe.touch()
257
+
258
+ class Server:
259
+ def environment_value(self):
260
+ return "127.0.0.1:1:token"
261
+ self.server = Server()
262
+
263
+ def tearDown(self):
264
+ q.shutil.which = self.saved[0]
265
+ q.os.environ["PATH"] = self.saved[1]
266
+ self.session_end.touch()
267
+ self.tmp.cleanup()
268
+
269
+ def test_questlogs_end_is_seen_while_its_launch_still_holds_the_session(self):
270
+ launch = q.launch_questlog(self.exe, self.server, str(self.dir / "bin" / "protontricks-launch"),
271
+ self.dir / "questlog.log")
272
+ self.assertEqual(launch.wait(timeout=10), 7)
273
+ self.assertIsNone(launch.process.poll()) # still waiting for the session to end
274
+ self.session_end.touch()
275
+ self.assertEqual(launch.process.wait(timeout=10), 0)
276
+
277
+ def test_a_failed_call_counts_as_questlog_ended(self):
278
+ (self.dir / "bin" / "protontricks").write_text("#!/bin/bash\nexit 3\n")
279
+ launch = q.launch_questlog(self.exe, self.server, str(self.dir / "bin" / "protontricks-launch"),
280
+ self.dir / "questlog.log")
281
+ self.assertEqual(launch.wait(timeout=10), 3)
282
+
283
+ def test_wait_gives_up_after_its_timeout(self):
284
+ (self.dir / "bin" / "wine").write_text(f"#!/bin/bash\nsleep 5\n")
285
+ launch = q.launch_questlog(self.exe, self.server, str(self.dir / "bin" / "protontricks-launch"),
286
+ self.dir / "questlog.log")
287
+ with self.assertRaises(q.subprocess.TimeoutExpired):
288
+ launch.wait(timeout=0.3)
289
+ self.session_end.touch()
290
+ launch.process.kill()
291
+
292
+ def test_command_and_its_scope(self):
293
+ calls = []
294
+ saved_popen = q.subprocess.Popen
295
+ q.subprocess.Popen = lambda command, **kwargs: calls.append((command, kwargs)) or saved_popen(["true"])
296
+ q.shutil.which = lambda name: "/usr/bin/systemd-run" if name == "systemd-run" else self.saved[0](name)
297
+ try:
298
+ q.launch_questlog(self.exe, self.server, str(self.dir / "bin" / "protontricks-launch"),
299
+ self.dir / "questlog.log", hidden=True)
300
+ q.launch_questlog(self.exe, self.server, str(self.dir / "bin" / "protontricks-launch"),
301
+ self.dir / "questlog.log", hold_session=False)
302
+ finally:
303
+ q.subprocess.Popen = saved_popen
304
+ held, handover = calls
305
+ command, kwargs = held
306
+ self.assertEqual(command[:3], ["systemd-run", "--user", "--scope"])
307
+ tool = command[command.index("-c") - 2:]
308
+ self.assertEqual(tool[0], str(self.dir / "bin" / "protontricks"))
309
+ self.assertEqual(tool[1:3], ["--no-background-wineserver", "-c"])
310
+ self.assertTrue(tool[3].startswith(f"wine {self.exe} --no-sandbox --hidden; echo $? > "))
311
+ self.assertTrue(tool[3].endswith("; wineserver -w"))
312
+ self.assertEqual(tool[4], str(q.APPID))
313
+ self.assertEqual(kwargs["env"]["QUESTLOG_PROTON_BRIDGE"], "127.0.0.1:1:token")
314
+ self.assertIn("wpcap=n", kwargs["env"]["WINEDLLOVERRIDES"])
315
+ self.assertEqual(handover[0][0], str(self.dir / "bin" / "protontricks-launch"))
316
+ self.assertNotIn("wineserver -w", " ".join(handover[0]))
317
+
318
+
230
319
  class ReleaseSteamAfterQuestlogTest(unittest.TestCase):
231
320
  """After Questlog is ended with the game gone, a steam.exe left over is ended once the session closes."""
232
321
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes