mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-23 00:44:15 +01:00
feat(core): Workspace<P> with the shared half of workspace.rs
komorebi-core gets Workspace<P: WorkspacePlatform>, moved from komorebi-for-kde/komorebi/src/workspace.rs (KDE is the base), together with WorkspaceLayer, WorkspaceWindowLocation, CachedLayoutDefault and the two threshold helpers, and these 52 functions of its impl, whose text is the same on both daemons (add_container_to_back/front, the container focus and removal family, insert_container_at_idx, swap_containers, preselect and monocle operations, new_container_for_window and resolve_placement_index, location_from_exe, visible_windows, the enforce_resize_* family, the window lookups, remove_floating_window and the floating focus helpers, is_scrolling). They are generic over P::Window (Container<P::Window>, PlatformWindowId<P>), and every private function is pub so the daemons' own methods can call it. The accessors the impl_ring_elements! macro made are written out. WorkspacePlatform is the hook trait: Window (a WorkspaceWindow), State (what only a platform keeps in a workspace; skipped in the JSON and the schema), default_padding, foreground_window_id, cursor_position, should_act_window and should_act_window_individual (the platform holds the compiled regexes), the three scrolling lookups and after_floating_removed (KDE refocuses a floating window). Default for Workspace<P> is the KDE one with the padding from the hook. serde and schemars bounds are on P::Window; the schema is named Workspace. Not used by any daemon yet; the next revisions make each daemon use it. Four tests with a stub platform cover new_container_for_window, the focus, the JSON keys and the default. Verified: cargo test -p komorebi-core --features schemars (native): 20 passed, 0 failed; Windows clippy --workspace --locked --all-targets -D warnings: PASS (compiles the crate). Not run: the daemons.
This commit is contained in:
1 parent
a337eca811
commit
f225e51982
4 files changed
+1483
No files matched your search
Generated
+2
@@ -3495,9 +3495,11 @@ dependencies = [
|
||||
name = "komorebi-core"
|
||||
version = "0.1.42"
|
||||
dependencies = [
|
||||
"color-eyre",
|
||||
"komorebi-collections",
|
||||
"komorebi-config",
|
||||
"komorebi-layouts",
|
||||
"komorebi-scrolling",
|
||||
"nanoid",
|
||||
"schemars 1.2.3",
|
||||
"serde",
|
||||
|
||||
@@ -8,6 +8,8 @@ edition = "2024"
|
||||
komorebi-collections = { path = "../komorebi-collections" }
|
||||
komorebi-config = { path = "../komorebi-config", default-features = false }
|
||||
komorebi-layouts = { path = "../../komorebi-layouts" }
|
||||
komorebi-scrolling = { path = "../../komorebi-scrolling" }
|
||||
color-eyre = { workspace = true }
|
||||
nanoid = "0.5"
|
||||
schemars = { workspace = true, optional = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
|
||||
mod container;
|
||||
mod globals;
|
||||
#[allow(missing_docs)]
|
||||
mod workspace;
|
||||
|
||||
pub use container::Container;
|
||||
pub use container::ContainerWindow;
|
||||
pub use container::WorkspaceWindow;
|
||||
pub use globals::WorkspaceGlobals;
|
||||
pub use workspace::*;
|
||||
pub use komorebi_collections::Lockable;
|
||||
pub use komorebi_collections::ring;
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user