refactor(bar): one komorebi-bar package with a module per platform

The macOS bar module moves from komorebi-for-mac/komorebi-bar/src/macos to komorebi-bar/src/macos (the
include_str! path follows), komorebi-bar/src/main.rs is a cfg_select! over target_os that runs
windows::main or macos::main, and komorebi-bar/Cargo.toml has what both share in [dependencies] and the
rest in per-target tables (Windows: windows, windows-core, windows-icons x2, systray-util, tokio, regex,
which, egui_extras, netdev 0.46, sysinfo 0.39, komorebi-themes without default features; macOS: objc2,
objc2-app-kit, icns, raw-window-handle, netdev 0.40, sysinfo 0.38, komorebi-themes with defaults), so each
platform keeps the versions it had. The old komorebi-bar-macos package stays as a shim that includes the
moved module. The macOS flake builds -p komorebi-bar and its source filter takes the unified package's
manifest, main.rs and src/macos; the Windows filter leaves src/macos out. The bar does not build for
Linux (no arm of the cfg_select), as before.

Gates run: Windows clippy --all-targets -D warnings PASS; macOS fake-CC check --locked --all-targets of
-p komorebi-bar and -p komorebi-bar-macos PASS (type check only); bar-core schema oracle (3 + 6) PASS; the
S/bar2 harness regenerates schema.bar.json for Windows (9091 lines) and macOS (3774) byte-identical to the
checked-in files; tools/kde-closure-check ok; CLI docs oracle identical x3; nix evaluation PASS and by
evaluation an edit of komorebi-bar/src/windows changes the Windows derivations only (the macOS side cannot
be evaluated on this Linux host). Not run: nix builds, any bar run (Windows screenshot gate and the Mac
hand check are owed).
This commit is contained in:
LGUG2Z committed 2026-10-31 12:45:25 -07:00
1 parent bdd811f2d4
commit 7d4ea893cc
14 files changed
+64 -16

No files matched your search

Generated
+6
View File
@@ -3406,22 +3406,28 @@ dependencies = [
"egui_extras",
"font-loader",
"hotwatch",
"icns",
"image 0.25.10",
"komorebi-bar-core",
"komorebi-client",
"komorebi-themes",
"lazy_static",
"netdev 0.40.1",
"netdev 0.46.3",
"num",
"num-derive",
"num-traits",
"objc2 0.6.5",
"objc2-app-kit 0.3.2",
"parking_lot 0.12.5",
"random_word",
"raw-window-handle",
"regex",
"reqwest",
"schemars 1.2.3",
"serde",
"serde_json_lenient",
"sysinfo 0.38.4",
"sysinfo 0.39.6",
"systray-util",
"tokio",
+1 -1
View File
@@ -224,7 +224,7 @@
# the other platforms' crates are added as stubs below
!(pkgs.lib.hasInfix "/komorebi-for-kde" path || pkgs.lib.hasInfix "/komorebi-for-mac" path)
# the Linux and macOS files of komorebic are not read when building for Windows
&& !(builtins.match ".*/komorebi(c/(src/(linux|macos)|tests/(linux|macos)_)|-client/(src/(linux|macos)\\.rs|tests/(linux|macos)_))[^/]*.*" path != null)
&& !(builtins.match ".*/komorebi(c/(src/(linux|macos)|tests/(linux|macos)_)|-client/(src/(linux|macos)\\.rs|tests/(linux|macos)_)|-bar/src/macos)[^/]*.*" path != null)
&& (
(craneLib.filterCargoSources path type)
|| (pkgs.lib.hasInfix "/docs/" path)
+26 -6
View File
@@ -5,10 +5,12 @@ edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
# What both platforms use is in [dependencies]; what only one uses, or uses in another version or with other
# features, is in the table of its target OS, so that a build for one compiles nothing of the other.
[dependencies]
komorebi-bar-core = { path = "../crates/komorebi-bar-core", default-features = false }
komorebi-client = { path = "../komorebi-client", default-features = false }
komorebi-themes = { path = "../komorebi-themes", default-features = false }
chrono-tz = { workspace = true }
chrono = { workspace = true }
@@ -19,33 +21,51 @@ dirs = { workspace = true }
dunce = { workspace = true }
eframe = { workspace = true }
egui-phosphor = { git = "https://github.com/amPerl/egui-phosphor", rev = "d13688738478ecd12b426e3e74c59d6577a85b59" }
egui_extras = { workspace = true }
font-loader = "0.11"
hotwatch = { workspace = true }
image = "0.25"
lazy_static = { workspace = true }
netdev = "0.46"
num = "0.4"
num-derive = "0.4"
num-traits = "0.2"
parking_lot = { workspace = true }
regex = "1"
random_word = { version = "0.5", features = ["en"] }
reqwest = { version = "0.12", features = ["blocking"] }
schemars = { workspace = true, optional = true }
serde = { workspace = true }
serde_json = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
[target.'cfg(windows)'.dependencies]
komorebi-themes = { path = "../komorebi-themes", default-features = false }
egui_extras = { workspace = true }
netdev = "0.46"
regex = "1"
sysinfo = { workspace = true }
systray-util = "0.2.0"
tokio = { version = "1", features = ["rt", "sync", "time"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
which = { workspace = true }
windows = { workspace = true }
windows-core = { workspace = true }
windows-icons = { git = "https://github.com/LGUG2Z/windows-icons", rev = "0c9d7ee1b807347c507d3a9862dd007b4d3f4354" }
windows-icons-fallback = { package = "windows-icons", git = "https://github.com/LGUG2Z/windows-icons", rev = "d67cc9920aa9b4883393e411fb4fa2ddd4c498b5" }
[target.'cfg(target_os = "macos")'.dependencies]
komorebi-themes = { path = "../komorebi-themes" }
icns = "0.4"
netdev = "0.40"
objc2 = { version = "0.6", default-features = false, features = ["std"] }
objc2-app-kit = { version = "0.3", default-features = false, features = [
"std",
"NSApplication",
"NSResponder",
"NSView",
"NSWindow",
] }
raw-window-handle = "0.6"
sysinfo = "0.38"
[features]
default = ["schemars"]
schemars = [
File renamed without changes.
@@ -127,7 +127,7 @@ pub fn main() -> eyre::Result<()> {
);
if opts.quickstart {
let komorebi_bar_json = include_str!("../../../docs/komorebi.bar.example.json").to_string();
let komorebi_bar_json = include_str!("../../../komorebi-for-mac/docs/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 {}",
@@ -148,7 +148,7 @@ pub fn main() -> eyre::Result<()> {
let mut config = match config_path {
None => {
let komorebi_bar_json =
include_str!("../../../docs/komorebi.bar.example.json").to_string();
include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json").to_string();
std::fs::write(&default_config_path, komorebi_bar_json)?;
tracing::info!(
File renamed without changes.
+13 -3
View File
@@ -1,7 +1,17 @@
//! `komorebi-bar`, the status bar of komorebi. The code of each platform is in a module of its own.
//! `komorebi-bar`, the status bar of komorebi, for Windows and macOS: the module of the target OS is
//! the bar, the code both share is in `komorebi-bar-core`.
mod windows;
cfg_select! {
target_os = "windows" => {
mod windows;
use windows as platform;
}
target_os = "macos" => {
mod macos;
use macos as platform;
}
}
fn main() -> color_eyre::Result<()> {
windows::main()
platform::main()
}
+13 -3
View File
@@ -83,8 +83,18 @@
"komorebi-client/src/macos.rs"
"komorebi-client/tests"
];
# the unified komorebi-bar package: its manifest, main.rs and the macOS module
komorebiBar =
builtins.elem relative [
"komorebi-bar"
"komorebi-bar/Cargo.toml"
"komorebi-bar/src"
"komorebi-bar/src/main.rs"
]
|| pkgs.lib.hasPrefix "komorebi-bar/src/macos" relative;
in
((rootCrate || komorebic || komorebiClient) && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || relative == "Cargo.lock" || inTree)
((rootCrate || komorebic || komorebiClient || komorebiBar) && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || relative == "Cargo.lock" || inTree)
&& (
(craneLib.filterCargoSources path type)
|| (pkgs.lib.hasInfix "/docs/" path)
@@ -103,9 +113,10 @@
pkgs.lib.hasPrefix "${platformDir}/" member
|| member == "komorebic"
|| member == "komorebi-client"
|| member == "komorebi-bar"
|| builtins.any (crate: member == crate || pkgs.lib.hasPrefix "${crate}/" member) rootCrates;
};
packages = "-p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar-macos";
packages = "-p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar";
workspaceArgs = {
pname = "komorebi-workspace";
inherit version;
@@ -253,7 +264,6 @@
"komorebi-windows"
"komorebi-gui"
"komorebic-no-console"
"komorebi-bar"
"komorebi-shortcuts"
"komorebi-e2e-agent"
"komorebi-testwin"
+3 -1
View File
@@ -1,5 +1,7 @@
//! `komorebi-bar` for macOS. The code is in the `macos` module.
//! `komorebi-bar-macos`: the macOS bar of the unified `komorebi-bar` package, kept under its old package
//! name until the cutover. The code is in `komorebi-bar/src/macos`.
#[path = "../../../komorebi-bar/src/macos/mod.rs"]
mod macos;
fn main() -> color_eyre::Result<()> {