diff --git a/crates/komorebi-bar-core/src/schema/changes.rs b/crates/komorebi-bar-core/src/schema/changes.rs index 9f2898b2..380ed5e8 100644 --- a/crates/komorebi-bar-core/src/schema/changes.rs +++ b/crates/komorebi-bar-core/src/schema/changes.rs @@ -5,7 +5,7 @@ //! bar does not have (the keyboard, media and systray widgets, the mouse options and their //! definitions, which pruning of the unreachable definitions finishes) and sets the text and the //! defaults that read differently. Each entry is a convergence candidate: dropping one changes -//! one line of `komorebi-for-mac/schema.bar.json` and of `nix/komorebi-bar-options.nix`. +//! one line of `schemas/macos/schema.bar.json` and of `nix/macos/komorebi-bar-options.nix`. //! //! Generated from the difference between the two checked-in files; `tests/schema_oracle.rs` //! proves that the view of the Windows file is byte-identical to the macOS file. diff --git a/crates/komorebi-bar-core/tests/schema_oracle.rs b/crates/komorebi-bar-core/tests/schema_oracle.rs index c51367b1..6f5edc73 100644 --- a/crates/komorebi-bar-core/tests/schema_oracle.rs +++ b/crates/komorebi-bar-core/tests/schema_oracle.rs @@ -1,6 +1,6 @@ //! The schema oracle of the shared bar. //! -//! `schema.bar.json` (Windows, at the root) and `komorebi-for-mac/schema.bar.json` are what +//! `schemas/windows/schema.bar.json` and `schemas/macos/schema.bar.json` are what //! `komorebi-bar --schema` prints. They are pinned here by size and a FNV-1a hash of their bytes, //! so that a move or a convergence of bar code cannot change them unnoticed. A reviewed change //! to either file updates the matching pin in the same revision. @@ -20,13 +20,13 @@ struct Pin { const PINS: [Pin; 2] = [ Pin { - file: "schema.bar.json", + file: "schemas/windows/schema.bar.json", lines: 9_091, bytes: 248_539, fnv1a: 0xaaa0_fabf_b459_67b7, }, Pin { - file: "komorebi-for-mac/schema.bar.json", + file: "schemas/macos/schema.bar.json", lines: 3_774, bytes: 116_925, fnv1a: 0xa042_f6ac_063a_0cfd, @@ -88,16 +88,18 @@ mod views { /// The Windows file is the union; its Windows view is itself. #[test] fn the_windows_view_of_the_union_is_the_windows_file() { - let union = serde_json::from_str(&text("schema.bar.json")).expect("json"); - assert!(view_text(union, SchemaPlatform::Windows) == text("schema.bar.json")); + let union = serde_json::from_str(&text("schemas/windows/schema.bar.json")).expect("json"); + assert!( + view_text(union, SchemaPlatform::Windows) == text("schemas/windows/schema.bar.json") + ); } /// The macOS view of the union is the macOS file, byte for byte. #[test] fn the_macos_view_of_the_union_is_the_macos_file() { - let union = serde_json::from_str(&text("schema.bar.json")).expect("json"); + let union = serde_json::from_str(&text("schemas/windows/schema.bar.json")).expect("json"); let view = view_text(union, SchemaPlatform::MacOs); - let file = text("komorebi-for-mac/schema.bar.json"); + let file = text("schemas/macos/schema.bar.json"); if view != file { let first = view.lines().zip(file.lines()).position(|(a, b)| a != b); panic!( @@ -112,7 +114,7 @@ mod views { /// schema through it. #[test] fn a_view_is_idempotent() { - let union = serde_json::from_str(&text("schema.bar.json")).expect("json"); + let union = serde_json::from_str(&text("schemas/windows/schema.bar.json")).expect("json"); let once = view_text(union, SchemaPlatform::MacOs); let again = view_text( serde_json::from_str(&once).expect("json"), @@ -133,8 +135,7 @@ mod generated { /// out-of-tree harness covers it.) #[test] fn the_generated_macos_view_is_the_macos_file() { - let file = - String::from_utf8(super::read("komorebi-for-mac/schema.bar.json")).expect("utf-8"); + let file = String::from_utf8(super::read("schemas/macos/schema.bar.json")).expect("utf-8"); let text = generated_text::(SchemaPlatform::MacOs); if text != file { let first = text.lines().zip(file.lines()).position(|(a, b)| a != b); diff --git a/crates/komorebi-config/tests/rule_matching.rs b/crates/komorebi-config/tests/rule_matching.rs index 21bb1f70..e00eb360 100644 --- a/crates/komorebi-config/tests/rule_matching.rs +++ b/crates/komorebi-config/tests/rule_matching.rs @@ -3,7 +3,7 @@ //! three daemons call (`komorebi_config::rules`), so what the `rules`, `rules_class`, `rules_exe`, //! `title_rule` and `startup_rules` end-to-end scenarios assert about WHICH window a rule catches //! is asserted here once, with no window manager. These tests are the ones the KDE daemon had -//! (`komorebi-for-kde/komorebi/tests/rule_matching.rs`), moved with the function; they run the +//! (`komorebi-linux/tests/rule_matching.rs`), moved with the function; they run the //! KDE/macOS input shape (`RuleQuirks::UNIX`, a window with a list of classes). //! //! Not covered here, and so still end-to-end: that the daemon applies the rule at the right moment diff --git a/crates/komorebi-config/tests/schemas.rs b/crates/komorebi-config/tests/schemas.rs index 1d4ac3a6..ad63387a 100644 --- a/crates/komorebi-config/tests/schemas.rs +++ b/crates/komorebi-config/tests/schemas.rs @@ -1,7 +1,7 @@ //! The oracle of the crate: the schemas that are checked in next to the three daemons. //! -//! `schema.json` and `schema.asc.json` of the Windows tree (the repository root), of -//! `komorebi-for-kde` and of `komorebi-for-mac` are what users, the docs and the nix options +//! `schema.json` and `schema.asc.json` of the three platforms (`schemas/windows`, `schemas/linux`, +//! `schemas/macos`) are what users, the docs and the nix options //! are generated from, so they must not change by accident while the data types move into this //! crate. The files are read by their path relative to the repository. //! @@ -26,19 +26,19 @@ struct Tree { const TREES: [Tree; 3] = [ Tree { name: "windows", - dir: "", + dir: "schemas/windows", properties: 53, defs: 60, }, Tree { name: "kde", - dir: "komorebi-for-kde", + dir: "schemas/linux", properties: 37, defs: 52, }, Tree { name: "macos", - dir: "komorebi-for-mac", + dir: "schemas/macos", properties: 33, defs: 47, }, diff --git a/crates/komorebi-settings/src/shared.rs b/crates/komorebi-settings/src/shared.rs index aebbd069..288a308a 100644 --- a/crates/komorebi-settings/src/shared.rs +++ b/crates/komorebi-settings/src/shared.rs @@ -48,7 +48,7 @@ impl PlatformDefaults { container_padding: 10, workspace_padding: 10, }; - /// `komorebi-for-kde/komorebi/src/border_manager/mod.rs` and `.../lib.rs` + /// `komorebi-linux/src/border_manager/mod.rs` and `.../lib.rs` pub const KDE: Self = Self { border_width: 10, border_offset: 0, @@ -56,7 +56,7 @@ impl PlatformDefaults { container_padding: 5, workspace_padding: 5, }; - /// `komorebi-for-mac/komorebi/src/border_manager/mod.rs` and `.../lib.rs` + /// `komorebi-macos/src/border_manager/mod.rs` and `.../lib.rs` pub const MACOS: Self = Self { border_width: 10, border_offset: 0, diff --git a/crates/komorebic-core/tests/docs_cli.rs b/crates/komorebic-core/tests/docs_cli.rs index afa06f06..ae3e292d 100644 --- a/crates/komorebic-core/tests/docs_cli.rs +++ b/crates/komorebic-core/tests/docs_cli.rs @@ -27,7 +27,7 @@ fn macos_page(name: &str, page: &str) -> String { #[test] fn every_macos_page_is_as_checked_in() { - let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../komorebi-for-mac/docs/cli"); + let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../docs/macos/cli"); if !dir.is_dir() { // a source tree without the macOS tree (the nix build of the Windows workspace) return; @@ -41,9 +41,6 @@ fn every_macos_page_is_as_checked_in() { stale.push(name.as_str()); } } - assert!( - stale.is_empty(), - "stale pages in komorebi-for-mac/docs/cli: {stale:?}" - ); + assert!(stale.is_empty(), "stale pages in docs/macos/cli: {stale:?}"); assert_eq!(rendered.len(), std::fs::read_dir(&dir).unwrap().count()); } diff --git a/crates/komorebic-core/tests/e2e_sweep.rs b/crates/komorebic-core/tests/e2e_sweep.rs index 17aeb36e..5e2a7f52 100644 --- a/crates/komorebic-core/tests/e2e_sweep.rs +++ b/crates/komorebic-core/tests/e2e_sweep.rs @@ -8,7 +8,7 @@ //! //! mirrors: commands / (the part "the command is understood: exit status 0", for the //! command line only; what the daemon does with it is the daemon's tests, see -//! `komorebi-for-kde/komorebi/tests/command_sweep.rs`) +//! `komorebi-linux/tests/command_sweep.rs`) use komorebic_core::cli::Meta; use komorebic_core::cli::command; diff --git a/komorebi-bar/src/macos/mod.rs b/komorebi-bar/src/macos/mod.rs index f4906b39..70494985 100644 --- a/komorebi-bar/src/macos/mod.rs +++ b/komorebi-bar/src/macos/mod.rs @@ -128,7 +128,7 @@ pub fn main() -> eyre::Result<()> { if opts.quickstart { let komorebi_bar_json = - include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json").to_string(); + include_str!("../../../docs/macos/komorebi.bar.example.json").to_string(); std::fs::write(home_dir.join("komorebi.bar.json"), komorebi_bar_json)?; println!( "Example komorebi.bar.json file written to {}", @@ -149,8 +149,7 @@ pub fn main() -> eyre::Result<()> { let mut config = match config_path { None => { let komorebi_bar_json = - include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json") - .to_string(); + include_str!("../../../docs/macos/komorebi.bar.example.json").to_string(); std::fs::write(&default_config_path, komorebi_bar_json)?; tracing::info!( diff --git a/komorebi-linux/src/check.rs b/komorebi-linux/src/check.rs index 7ebb2e93..8bb21f27 100644 --- a/komorebi-linux/src/check.rs +++ b/komorebi-linux/src/check.rs @@ -1812,7 +1812,7 @@ mod tests { let Some(known) = known_keys() else { return; }; - let example = include_str!("../../docs/komorebi.example.json"); + let example = include_str!("../../docs/linux/komorebi.example.json"); let value: serde_json::Value = serde_json::from_str(example).unwrap(); let findings = check_keys(&value, &known); diff --git a/komorebi-linux/tests/asc.rs b/komorebi-linux/tests/asc.rs index d189d4b7..b409a588 100644 --- a/komorebi-linux/tests/asc.rs +++ b/komorebi-linux/tests/asc.rs @@ -216,7 +216,7 @@ fn the_kinds_of_rule_of_other_platforms_are_read_and_do_nothing() { #[test] fn the_applications_file_komorebic_ships_floats_the_programs_it_names() { let shipped = - Path::new(env!("CARGO_MANIFEST_DIR")).join("../../komorebic/src/linux/applications.json"); + Path::new(env!("CARGO_MANIFEST_DIR")).join("../komorebic/src/linux/applications.json"); let mut desktop = Desktop::load(&applications(&shipped)).unwrap(); assert_eq!( diff --git a/komorebi-linux/tests/config_parity.rs b/komorebi-linux/tests/config_parity.rs index dbc7616a..ec6763a2 100644 --- a/komorebi-linux/tests/config_parity.rs +++ b/komorebi-linux/tests/config_parity.rs @@ -1,5 +1,5 @@ //! Can one `komorebi.json` be shared across platforms? The fixtures are the file this repository -//! ships (`docs/komorebi.example.json`) and files of komorebi for Windows, which has keys that +//! ships (`docs/linux/komorebi.example.json`) and files of komorebi for Windows, which has keys that //! mean nothing on KDE Plasma. Every fixture must deserialize with [`StaticConfig`], round-trip //! through its serializer, and lose only the top-level keys that are Windows-only //! ([`WINDOWS_ONLY`]). @@ -48,7 +48,7 @@ fn repo_root() -> PathBuf { fn fixtures() -> Vec { let root = repo_root(); - let mut out = vec![root.join("docs/komorebi.example.json")]; + let mut out = vec![root.join("docs/linux/komorebi.example.json")]; let dir = root.join("spikes/config-parity/fixtures"); let mut stack = vec![dir]; while let Some(d) = stack.pop() { @@ -185,8 +185,10 @@ fn the_lists_name_no_key_that_is_read() { #[test] fn the_example_in_the_docs_is_the_example_file() { - let page = std::fs::read_to_string(repo_root().join("docs/example-configurations.md")).unwrap(); - let file = std::fs::read_to_string(repo_root().join("docs/komorebi.example.json")).unwrap(); + let page = + std::fs::read_to_string(repo_root().join("docs/linux/example-configurations.md")).unwrap(); + let file = + std::fs::read_to_string(repo_root().join("docs/linux/komorebi.example.json")).unwrap(); let start = page.find("```json\n").expect("the page has the example") + "```json\n".len(); let end = start + page[start..].find("```").expect("the example ends"); diff --git a/komorebi-linux/tests/wallpaper.rs b/komorebi-linux/tests/wallpaper.rs index 37151fde..f6aa2f0a 100644 --- a/komorebi-linux/tests/wallpaper.rs +++ b/komorebi-linux/tests/wallpaper.rs @@ -381,7 +381,7 @@ fn theme_options_choose_the_variant_and_the_colour_each_border_takes() { #[test] fn the_wallpaper_example_in_the_docs_loads() { - let docs = Path::new(env!("CARGO_MANIFEST_DIR")).join("../docs/usage/wallpapers.md"); + let docs = Path::new(env!("CARGO_MANIFEST_DIR")).join("../docs/linux/usage/wallpapers.md"); let docs = std::fs::read_to_string(docs).unwrap(); let json = docs .split("```json\n") diff --git a/komorebi-macos/src/pan.rs b/komorebi-macos/src/pan.rs index 5c5ca46f..7c08a345 100644 --- a/komorebi-macos/src/pan.rs +++ b/komorebi-macos/src/pan.rs @@ -459,13 +459,13 @@ mod tests { #[test] fn the_swipes_of_a_stream_lift_at_the_speed_that_they_were_made_to() { let long = lift_speed(&moves_of(include_str!( - "../../../komorebic/fixtures/pan3-long.transcript.txt" + "../../komorebic/fixtures/pan3-long.transcript.txt" ))); let flick = lift_speed(&moves_of(include_str!( - "../../../komorebic/fixtures/pan3-flick.transcript.txt" + "../../komorebic/fixtures/pan3-flick.transcript.txt" ))); let slow = lift_speed(&moves_of(include_str!( - "../../../komorebic/fixtures/pan3-slow.transcript.txt" + "../../komorebic/fixtures/pan3-slow.transcript.txt" ))); // 0.128 cm every 8 ms, and 0.267 every 8 diff --git a/komorebic/src/linux/mod.rs b/komorebic/src/linux/mod.rs index 8bffe585..6650c80e 100644 --- a/komorebic/src/linux/mod.rs +++ b/komorebic/src/linux/mod.rs @@ -577,8 +577,7 @@ pub fn main() -> eyre::Result<()> { std::fs::create_dir_all(&*komorebi_client::DATA_DIR)?; let komorebi_json = - include_str!("../../../komorebi-for-kde/docs/komorebi.example.json") - .to_string(); + include_str!("../../../docs/linux/komorebi.example.json").to_string(); let komorebi_path = HOME_DIR.join("komorebi.json"); let applications_path = HOME_DIR.join("applications.json"); let skhdrc_path = HOME_DIR.join("skhdrc"); @@ -590,7 +589,7 @@ pub fn main() -> eyre::Result<()> { let applications_json = include_str!("applications.json"); write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; - let skhdrc = include_str!("../../../komorebi-for-kde/docs/skhdrc.sample"); + let skhdrc = include_str!("../../../docs/linux/skhdrc.sample"); write_file_with_prompt(&skhdrc_path, skhdrc, &mut written_files)?; if written_files.is_empty() { println!("\nNo files were written.") diff --git a/komorebic/src/macos/mod.rs b/komorebic/src/macos/mod.rs index 24ad84a3..ca01a844 100644 --- a/komorebic/src/macos/mod.rs +++ b/komorebic/src/macos/mod.rs @@ -278,11 +278,9 @@ pub fn main() -> eyre::Result<()> { std::fs::create_dir_all(data_dir)?; let mut komorebi_json = - include_str!("../../../komorebi-for-mac/docs/komorebi.example.json") - .to_string(); + include_str!("../../../docs/macos/komorebi.example.json").to_string(); let komorebi_bar_json = - include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json") - .to_string(); + include_str!("../../../docs/macos/komorebi.bar.example.json").to_string(); if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() { komorebi_json = @@ -302,7 +300,7 @@ pub fn main() -> eyre::Result<()> { let applications_json = include_str!("applications.json"); write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; - let whkdrc = include_str!("../../../komorebi-for-mac/docs/skhdrc.sample"); + let whkdrc = include_str!("../../../docs/macos/skhdrc.sample"); write_file_with_prompt(&skhdrc_path, whkdrc, &mut written_files)?; if written_files.is_empty() { println!("\nNo files were written.") diff --git a/komorebic/tests/linux_cli.rs b/komorebic/tests/linux_cli.rs index c72ac904..2f68fa9f 100644 --- a/komorebic/tests/linux_cli.rs +++ b/komorebic/tests/linux_cli.rs @@ -873,7 +873,7 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() { let output = quickstart(&runtime, &home, ""); assert!(output.status.success(), "{output:?}"); - let example = include_str!("../../komorebi-for-kde/docs/komorebi.example.json"); + let example = include_str!("../../docs/linux/komorebi.example.json"); assert_eq!( std::fs::read_to_string(home.join("komorebi.json")).unwrap(), example @@ -884,7 +884,7 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() { ); assert_eq!( std::fs::read_to_string(home.join("skhdrc")).unwrap(), - include_str!("../../komorebi-for-kde/docs/skhdrc.sample") + include_str!("../../docs/linux/skhdrc.sample") ); assert!(stdout(&output).contains("The following example files were written")); assert!(stdout(&output).contains("komorebic start")); @@ -905,7 +905,7 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() { // the third question has no answer, which is not a yes assert_eq!( std::fs::read_to_string(home.join("skhdrc")).unwrap(), - include_str!("../../komorebi-for-kde/docs/skhdrc.sample") + include_str!("../../docs/linux/skhdrc.sample") ); assert!(stdout(&output).contains("Skipping")); } @@ -1001,7 +1001,7 @@ fn the_schema_files_of_the_repository_are_what_the_subcommands_print() { let root = Path::new(env!("CARGO_MANIFEST_DIR")) .parent() .unwrap() - .join("komorebi-for-kde"); + .join("schemas/linux"); for (file, subcommand) in [ ("schema.json", "static-config-schema"), diff --git a/komorebic/tests/linux_hotkeys.rs b/komorebic/tests/linux_hotkeys.rs index ee311141..d64f8e1d 100644 --- a/komorebic/tests/linux_hotkeys.rs +++ b/komorebic/tests/linux_hotkeys.rs @@ -78,7 +78,7 @@ fn stderr(output: &Output) -> String { fn fixture(name: &str) -> PathBuf { Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../komorebi-for-kde/komorebi-hotkeys/tests/fixtures") + .join("../komorebi-hotkeys/tests/fixtures") .join(name) }