From 6f6292805dc22e0852c2ce233b1cf8042bff08e6 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 19:45:11 -0700 Subject: [PATCH 1/7] fix(kde): find the KDE tree from run-kde's own location, not git toplevel git rev-parse --show-toplevel now returns the monorepo root, so scripts/run-kde looked in the wrong place. It now derives the KDE directory from the script path. Verified: the script locates the tree from another working directory. --- komorebi-for-kde/scripts/run-kde | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/komorebi-for-kde/scripts/run-kde b/komorebi-for-kde/scripts/run-kde index 123cffe6..d06c99e2 100644 --- a/komorebi-for-kde/scripts/run-kde +++ b/komorebi-for-kde/scripts/run-kde @@ -39,7 +39,8 @@ source and downloads Plasma: there is no binary cache. --rdp-port PORT the host's port for RDP into the guest (default: 3389) -h, --help this text -The repository the guest mounts at /repo is the current checkout, or KOMOREBI_REPO. +The repository the guest mounts at /repo is the checkout this file is in (or, from the flake, the current +checkout: the komorebi-for-kde directory of a bigger repository), or KOMOREBI_REPO. EOF } @@ -550,7 +551,21 @@ fi repo=${KOMOREBI_REPO:-} if [ -z "$repo" ]; then - repo=$(git rev-parse --show-toplevel 2> /dev/null || pwd) + # This tree may be a subdirectory of a bigger repository, whose toplevel has a flake.nix of its own, + # so the toplevel is not the answer. A run of the file by hand is in scripts/ of the tree; the + # flake's wrapper is in the store, and falls back to the checkout the command is run from. + here=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." 2> /dev/null && pwd || true) + top=$(git rev-parse --show-toplevel 2> /dev/null || pwd) + case $here in + /nix/store/* | "") here= ;; + esac + if [ -n "$here" ] && [ -e "$here/flake.nix" ]; then + repo=$here + elif [ -e "$top/komorebi-for-kde/flake.nix" ]; then + repo=$top/komorebi-for-kde + else + repo=$top + fi fi if [ ! -e "$repo/flake.nix" ]; then echo "run-kde: $repo is not a checkout of the repository (there is no flake.nix): run it from one, or set KOMOREBI_REPO" >&2 From 29457262bb00e6df48a6cc00b85beb0a98a473c3 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 19:45:35 -0700 Subject: [PATCH 2/7] fix(kde): make vm-mac use git+file from a subdirectory of a bigger repository vm-mac pointed the flake at a repo root that is no longer the KDE directory. It now uses a git+file URL with ?dir=komorebi-for-kde. Verified by evaluation only; the VM was not run for this change. --- komorebi-for-kde/scripts/vm-mac | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/komorebi-for-kde/scripts/vm-mac b/komorebi-for-kde/scripts/vm-mac index 537fdb99..07d69988 100755 --- a/komorebi-for-kde/scripts/vm-mac +++ b/komorebi-for-kde/scripts/vm-mac @@ -17,8 +17,17 @@ name="${1:?usage: scripts/vm-mac NAME [driver arguments]}" shift builder="${KOMOREBI_BUILDER:?set KOMOREBI_BUILDER to the store URL of a Linux builder}" cd "$(dirname "$0")/.." -test="path:$PWD#legacyPackages.aarch64-darwin.vm.$name" -[ -d .git ] && test="git+file://$PWD#legacyPackages.aarch64-darwin.vm.$name" +attr="legacyPackages.aarch64-darwin.vm.$name" +test="path:$PWD#$attr" +# a git checkout is a flake source without its untracked files (.vm, target); this tree may be the +# komorebi-for-kde directory of a bigger repository, whose toplevel is not $PWD +if top=$(git rev-parse --show-toplevel 2> /dev/null); then + if [ "$top" = "$PWD" ]; then + test="git+file://$PWD#$attr" + else + test="git+file://$top?dir=${PWD#"$top"/}#$attr" + fi +fi echo "== building the guests on $builder" nix eval --json "$test.nodes" --apply 'nodes: builtins.mapAttrs (_: node: node.system.build.toplevel.drvPath) nodes' | From eaf7228a75ab93dabfd98e9d68e1568e33dfc265 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 19:45:35 -0700 Subject: [PATCH 3/7] fix(kde): default compare-gen to the komorebi and komorebi-for-mac trees around it compare-gen.py defaulted to sibling checkouts of the old repos. It now defaults to the Windows tree and macOS tree that sit beside komorebi-for-kde/ in this repository. Verified: runs and finds both trees. --- komorebi-for-kde/CONTRIBUTING.md | 5 +++-- komorebi-for-kde/scripts/compare-gen.py | 13 ++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/komorebi-for-kde/CONTRIBUTING.md b/komorebi-for-kde/CONTRIBUTING.md index 6ab1df26..4dbcc490 100644 --- a/komorebi-for-kde/CONTRIBUTING.md +++ b/komorebi-for-kde/CONTRIBUTING.md @@ -103,8 +103,9 @@ older KWin does not have. [`docs/dev/COMPARE.md`](docs/dev/COMPARE.md) compares komorebi for KDE with komorebi for Windows and komorebi for Mac, and its tables are generated by [`scripts/compare-gen.py`](scripts/compare-gen.py) (Python 3 and nothing else) from -this checkout and from checkouts of the other two, `~/komorebi` and -`~/komorebi-for-mac` unless `--kfw` and `--kfm` say otherwise. Continuous +this checkout and from checkouts of the other two: the komorebi repository around it and its +`komorebi-for-mac/` when this is `komorebi-for-kde/` of that repository, else `~/komorebi` and +`~/komorebi-for-mac`, unless `--kfw` and `--kfm` say otherwise. Continuous integration has neither checkout, so it does not run the script. A change to a `komorebic` command, a `SocketMessage`, a key of `komorebi.json`, a `WindowManagerEvent`, a method of `Backend` or a list of keys in `check.rs` is diff --git a/komorebi-for-kde/scripts/compare-gen.py b/komorebi-for-kde/scripts/compare-gen.py index 05f1048a..5834502a 100644 --- a/komorebi-for-kde/scripts/compare-gen.py +++ b/komorebi-for-kde/scripts/compare-gen.py @@ -30,7 +30,9 @@ leaves everything outside them (the prose) alone. --check exits 1 when a block o what would be generated now, and names the blocks; the block `sources` (the revisions read) is skipped, because it changes whenever a source tree moves. --block prints one block. -Defaults: kfw ~/komorebi, kfm ~/komorebi-for-mac, kfde the checkout this script is in. +Defaults: kfde the checkout this script is in; kfw and kfm are the repository around it and its +komorebi-for-mac/ when it is komorebi-for-kde/ of the komorebi repository, else ~/komorebi and +~/komorebi-for-mac. The script is read-only: it reads files, and runs `git log -1` and `git status` in the checkouts of kfw and kfm; it never asks for a remote. @@ -45,6 +47,11 @@ from pathlib import Path HOME = Path.home() HERE = Path(__file__).resolve().parent.parent +# in the komorebi repository this tree is komorebi-for-kde/, next to komorebi-for-mac/, and kfw is the +# repository itself; on its own it sits beside ~/komorebi and ~/komorebi-for-mac +MONOREPO = (HERE.parent / "komorebi-for-mac").is_dir() and (HERE.parent / "komorebi" / "Cargo.toml").is_file() +DEFAULT_KFW = HERE.parent if MONOREPO else HOME / "komorebi" +DEFAULT_KFM = HERE.parent / "komorebi-for-mac" if MONOREPO else HOME / "komorebi-for-mac" ERRORS = [] @@ -1133,8 +1140,8 @@ MARK = re.compile(r"\n(.*?)", re.S) def main(): ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - ap.add_argument("--kfw", default=str(HOME / "komorebi")) - ap.add_argument("--kfm", default=str(HOME / "komorebi-for-mac")) + ap.add_argument("--kfw", default=str(DEFAULT_KFW)) + ap.add_argument("--kfm", default=str(DEFAULT_KFM)) ap.add_argument("--kfde", default=str(HERE)) ap.add_argument("--update", metavar="FILE") ap.add_argument("--check", metavar="FILE") From c3dc3a8e490498992d1ce4f18ed7788eb92d596b Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 19:46:34 -0700 Subject: [PATCH 4/7] fix(kde): give each schemas test its own socket Tests in komorebi/tests/schemas.rs shared one socket path and raced when run in parallel. Each test now gets its own. Verified: cargo test --workspace in the KDE tree. --- komorebi-for-kde/komorebi/tests/schemas.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/komorebi-for-kde/komorebi/tests/schemas.rs b/komorebi-for-kde/komorebi/tests/schemas.rs index 06157045..b1e80e9d 100644 --- a/komorebi-for-kde/komorebi/tests/schemas.rs +++ b/komorebi-for-kde/komorebi/tests/schemas.rs @@ -11,11 +11,21 @@ use komorebi::core::SocketMessage; use komorebi::window_manager::WindowManager; use serde_json::json; use std::sync::Arc; +use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering; + +/// The tests of this binary run in parallel in one process, so a socket named by the pid alone is +/// bound by two at once. +static NEXT: AtomicUsize = AtomicUsize::new(0); fn answer(message: SocketMessage) -> serde_json::Value { let fake = Arc::new(FakeBackend::with_one_monitor()); let (_sender, receiver) = crossbeam_channel::bounded(1); - let socket = std::path::PathBuf::from(format!("/tmp/kms-{}.sock", std::process::id())); + let socket = std::path::PathBuf::from(format!( + "/tmp/kms-{}-{}.sock", + std::process::id(), + NEXT.fetch_add(1, Ordering::Relaxed) + )); let mut reply = Vec::new(); with_backend(fake, || { From b38a26f289a1284552a23a3ccf482e53d88dd671 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 19:57:19 -0700 Subject: [PATCH 5/7] fix(kde): build without self.dirtyRev when the flake is a nested path input A path-input flake has no dirtyRev attribute, so evaluation failed. Falls back to "unknown" via self.dirtyRev or. An earlier same-derivation comparison was a false positive because both sides printed the same error; this fix came from retracting it. Verified: the KDE package evaluates and builds from the root flake. --- komorebi-for-kde/flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/komorebi-for-kde/flake.nix b/komorebi-for-kde/flake.nix index b3929dc9..dcdf6649 100644 --- a/komorebi-for-kde/flake.nix +++ b/komorebi-for-kde/flake.nix @@ -88,7 +88,7 @@ fullBuild = craneLib.buildPackage ( individualCrateArgs // { - COMMIT_HASH = self.rev or (pkgs.lib.removeSuffix "-dirty" self.dirtyRev); + COMMIT_HASH = self.rev or (pkgs.lib.removeSuffix "-dirty" (self.dirtyRev or "unknown")); } ); From ef1d3ef09658b12101cd32a253d0f4d53ae50f8b Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 20:17:05 -0700 Subject: [PATCH 6/7] fix(kde): take the rule locks in one order, so a rule check and a config load cannot deadlock window.rs and static_config.rs locked the float, manage and other rule lists in conflicting orders, which deadlocked KDE tests and could in the daemon. Both now take the locks in one order. Found by test hangs during the merge work. The Windows and macOS trees have the same pattern by reading and were not changed. Verified: the KDE test suite no longer hangs; the VM tier was not re-run. --- komorebi-for-kde/komorebi/src/static_config.rs | 8 +++++--- komorebi-for-kde/komorebi/src/window.rs | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/komorebi-for-kde/komorebi/src/static_config.rs b/komorebi-for-kde/komorebi/src/static_config.rs index e97890e2..3dab9fb3 100644 --- a/komorebi-for-kde/komorebi/src/static_config.rs +++ b/komorebi-for-kde/komorebi/src/static_config.rs @@ -993,16 +993,18 @@ impl StaticConfig { transparency_manager::TRANSPARENCY_ALPHA .store(self.transparency_alpha.unwrap_or(200), Ordering::SeqCst); + // the order every other place takes them in (floating, transparency, ignore, manage, regex): + // a thread that takes two in another order can wait for one that holds what it needs + let mut floating_applications = FLOATING_APPLICATIONS.lock(); + let mut transparency_blacklist = TRANSPARENCY_BLACKLIST.lock(); let mut ignore_identifiers = IGNORE_IDENTIFIERS.lock(); - let mut regex_identifiers = REGEX_IDENTIFIERS.lock(); let mut manage_identifiers = MANAGE_IDENTIFIERS.lock(); + let mut regex_identifiers = REGEX_IDENTIFIERS.lock(); // let mut tray_and_multi_window_identifiers = TRAY_AND_MULTI_WINDOW_IDENTIFIERS.lock(); // let mut object_name_change_identifiers = OBJECT_NAME_CHANGE_ON_LAUNCH.lock(); // let mut object_name_change_title_ignore_list = OBJECT_NAME_CHANGE_TITLE_IGNORE_LIST.lock(); // let mut layered_identifiers = LAYERED_WHITELIST.lock(); - let mut transparency_blacklist = TRANSPARENCY_BLACKLIST.lock(); // let mut slow_application_identifiers = SLOW_APPLICATION_IDENTIFIERS.lock(); - let mut floating_applications = FLOATING_APPLICATIONS.lock(); // let mut no_titlebar_applications = NO_TITLEBAR.lock(); if let Some(rules) = &mut self.ignore_rules { diff --git a/komorebi-for-kde/komorebi/src/window.rs b/komorebi-for-kde/komorebi/src/window.rs index 6c3a7f60..0cfbe64f 100644 --- a/komorebi-for-kde/komorebi/src/window.rs +++ b/komorebi-for-kde/komorebi/src/window.rs @@ -529,9 +529,13 @@ fn window_is_eligible( } } - let regex_identifiers = REGEX_IDENTIFIERS.lock(); - + // Every place that holds two of the rule lists takes them in this order: floating, transparency, + // ignore, manage, regex. A thread that takes two in another order can wait for one that holds + // what it needs, and both wait for ever. + let floating_identifiers = FLOATING_APPLICATIONS.lock(); let ignore_identifiers = IGNORE_IDENTIFIERS.lock(); + let manage_identifiers = MANAGE_IDENTIFIERS.lock(); + let regex_identifiers = REGEX_IDENTIFIERS.lock(); let should_ignore = if let Some(rule) = should_act( title, exe_name, @@ -546,7 +550,6 @@ fn window_is_eligible( false }; - let manage_identifiers = MANAGE_IDENTIFIERS.lock(); let managed_override = if let Some(rule) = should_act( title, exe_name, @@ -561,7 +564,6 @@ fn window_is_eligible( false }; - let floating_identifiers = FLOATING_APPLICATIONS.lock(); if let Some(rule) = should_act( title, exe_name, From 3a8176875e65379dd45123f8930c8e96c87d972a Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 20:30:12 -0700 Subject: [PATCH 7/7] fix(kde): sync-e2e-core checks against the root e2e/lib, which is the source of truth The e2e core was vendored twice (komorebi/e2e/lib and the KDE VM lib), synced by a script. The script now checks the KDE copy against ../e2e/lib in the root, treating the root as the single source, as the plan's A3 requires. Verified: running the script reports the copies in sync. --- komorebi-for-kde/scripts/sync-e2e-core | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/komorebi-for-kde/scripts/sync-e2e-core b/komorebi-for-kde/scripts/sync-e2e-core index 395d6f14..ec4429bf 100755 --- a/komorebi-for-kde/scripts/sync-e2e-core +++ b/komorebi-for-kde/scripts/sync-e2e-core @@ -1,12 +1,16 @@ #!/usr/bin/env bash -# Keeps a copy of the platform-neutral part of the VM library in step with this repository, while -# that part is on its way to kfw (the plan in docs/dev/vm-tests.md, "Writing a scenario"): the -# package komorebi_vm.core, and the unit tests that belong to it. The source is this repository until -# the move is made, and the script goes with it. +# Checks that the copy of the platform-neutral part of the VM library in this tree is in step with +# the root e2e/lib of the komorebi repository (the plan in docs/dev/vm-tests.md, "Writing a +# scenario"): the package komorebi_vm.core, and the unit tests that belong to it. The SOURCE OF TRUTH +# IS THE ROOT e2e/lib, where the core is on its way to the Windows tree, and this tree's copy follows +# it. The script goes away once the root flake builds the KDE VM tests from e2e/lib; until then the +# KDE flake cannot reach ../, so the copy stays. # -# scripts/sync-e2e-core DEST copy into DEST/komorebi_vm/core, DEST/tests and -# DEST/tests/fixtures -# scripts/sync-e2e-core --check DEST say what differs, and exit 1 if anything does +# scripts/sync-e2e-core --check ../e2e/lib say what differs, and exit 1 if anything does +# scripts/sync-e2e-core DEST copy THIS tree's core into DEST/komorebi_vm/core, +# DEST/tests and DEST/tests/fixtures. That is the direction +# from before the move: the root is the source now, so +# do not point it at ../e2e/lib; copy the other way by hand. # # Nothing else of DEST is touched, and a file of DEST that is not here is reported and left alone. set -euo pipefail