From e95d146bae23c2be0b67b8b8a11fb0b98881e8a3 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 16:32:49 -0700 Subject: [PATCH] style(macos): format the macOS code with the project's rustfmt settings Pure formatting, no other change: nightly rustfmt --edition 2024 with komorebi-for-mac/rustfmt.toml (imports_granularity = Item) over komorebi-for-mac/**/*.rs and the macOS modules in the shared directories komorebic/src/macos and komorebi-bar/src/macos. 11 files; the kfm fmt check of the previous revision reported them. Windows and KDE code is not touched, and the Windows source filter excludes those macos files, so no Windows or KDE derivation changes. Verified: the rustfmt --check command of the fmt check passes on the result locally; nix eval of drvPath in a throwaway git copy: Windows deps and clippy, kfde deps, clippy and vm stacks are identical before and after it. --- komorebi-bar/src/macos/mod.rs | 6 +++-- komorebi-bar/src/macos/widgets/komorebi.rs | 16 ++++++------ komorebi-bar/src/macos/widgets/mod.rs | 1 - komorebi-bar/src/macos/widgets/network.rs | 4 +-- komorebi-bar/src/macos/widgets/widget.rs | 2 +- .../komorebi/src/animation/mod.rs | 3 +-- komorebi-for-mac/komorebi/src/daemon.rs | 8 +++--- komorebi-for-mac/komorebi/src/lib.rs | 2 +- .../komorebi/src/static_config.rs | 26 ++++++++++--------- .../komorebi/src/window_manager.rs | 8 +++--- komorebic/src/macos/mod.rs | 6 +++-- 11 files changed, 44 insertions(+), 38 deletions(-) diff --git a/komorebi-bar/src/macos/mod.rs b/komorebi-bar/src/macos/mod.rs index 8808d49d..f4906b39 100644 --- a/komorebi-bar/src/macos/mod.rs +++ b/komorebi-bar/src/macos/mod.rs @@ -127,7 +127,8 @@ pub fn main() -> eyre::Result<()> { ); if opts.quickstart { - let komorebi_bar_json = include_str!("../../../komorebi-for-mac/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 +149,8 @@ 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!("../../../komorebi-for-mac/docs/komorebi.bar.example.json") + .to_string(); std::fs::write(&default_config_path, komorebi_bar_json)?; tracing::info!( diff --git a/komorebi-bar/src/macos/widgets/komorebi.rs b/komorebi-bar/src/macos/widgets/komorebi.rs index 25e6808d..3a6d2175 100644 --- a/komorebi-bar/src/macos/widgets/komorebi.rs +++ b/komorebi-bar/src/macos/widgets/komorebi.rs @@ -7,14 +7,6 @@ use crate::macos::config::WorkspacesDisplayFormat; use crate::macos::render::RenderConfig; use crate::macos::selected_frame::SelectableFrame; use crate::macos::ui::CustomUi; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfig; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfigurationSwitcherConfig; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiFocusedContainerConfig; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayoutConfig; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLockedContainerConfig; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspaceLayerConfig; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspacesConfig; -pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayout; use crate::macos::widgets::komorebi_layout::KomorebiLayoutExt; use crate::macos::widgets::widget::BarWidget; use eframe::egui::Align; @@ -39,6 +31,14 @@ use eframe::egui::vec2; use icns::IconFamily; use icns::IconType; use image::RgbaImage; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfigurationSwitcherConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiFocusedContainerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayout; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayoutConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLockedContainerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspaceLayerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspacesConfig; use komorebi_client::Container; use komorebi_client::PathExt; use komorebi_client::Rect; diff --git a/komorebi-bar/src/macos/widgets/mod.rs b/komorebi-bar/src/macos/widgets/mod.rs index a429e6b8..3f7ccbec 100644 --- a/komorebi-bar/src/macos/widgets/mod.rs +++ b/komorebi-bar/src/macos/widgets/mod.rs @@ -1,4 +1,3 @@ - pub use komorebi_bar_core::widgets::applications; pub use komorebi_bar_core::widgets::battery; pub use komorebi_bar_core::widgets::cpu; diff --git a/komorebi-bar/src/macos/widgets/network.rs b/komorebi-bar/src/macos/widgets/network.rs index fb7b4041..34438c7b 100644 --- a/komorebi-bar/src/macos/widgets/network.rs +++ b/komorebi-bar/src/macos/widgets/network.rs @@ -1,6 +1,4 @@ use crate::macos::bar::Alignment; -pub use komorebi_bar_core::widgets::network_config::NetworkConfig; -pub use komorebi_bar_core::widgets::network_config::NetworkSelectConfig; use crate::macos::config::LabelPrefix; use crate::macos::render::RenderConfig; use crate::macos::selected_frame::SelectableFrame; @@ -12,6 +10,8 @@ use eframe::egui::Label; use eframe::egui::TextFormat; use eframe::egui::Ui; use eframe::egui::text::LayoutJob; +pub use komorebi_bar_core::widgets::network_config::NetworkConfig; +pub use komorebi_bar_core::widgets::network_config::NetworkSelectConfig; use num_derive::FromPrimitive; use parking_lot::Mutex; use std::fmt; diff --git a/komorebi-bar/src/macos/widgets/widget.rs b/komorebi-bar/src/macos/widgets/widget.rs index e2d56474..21376f32 100644 --- a/komorebi-bar/src/macos/widgets/widget.rs +++ b/komorebi-bar/src/macos/widgets/widget.rs @@ -11,9 +11,9 @@ use crate::macos::widgets::update::Update; use eframe::egui::Context; use eframe::egui::Ui; +use komorebi_bar_core::render::RenderConfig; pub use komorebi_bar_core::widgets::widget::BarWidget; pub use komorebi_bar_core::widgets::widget::WidgetConfig; -use komorebi_bar_core::render::RenderConfig; /// Stands in for a widget that macOS cannot run; `WidgetConfig::enabled` is false for those, so /// this is never built from a configuration that the bar loads. diff --git a/komorebi-for-mac/komorebi/src/animation/mod.rs b/komorebi-for-mac/komorebi/src/animation/mod.rs index 1213a6d6..76c8c6a6 100644 --- a/komorebi-for-mac/komorebi/src/animation/mod.rs +++ b/komorebi-for-mac/komorebi/src/animation/mod.rs @@ -1,8 +1,8 @@ use crate::core::animation::AnimationStyle; +pub use komorebi_config::animation::PerAnimationPrefixConfig; use parking_lot::Mutex; pub use prefix::AnimationPrefix; -pub use komorebi_config::animation::PerAnimationPrefixConfig; use std::collections::HashMap; use std::sync::Arc; use std::sync::LazyLock; @@ -26,7 +26,6 @@ pub mod tracks; pub mod transition; pub mod workspace_transition; - pub const DEFAULT_ANIMATION_ENABLED: bool = false; pub const DEFAULT_ANIMATION_STYLE: AnimationStyle = AnimationStyle::Linear; pub const DEFAULT_ANIMATION_DURATION: u64 = 250; diff --git a/komorebi-for-mac/komorebi/src/daemon.rs b/komorebi-for-mac/komorebi/src/daemon.rs index fc1505b5..7e25a647 100644 --- a/komorebi-for-mac/komorebi/src/daemon.rs +++ b/komorebi-for-mac/komorebi/src/daemon.rs @@ -1,9 +1,5 @@ #![warn(clippy::all)] -use clap::Parser; -use clap::ValueEnum; -use color_eyre::eyre; -use color_eyre::eyre::OptionExt; use crate::CoreFoundationRunLoop; use crate::DATA_DIR; use crate::HOME_DIR; @@ -24,6 +20,10 @@ use crate::theme_manager; use crate::window_manager::WindowManager; use crate::window_manager_event_listener; use crate::workspace_reconciliator; +use clap::Parser; +use clap::ValueEnum; +use color_eyre::eyre; +use color_eyre::eyre::OptionExt; use objc2::MainThreadMarker; use objc2::rc::autoreleasepool; use objc2_app_kit::NSApplication; diff --git a/komorebi-for-mac/komorebi/src/lib.rs b/komorebi-for-mac/komorebi/src/lib.rs index df046e82..e91cca6c 100644 --- a/komorebi-for-mac/komorebi/src/lib.rs +++ b/komorebi-for-mac/komorebi/src/lib.rs @@ -43,7 +43,6 @@ extern crate komorebi_collections; pub use komorebi_collections::ring; -pub mod daemon; pub mod accessibility; pub mod animation; pub mod app_kit_notification_constants; @@ -54,6 +53,7 @@ pub mod border_manager; pub mod container; pub mod core; pub mod core_graphics; +pub mod daemon; pub mod display_reconfiguration_listener; pub mod input_event_listener; pub mod ioreg; diff --git a/komorebi-for-mac/komorebi/src/static_config.rs b/komorebi-for-mac/komorebi/src/static_config.rs index 018cf428..e45c44b5 100644 --- a/komorebi-for-mac/komorebi/src/static_config.rs +++ b/komorebi-for-mac/komorebi/src/static_config.rs @@ -1,4 +1,3 @@ -use komorebi_settings::shared::SharedDelta; use crate::CoreFoundationRunLoop; use crate::DATA_DIR; use crate::DEFAULT_MOUSE_FOLLOWS_FOCUS; @@ -50,6 +49,7 @@ use color_eyre::eyre; use crossbeam_channel::Receiver; use hotwatch::EventKind; use hotwatch::Hotwatch; +use komorebi_settings::shared::SharedDelta; use komorebi_themes::colour::Colour; use objc2_core_foundation::CFRetained; use objc2_core_foundation::CFRunLoop; @@ -332,12 +332,8 @@ impl From<&WindowManager> for StaticConfig { // border_style: Option::from(STYLE.load()), // border_z_order: None, // border_implementation: Option::from(IMPLEMENTATION.load()), - default_workspace_padding: Option::from( - crate::settings::workspace_padding(), - ), - default_container_padding: Option::from( - crate::settings::container_padding(), - ), + default_workspace_padding: Option::from(crate::settings::workspace_padding()), + default_container_padding: Option::from(crate::settings::container_padding()), layout_defaults: { let guard = crate::settings::layout_defaults(); if guard.is_empty() { @@ -369,7 +365,9 @@ impl From<&WindowManager> for StaticConfig { // slow_application_identifiers: Option::from(SLOW_APPLICATION_IDENTIFIERS.lock().clone()), // bar_configurations: None, // remove_titlebar_applications: Option::from(NO_TITLEBAR.lock().clone()), - floating_window_aspect_ratio: Option::from(crate::settings::floating_window_aspect_ratio()), + floating_window_aspect_ratio: Option::from( + crate::settings::floating_window_aspect_ratio(), + ), // window_handling_behaviour: Option::from(WINDOW_HANDLING_BEHAVIOUR.load()), tabbed_applications: None, ..Default::default() @@ -823,8 +821,10 @@ impl StaticConfigExt for StaticConfig { let mut value = Self::read(path)?; let mut wm = wm.lock(); - let configs_with_preference: Vec<_> = - crate::settings::display_index_preferences().keys().copied().collect(); + let configs_with_preference: Vec<_> = crate::settings::display_index_preferences() + .keys() + .copied() + .collect(); let mut configs_used = Vec::new(); let mut workspace_matching_rules = WORKSPACE_MATCHING_RULES.lock(); @@ -986,8 +986,10 @@ impl StaticConfigExt for StaticConfig { value.apply_globals()?; - let configs_with_preference: Vec<_> = - crate::settings::display_index_preferences().keys().copied().collect(); + let configs_with_preference: Vec<_> = crate::settings::display_index_preferences() + .keys() + .copied() + .collect(); let mut configs_used = Vec::new(); let mut workspace_matching_rules = WORKSPACE_MATCHING_RULES.lock(); diff --git a/komorebi-for-mac/komorebi/src/window_manager.rs b/komorebi-for-mac/komorebi/src/window_manager.rs index 2f3f0471..20e416a4 100644 --- a/komorebi-for-mac/komorebi/src/window_manager.rs +++ b/komorebi-for-mac/komorebi/src/window_manager.rs @@ -1,4 +1,3 @@ -use crate::monitor::MonitorExt; use crate::AccessibilityUiElement; use crate::CoreFoundationRunLoop; use crate::DATA_DIR; @@ -41,6 +40,7 @@ use crate::current_space_id; use crate::lockable_sequence::Lockable; use crate::macos_api::MacosApi; use crate::monitor::Monitor; +use crate::monitor::MonitorExt; use crate::pan::Pan; use crate::ring::Ring; use crate::scrolling::WorkspaceScrolling; @@ -1548,7 +1548,8 @@ impl WindowManager { let hiding_position = self .focused_monitor() .ok_or_eyre("there is no monitor")? - .extra.window_hiding_position; + .extra + .window_hiding_position; let workspace = self.focused_workspace_mut()?; workspace.new_monocle_container()?; @@ -1584,7 +1585,8 @@ impl WindowManager { let hiding_position = self .focused_monitor() .ok_or_eyre("there is no monitor")? - .extra.window_hiding_position; + .extra + .window_hiding_position; self.focused_workspace_mut()? .cycle_monocle_container(direction)?; diff --git a/komorebic/src/macos/mod.rs b/komorebic/src/macos/mod.rs index d85b6767..24ad84a3 100644 --- a/komorebic/src/macos/mod.rs +++ b/komorebic/src/macos/mod.rs @@ -278,9 +278,11 @@ 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!("../../../komorebi-for-mac/docs/komorebi.example.json") + .to_string(); let komorebi_bar_json = - include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json").to_string(); + include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json") + .to_string(); if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() { komorebi_json =