mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-20 15:41:38 +01:00
refactor(mac): ignore and manage rules go through the shared push_simple_rule
BEHAVIOUR (a small fix, KDE's behaviour). Router arm ManageRule and the method add_ignore_rule used an inline loop that skipped a rule when any simple rule had the same id, whatever its kind: 'ignore-rule class foo' after 'ignore-rule exe foo' was dropped. They now call komorebi_config::matching::push_simple_rule (kind and id), as KDE does (its test pins it), and the ManageRule arm is the KDE text. Verified: fast-check macOS PASS; fake-CC cargo clippy -p komorebi-macos --all-targets -D warnings clean; tools/format-all --check --tree mac clean. Not verified: any macOS run. Verified on the Mini: not yet. Hand check row added.
This commit is contained in:
1 parent
f3b9d926fb
commit
544767c863
2 files changed
+4
-32
No files matched your search
@@ -99,6 +99,7 @@ timeout. Until then H5 documents the hang.
|
||||
| `wip-u-kfm3` registry fixes (see `jj log -r wip-u-kfm3`) | The registry keeps inert application copies (no blocking Accessibility call when an entry is dropped), a window is registered when its observer is attached, a clone being dropped no longer deregisters its window, `forget_pid` runs ahead of the pause and other-space returns, and the application reaper forgets what it reaps. Nothing reads the registry except the unused `MacosBackend`. | H3, H4, H6, H7 above, and the usual walk-through: no change in what the daemon does is expected. |
|
||||
| deep dedup 1: `refactor(mac): the daemon uses the shared Container API with the hide spot` (see `jj log -r wip-u-mac-deep`) | `ContainerExt` (`add_window_at`, `load_focused_window_at`, `hide_on`, `restore_focused_window`) is gone: every call is the shared `Container::{add_window, load_focused_window, hide, restore}` with `workspace.hide_spot()`. `monocle_on` and `cycle_monocle` took the corner from the monitor (`monitor.extra`) and now take it from the workspace (`workspace.state`), which the monitor writes with the globals; `restore()` now skips the Accessibility call under `cfg!(test)`. | `cargo test`; then H1 (hide spot) and: toggle monocle on a workspace with two containers on a monitor with `window_hiding_position: BottomRight` (every other container parks in that corner), cycle the monocle container, stack with `komorebic stack`/`stack-all`, `cycle-stack`, `add-window-to-container`, switch workspaces. Change the monitor's `window_hiding_position` in the config, reload, and toggle monocle at once: the corner must be the new one. |
|
||||
| deep dedup 2: `refactor(mac): five router arms are methods with the KDE names` | `ToggleWorkspaceLayer`, `ResizeWindowAxis`, `SessionFloatRule`, `IgnoreRule` and `ReplaceConfiguration` call `toggle_workspace_layer`, `resize_window_axis`, `add_session_float_rule`, `add_ignore_rule(identifier, id: &str)` and `replace_configuration(&PathBuf)`, with the bodies the arms had (a pure move; the router arms are now the KDE text). `id` of the ignore rule is a `&str`, compared with `==`. | `cargo test`; by hand: `komorebic toggle-workspace-layer` twice (tiling to floating and back: a window of the layer is focused, the others hide at the corner and come back), `resize-axis horizontal|vertical increase|decrease`, `komorebic session-float-rule` on a window, `komorebic ignore-rule exe <name>` and `ignore-rule title/class` (the matching windows leave the workspaces), `komorebic replace-configuration <komorebi.json>` (the daemon restarts its windows under the new config; with a broken file it is left alone). |
|
||||
| wm2 1: `refactor(mac): ignore and manage rules go through the shared push_simple_rule` | `ignore-rule` and `manage-rule` add a rule unless a simple rule of the same kind and id exists. The macOS code checked only the id, so `ignore-rule class foo` after `ignore-rule exe foo` was silently dropped; it is added now (this is the KDE behaviour, which a KDE test pins). | `komorebic ignore-rule exe Notes`, then `ignore-rule title Notes`: both rules are in `komorebic state` ... `ignore_identifiers` (before, the second was not). Running the same command twice adds one rule. `manage-rule` the same. |
|
||||
|
||||
Revisions in section B change no behaviour on purpose (rename, move, route); they still need the sections C walk-through, because a mechanical mistake would show there.
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ use crate::core::config_generation::WorkspaceMatchingRule;
|
||||
use crate::monitor::MonitorExt;
|
||||
use crate::scrolling::WorkspaceScrolling;
|
||||
use crate::workspace::WorkspaceExt;
|
||||
use komorebi_config::matching::push_simple_rule;
|
||||
|
||||
use crate::core_graphics::CoreGraphicsApi;
|
||||
use crate::current_space_id;
|
||||
@@ -906,22 +907,7 @@ impl WindowManager {
|
||||
SocketMessage::ManageRule(identifier, ref id) => {
|
||||
let mut manage_identifiers = MANAGE_IDENTIFIERS.lock();
|
||||
|
||||
let mut should_push = true;
|
||||
for m in &*manage_identifiers {
|
||||
if let MatchingRule::Simple(m) = m
|
||||
&& m.id.eq(id)
|
||||
{
|
||||
should_push = false;
|
||||
}
|
||||
}
|
||||
|
||||
if should_push {
|
||||
manage_identifiers.push(MatchingRule::Simple(IdWithIdentifier {
|
||||
kind: identifier,
|
||||
id: id.clone(),
|
||||
matching_strategy: Option::from(MatchingStrategy::Legacy),
|
||||
}));
|
||||
}
|
||||
push_simple_rule(&mut manage_identifiers, identifier, id);
|
||||
}
|
||||
SocketMessage::NewWorkspace => {
|
||||
self.new_workspace()?;
|
||||
@@ -1585,22 +1571,7 @@ impl WindowManager {
|
||||
) -> eyre::Result<()> {
|
||||
let mut ignore_identifiers = IGNORE_IDENTIFIERS.lock();
|
||||
|
||||
let mut should_push = true;
|
||||
for i in &*ignore_identifiers {
|
||||
if let MatchingRule::Simple(i) = i
|
||||
&& i.id == id
|
||||
{
|
||||
should_push = false;
|
||||
}
|
||||
}
|
||||
|
||||
if should_push {
|
||||
ignore_identifiers.push(MatchingRule::Simple(IdWithIdentifier {
|
||||
kind: identifier,
|
||||
id: id.to_string(),
|
||||
matching_strategy: Option::from(MatchingStrategy::Legacy),
|
||||
}));
|
||||
}
|
||||
push_simple_rule(&mut ignore_identifiers, identifier, id);
|
||||
|
||||
let offset = self.work_area_offset;
|
||||
|
||||
|
||||
Reference in new issue
Block a user