Harden cross-desktop fallback and packaging metadata#6
Open
Zakkaus wants to merge 2 commits into
Open
Conversation
Runtime layer-shell detection and Qt-ABI safety, plus the packaging files a Linux desktop app is expected to ship. Addresses the cross-DE / GPU / OSS-hygiene audit against overlay#10842. native bridge (native.py / layer_shell_bridge.cpp): - Gate the overlay on a Wayland session first: on X11 the .so dlopens fine but every call no-ops on an xcb surface, silently killing the top-most/drag fallback. Refuse it up front so the fallback runs. - Add koto_has_layer_shell(): a one-shot wl_registry probe for zwlr_layer_shell_v1. This is authoritative where the desktop-name check is not -- it catches Weston/Cinnamon/GNOME-under-any-XDG-value and avoids the Budgie/wlroots false positive. hasattr-guarded, so an older bridge without the symbol still loads via the name check. - Add koto_layer_qt_version() + a Qt-ABI handshake in _load(): the bridge links Qt QPA/private API (no cross-minor ABI guarantee), so refuse a bridge built against a different Qt minor than the running PyQt6. Only bites a mismatched hand-built wheel; distro builds share one system Qt. Also hasattr-guarded for old bridges. - Docstring/reason strings stop over-promising top-most/positioning on layer-shell-less Wayland. main.py: drop the dead QT_AUTO_SCREEN_SCALE_FACTOR knob (a Qt5-ism Qt6 never reads); keep QT_SCALE_FACTOR, which does pin the DPR. CMakeLists: make blur an explicit KOTONOHA_ENABLE_BLUR option (default ON, FATAL_ERROR if requested without wayland-scanner) instead of a silent find_program degrade -- kills the automagic dependency. Add a KOTONOHA_INSTALL_LICENSE gate and a Qt-version STATUS line. pyproject: PEP 639 license = "MIT" + license-files; trim build-only sources (*.cpp, *.sh, protocols/*.xml) from the wheel. packaging: ship dev.locez.kotonoha.metainfo.xml (AppStream) and a kotonoha.1 man page; add Version/StartupNotify/StartupWMClass to the desktop entry. Tests: new tests/test_native.py covers the X11 gate, the runtime probe (present/absent/old-bridge), and the real-bridge handshake.
The AppStream metainfo and man page were only wired into the external Gentoo ebuild; the repo's own Debian and Fedora packaging shipped neither. Install both there too so every distro build is consistent: - debian/install: metainfo -> usr/share/metainfo, man page -> usr/share/man/man1 (dh_compress gzips it). - fedora spec: install both in %install and list them in %files (man page globbed as kotonoha.1* for the compressed suffix). - package.yml deb/rpm smoke jobs assert both landed. Drop src/kotonoha/assets/icons/icon.png: it is byte-identical to the default assets/icon.png, so discover_icon_paths already dedupes it out by digest at runtime -- it never appeared in the picker. Removing it trims ~858K of dead weight from the repo and wheel. README documents the KOTONOHA_ENABLE_BLUR / KOTONOHA_INSTALL_LICENSE build options. Tests updated to lock in the deb/rpm install lines and CI checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens the cross-desktop fallback path and fills in the packaging metadata a
Linux desktop app is expected to ship. Comes out of a cross-DE / GPU /
OSS-hygiene audit of the code against the Gentoo ebuild in
gentoo-zh/overlay#10842.Two classes of change: runtime correctness (detect layer-shell support and
Qt-ABI compatibility at runtime instead of guessing from the desktop name), and
packaging hygiene (AppStream metainfo, man page, PEP 639 license, desktop
entry keys, an explicit blur build option).
Runtime correctness
X11 gate (native.py). On an X11 session the bridge
.sostilldlopens(its Qt/Wayland deps are present regardless), but every call no-ops on an xcb
surface -- which silently disabled the top-most/drag fallback the overlay is
supposed to use there. The controller now refuses the bridge up front unless the
platform is Wayland, so the fallback actually runs.
Runtime layer-shell probe (
koto_has_layer_shell). New C export does aone-shot
wl_registryprobe forzwlr_layer_shell_v1. This is authoritativewhere the desktop-name check is not: it catches Weston, Cinnamon, and GNOME
under any
XDG_CURRENT_DESKTOPvalue, and avoids the Budgie/wlroots falsepositive. It is
hasattr-guarded on the Python side, so an older bridge withoutthe symbol still loads and falls back to the existing name check.
Qt-ABI handshake (
koto_layer_qt_version). The bridge links Qt QPA/privateAPI, which carries no cross-minor ABI guarantee.
_load()now refuses a bridgebuilt against a different Qt minor than the running PyQt6. This only bites a
hand-built/mismatched wheel; a distro build shares one system Qt. Also
hasattr-guarded.main.py. Drops the dead
QT_AUTO_SCREEN_SCALE_FACTORenv knob -- a Qt5-ismQt6 never reads (it misleads readers into thinking scaling is pinned). Keeps
QT_SCALE_FACTOR, which does pin the device pixel ratio.Packaging
KOTONOHA_ENABLE_BLURoption (defaultON,
FATAL_ERRORif requested withoutwayland-scanner) rather than a silentfind_programdegrade. This removes the "automagic" dependency patternpackagers reject. Default ON is safe because the build already hard-requires
the
wayland-clientdev package, which shipswayland-scanner. Adds aKOTONOHA_INSTALL_LICENSEgate and a Qt-version STATUS line.license = "MIT"+license-files = ["LICENSE"](emits
License-Expression/License-File, metadata 2.4); trims build-onlysources (
*.cpp,*.sh,protocols/*.xml) from the wheel.packaging/dev.locez.kotonoha.metainfo.xmlso the app isvisible in Discover/GNOME Software.
project_licenseis MIT (the LGPL isdependency linkage, not this component's source license);
launchablepointsat the installed
kotonoha.desktop; no<screenshots>until a hosted imageand a tagged release exist.
packaging/kotonoha.1(--port/-p,-v/--verbose, defaultport 28745).
Version=1.5,StartupNotify=false(tray app, no windowon launch),
StartupWMClass=kotonoha(matches the app_id Qt derives fromsetApplicationName).the Debian (
debian/install) and Fedora (%install/%files) packaging too,not just the external Gentoo ebuild. The deb/rpm CI smoke jobs assert both
landed.
assets/icons/icon.pngwas byte-identical tothe default
assets/icon.png;discover_icon_pathsalready deduped it out bydigest at runtime, so it never showed in the picker -- removing it trims ~858K
from the repo and wheel.
KOTONOHA_ENABLE_BLUR/KOTONOHA_INSTALL_LICENSEbuild options.
Capability matrix
_NET_WM_STATE_ABOVEGPU vendor (NVIDIA/AMD/Intel) is irrelevant here: the overlay is a
wl_shmraster QWidget surface with no GL/EGL/QtQuick path, so no vendor-specific env
tuning applies. The "EGL not available" log line is benign noise.
Tests
tests/test_native.pycovers the X11 gate, the runtime probe(present / absent / old-bridge-without-symbol), and the real-bridge Qt
handshake.
tests/test_native_packaging.pyupdated for the newwheel.exclude.Full suite: 357 passing.
Not in this PR
The corrected
kotonoha-9999.ebuildforgentoo-zh/overlay#10842is handledseparately in that repo (adds
dev-util/wayland-scannerBDEPEND,qtbase:6[gui],layer-shell-qt:6,LICENSE="MIT LGPL-2.1+", installs the metainfo + man page).Wiring
KOTONOHA_INSTALL_LICENSE=OFFinto the wheel build is deferred until thedeb/rpm specs migrate their license declarations to
.dist-info/licenses/.