a2qlinux 0.2.1__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.
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/CHANGELOG.md +49 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/PKG-INFO +1 -1
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/_version.py +2 -2
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/bin/questlog_ctl.exe +0 -0
- a2qlinux-0.4.0/a2qlinux/bin/wpcap.dll +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/config.py +13 -3
- a2qlinux-0.4.0/a2qlinux/kde_overlays.py +250 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/launcher.py +255 -34
- a2qlinux-0.4.0/a2qlinux/pcap_bridge.py +285 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/setup_desktop.py +19 -2
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/update.py +3 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/bridge/build.sh +4 -1
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/bridge/tests/bridge_client_test.c +24 -7
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/bridge/wpcap_bridge.c +151 -48
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/docs/ARCHITECTURE.md +366 -28
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/docs/INSTALL.md +9 -5
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/docs/TROUBLESHOOTING.md +10 -2
- a2qlinux-0.4.0/docs/USING.md +250 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/test_config.py +13 -1
- a2qlinux-0.4.0/tests/test_kde_overlays.py +193 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/test_launcher.py +327 -0
- a2qlinux-0.4.0/tests/test_pcap_bridge.py +216 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/test_update.py +3 -2
- a2qlinux-0.2.1/a2qlinux/bin/wpcap.dll +0 -0
- a2qlinux-0.2.1/a2qlinux/pcap_bridge.py +0 -205
- a2qlinux-0.2.1/docs/USING.md +0 -126
- a2qlinux-0.2.1/tests/test_pcap_bridge.py +0 -120
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/.gitignore +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/LICENSE +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/README.md +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/__init__.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/desktop.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/steam.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/a2qlinux/tray.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/bridge/questlog_ctl.c +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/bridge/tests/zorder_guard_test.c +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/docs/README.md +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/docs/RELEASE.md +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/docs/UPDATING.md +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/pyproject.toml +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/__init__.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/test_desktop.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/test_replay_stream.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/test_setup_desktop.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tests/test_steam.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tools/__init__.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tools/pcap2questlog.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tools/replay_stream.py +0 -0
- {a2qlinux-0.2.1 → a2qlinux-0.4.0}/tools/tcp_owner_probe.c +0 -0
|
@@ -3,6 +3,55 @@
|
|
|
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
|
+
|
|
32
|
+
## [0.3.0] — 2026-11-08
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
- Playing through a VPN needs no setting. A2Qlinux listens on all network
|
|
36
|
+
connections at once (cable, Wi-Fi, VPN), and Questlog reads the game on
|
|
37
|
+
whichever one it uses. A VPN changing servers during play is picked up
|
|
38
|
+
within seconds, without a restart.
|
|
39
|
+
- When the VPN is switched off during play, the status window and a
|
|
40
|
+
notification say that the game's connection has lost its network and the
|
|
41
|
+
game has to reconnect.
|
|
42
|
+
- A warning in the status window and a notification when the game runs
|
|
43
|
+
through a connection that `interface` in the settings file leaves out.
|
|
44
|
+
- `interface` can name several connections, as a list:
|
|
45
|
+
`interface = ["eth0", "wg0"]`.
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
- A2Qlinux no longer refuses to start when the computer has more than one
|
|
49
|
+
network connection, for example with a VPN on.
|
|
50
|
+
- The status window no longer prints a line every time Questlog reconnects
|
|
51
|
+
to the game traffic, which it does on every zone change. It names the
|
|
52
|
+
connection Questlog follows, once, and again only when that changes;
|
|
53
|
+
problems are still reported as before.
|
|
54
|
+
|
|
6
55
|
## [0.2.1] — 2026-11-05
|
|
7
56
|
|
|
8
57
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: a2qlinux
|
|
3
|
-
Version: 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.
|
|
22
|
-
__version_tuple__ = version_tuple = (0,
|
|
21
|
+
__version__ = version = '0.4.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 4, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
Binary file
|
|
Binary file
|
|
@@ -39,8 +39,10 @@ class Setting:
|
|
|
39
39
|
SETTINGS = {
|
|
40
40
|
"questlog_dir": Setting("~/Games/Questlog", str,
|
|
41
41
|
"Folder with Questlog.exe (the QUESTLOG_DIR environment variable overrides it)."),
|
|
42
|
-
"interface": Setting("", str,
|
|
43
|
-
|
|
42
|
+
"interface": Setting("", (str, list),
|
|
43
|
+
'Network interfaces to capture on: a name, or a list such as ["eth0", "wg0"]; '
|
|
44
|
+
"empty: every one with an IPv4 address besides lo (Questlog follows the game's "
|
|
45
|
+
"connection on whichever it uses, a VPN included)."),
|
|
44
46
|
"after_game": Setting("keep", str,
|
|
45
47
|
'"keep": Questlog stays open after the game, and Steam sees the game as closed; '
|
|
46
48
|
'"close": Questlog closes with the game.',
|
|
@@ -58,7 +60,7 @@ SETTINGS = {
|
|
|
58
60
|
@dataclass(frozen=True)
|
|
59
61
|
class Settings:
|
|
60
62
|
questlog_dir: Path
|
|
61
|
-
interface:
|
|
63
|
+
interface: tuple
|
|
62
64
|
after_game: str
|
|
63
65
|
after_game_delay: float
|
|
64
66
|
auto_update: bool
|
|
@@ -99,6 +101,10 @@ def load(path=CONFIG_PATH):
|
|
|
99
101
|
problems.append(f"{where}: '{name}' must be {_kind_name(spec.kind)}, not {value!r}; "
|
|
100
102
|
f"using {spec.default!r}.")
|
|
101
103
|
continue
|
|
104
|
+
if isinstance(value, list) and not all(isinstance(item, str) and item for item in value):
|
|
105
|
+
problems.append(f"{where}: '{name}' must list interface names as quoted texts, not {value!r}; "
|
|
106
|
+
f"using {spec.default!r}.")
|
|
107
|
+
continue
|
|
102
108
|
if spec.choices and value not in spec.choices:
|
|
103
109
|
problems.append(f"{where}: '{name}' must be one of {', '.join(map(repr, spec.choices))}, "
|
|
104
110
|
f"not {value!r}; using {spec.default!r}.")
|
|
@@ -110,6 +116,8 @@ def load(path=CONFIG_PATH):
|
|
|
110
116
|
values[name] = value
|
|
111
117
|
env_dir = os.environ.get("QUESTLOG_DIR")
|
|
112
118
|
values["questlog_dir"] = Path(env_dir or values["questlog_dir"]).expanduser()
|
|
119
|
+
interface = values["interface"]
|
|
120
|
+
values["interface"] = tuple(interface) if isinstance(interface, list) else ((interface,) if interface else ())
|
|
113
121
|
values["after_game_delay"] = float(values["after_game_delay"])
|
|
114
122
|
values["update_check_hours"] = float(values["update_check_hours"])
|
|
115
123
|
return Settings(**values), problems
|
|
@@ -120,6 +128,8 @@ def _kind_name(kind):
|
|
|
120
128
|
return "true or false"
|
|
121
129
|
if kind is str:
|
|
122
130
|
return "a quoted text"
|
|
131
|
+
if kind == (str, list):
|
|
132
|
+
return "a quoted text or a list of them"
|
|
123
133
|
return "a number"
|
|
124
134
|
|
|
125
135
|
|
|
@@ -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"
|