mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 05:41:16 +01:00
chore(repo): merge the kfm clippy fixes into the package migration line
wip-u-kfm carries the macOS clippy fixes (&Path, drain, filter, slice fill, sort_by_key, collapsible_match allows, capture_spike, bar stroke literals). The bar stroke literal revision touches komorebi-for-mac/komorebi-bar, which the migration moved to komorebi-bar/src/macos; conflicts are resolved here by applying the same edit at the new paths.
This commit is contained in:
commit
072ba7a471
10 files changed
+318
-24
No files matched your search
@@ -617,7 +617,7 @@ impl StaticConfig {
|
||||
/// # Errors
|
||||
///
|
||||
/// The file cannot be read, or it is not a configuration.
|
||||
pub fn read(path: &PathBuf) -> color_eyre::Result<Self> {
|
||||
pub fn read(path: &std::path::Path) -> color_eyre::Result<Self> {
|
||||
let content = std::fs::read_to_string(path)?;
|
||||
serde_json::from_str(&content).map_err(Into::into)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ Status: written by the `kfm` agent for the user, 2026-10-31. Nothing here has be
|
||||
|
||||
How to use it: build the unified (or, until they exist, the per-tree) macOS `komorebi`, `komorebic` and `komorebi-bar`, run `cargo test --workspace` on the Mac first (the 399+ unit tests have never run against these changes), then walk the sections in order. For before/after capture use `komorebi-recorder` against a build of the baseline `wip-main` ancestor `ff3711dc` and the tip. A section is done when the "look for" column is true.
|
||||
|
||||
## Status of the Mini runs (2026-10-31)
|
||||
|
||||
The real-Mac runs so far (Mac Mini, rustc and clippy 1.93, tip a35573d8) are **compile and unit tests only**: `cargo test --workspace` in komorebi-for-mac passed (daemon 366 passed, 1 ignored; 368 total, 0 failed) and clippy `-D warnings` was clean apart from the two items fixed afterwards. Nothing was run as a daemon: no focus, tiling, borders, animations or bar rendering has been observed on the Mini. Every walk-through item below is still open.
|
||||
|
||||
## A. Revisions that change what the daemon does (BEHAVIOUR)
|
||||
|
||||
| Revision | What changed | Look for on a Mac |
|
||||
|
||||
@@ -561,7 +561,7 @@ impl WorkspaceLayerBar {
|
||||
if matches!(layer, WorkspaceLayer::Tiling) {
|
||||
let (response, painter) = ui.allocate_painter(size, Sense::hover());
|
||||
let color = ctx.style().visuals.selection.stroke.color;
|
||||
let stroke = Stroke::new(1.0, color);
|
||||
let stroke = Stroke::new(1.0_f32, color);
|
||||
let mut rect = response.rect;
|
||||
let corner = CornerRadius::same((rect.width() * 0.1) as u8);
|
||||
rect = rect.shrink(stroke.width);
|
||||
@@ -584,7 +584,7 @@ impl WorkspaceLayerBar {
|
||||
} else {
|
||||
let (response, painter) = ui.allocate_painter(size, Sense::hover());
|
||||
let color = ctx.style().visuals.selection.stroke.color;
|
||||
let stroke = Stroke::new(1.0, color);
|
||||
let stroke = Stroke::new(1.0_f32, color);
|
||||
let mut rect = response.rect;
|
||||
let corner = CornerRadius::same((rect.width() * 0.1) as u8);
|
||||
rect = rect.shrink(stroke.width);
|
||||
|
||||
@@ -86,6 +86,7 @@ use std::io::ErrorKind;
|
||||
use std::io::Write;
|
||||
use std::os::unix::net::UnixListener;
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
@@ -723,16 +724,16 @@ impl ApplyGlobals for StaticConfig {
|
||||
pub trait StaticConfigExt: Sized {
|
||||
/// Makes the window manager from the file at `path`, and starts watching the file
|
||||
fn preload(
|
||||
path: &PathBuf,
|
||||
path: &Path,
|
||||
incoming: Receiver<WindowManagerEvent>,
|
||||
unix_listener: Option<UnixListener>,
|
||||
) -> eyre::Result<WindowManager>;
|
||||
|
||||
/// Gives the monitors of the window manager what the file says about them
|
||||
fn postload(path: &PathBuf, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()>;
|
||||
fn postload(path: &Path, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()>;
|
||||
|
||||
/// Replaces the configuration of the window manager with the file at `path`
|
||||
fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()>;
|
||||
fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()>;
|
||||
}
|
||||
|
||||
impl StaticConfigExt for StaticConfig {
|
||||
@@ -755,7 +756,7 @@ impl StaticConfigExt for StaticConfig {
|
||||
/// - The file cannot be watched.
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn preload(
|
||||
path: &PathBuf,
|
||||
path: &Path,
|
||||
incoming: Receiver<WindowManagerEvent>,
|
||||
unix_listener: Option<UnixListener>,
|
||||
) -> eyre::Result<WindowManager> {
|
||||
@@ -830,7 +831,7 @@ impl StaticConfigExt for StaticConfig {
|
||||
known_window_ids: HashMap::new(),
|
||||
};
|
||||
|
||||
let bytes = SocketMessage::ReloadStaticConfiguration(path.clone()).as_bytes()?;
|
||||
let bytes = SocketMessage::ReloadStaticConfiguration(path.to_path_buf()).as_bytes()?;
|
||||
|
||||
wm.hotwatch.watch(path, move |event| match event.kind {
|
||||
// an editor either writes the file in place or replaces it with a new one, which is a
|
||||
@@ -860,7 +861,7 @@ impl StaticConfigExt for StaticConfig {
|
||||
/// # Errors
|
||||
///
|
||||
/// The file cannot be read or is not a configuration ([`StaticConfig::read`]).
|
||||
fn postload(path: &PathBuf, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()> {
|
||||
fn postload(path: &Path, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()> {
|
||||
let mut value = Self::read(path)?;
|
||||
let mut wm = wm.lock();
|
||||
|
||||
@@ -1036,7 +1037,7 @@ impl StaticConfigExt for StaticConfig {
|
||||
/// - The file cannot be read or is not a configuration ([`StaticConfig::read`]); nothing has
|
||||
/// changed then.
|
||||
/// - A rule has a regular expression that is not valid; the settings before it have changed.
|
||||
fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()> {
|
||||
fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()> {
|
||||
let mut value = Self::read(path)?;
|
||||
|
||||
value.apply_globals()?;
|
||||
|
||||
@@ -46,7 +46,8 @@ fn sample(data: &CFData) -> (f64, f64) {
|
||||
let bytes = data.to_vec();
|
||||
let (mut total, mut visible, mut lit) = (0usize, 0usize, 0usize);
|
||||
|
||||
for pixel in bytes.chunks_exact(4).step_by(37) {
|
||||
// a trailing partial pixel (a buffer that is not a multiple of 4) is dropped, as chunks_exact did
|
||||
for pixel in bytes.chunks(4).filter(|pixel| pixel.len() == 4).step_by(37) {
|
||||
total += 1;
|
||||
if pixel[3] > 0 {
|
||||
visible += 1;
|
||||
|
||||
@@ -467,6 +467,7 @@ impl Monitor {
|
||||
workspace.add_container_to_front(container);
|
||||
}
|
||||
DefaultLayout::UltrawideVerticalStack => {
|
||||
#[allow(clippy::collapsible_match)] // the outer match has one arm per layout; collapsing would restructure it
|
||||
if workspace.containers().len() == 1 {
|
||||
workspace.insert_container_at_idx(0, container);
|
||||
} else {
|
||||
@@ -489,6 +490,7 @@ impl Monitor {
|
||||
match layout {
|
||||
DefaultLayout::RightMainVerticalStack
|
||||
| DefaultLayout::UltrawideVerticalStack => {
|
||||
#[allow(clippy::collapsible_match)] // the outer match has one arm per layout; collapsing would restructure it
|
||||
if workspace.containers().len() == 1 {
|
||||
workspace.add_container_to_back(container);
|
||||
} else {
|
||||
@@ -577,7 +579,7 @@ impl Monitor {
|
||||
}
|
||||
|
||||
pub fn remove_workspaces(&mut self) -> VecDeque<Workspace> {
|
||||
self.workspaces_mut().drain(..).collect()
|
||||
std::mem::take(self.workspaces_mut())
|
||||
}
|
||||
|
||||
pub fn ensure_workspace_count(&mut self, ensure_count: usize) {
|
||||
|
||||
@@ -64,6 +64,7 @@ use std::io::ErrorKind;
|
||||
use std::io::Write;
|
||||
use std::os::unix::net::UnixListener;
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
@@ -716,23 +717,23 @@ impl ApplyGlobals for StaticConfig {
|
||||
pub trait StaticConfigExt: Sized {
|
||||
/// Makes the window manager from the file at `path`, and starts watching the file
|
||||
fn preload(
|
||||
path: &PathBuf,
|
||||
path: &Path,
|
||||
incoming: Receiver<WindowManagerEvent>,
|
||||
unix_listener: Option<UnixListener>,
|
||||
run_loop: &CFRetained<CFRunLoop>,
|
||||
) -> eyre::Result<WindowManager>;
|
||||
|
||||
/// Gives the monitors of the window manager what the file says about them
|
||||
fn postload(path: &PathBuf, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()>;
|
||||
fn postload(path: &Path, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()>;
|
||||
|
||||
/// Replaces the configuration of the window manager with the file at `path`
|
||||
fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()>;
|
||||
fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()>;
|
||||
}
|
||||
|
||||
impl StaticConfigExt for StaticConfig {
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn preload(
|
||||
path: &PathBuf,
|
||||
path: &Path,
|
||||
incoming: Receiver<WindowManagerEvent>,
|
||||
unix_listener: Option<UnixListener>,
|
||||
run_loop: &CFRetained<CFRunLoop>,
|
||||
@@ -811,7 +812,7 @@ impl StaticConfigExt for StaticConfig {
|
||||
known_window_ids: HashMap::new(),
|
||||
};
|
||||
|
||||
let bytes = SocketMessage::ReloadStaticConfiguration(path.clone()).as_bytes()?;
|
||||
let bytes = SocketMessage::ReloadStaticConfiguration(path.to_path_buf()).as_bytes()?;
|
||||
|
||||
wm.hotwatch.watch(path, move |event| match event.kind {
|
||||
// Editing in Notepad sends a NoticeWrite while editing in (Neo)Vim sends
|
||||
@@ -830,7 +831,7 @@ impl StaticConfigExt for StaticConfig {
|
||||
Ok(wm)
|
||||
}
|
||||
|
||||
fn postload(path: &PathBuf, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()> {
|
||||
fn postload(path: &Path, wm: &Arc<Mutex<WindowManager>>) -> eyre::Result<()> {
|
||||
let mut value = Self::read(path)?;
|
||||
let mut wm = wm.lock();
|
||||
|
||||
@@ -992,7 +993,7 @@ impl StaticConfigExt for StaticConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()> {
|
||||
fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()> {
|
||||
let mut value = Self::read(path)?;
|
||||
|
||||
value.apply_globals()?;
|
||||
@@ -1255,6 +1256,7 @@ fn handle_asc_file(
|
||||
match path.extension() {
|
||||
None => {}
|
||||
Some(ext) => {
|
||||
#[allow(clippy::collapsible_match)] // collapsing the nested if into a guard would restructure a 40-line block
|
||||
if ext.to_string_lossy().to_string().as_str() == "json" {
|
||||
tracing::info!("loading applications.json from: {}", path.display());
|
||||
let mut asc = ApplicationSpecificConfiguration::load(path)?;
|
||||
|
||||
@@ -1587,7 +1587,7 @@ impl From<&CFDictionary> for WindowInfo {
|
||||
Self {
|
||||
name: cf_dictionary_value::<CFString>(value, kCGWindowName)
|
||||
.map(|s| s.as_ref().to_string())
|
||||
.and_then(|s| if s.is_empty() { None } else { Some(s) }),
|
||||
.filter(|s| !s.is_empty()),
|
||||
owner_pid: cf_dictionary_value::<CFNumber>(value, kCGWindowOwnerPID)
|
||||
.and_then(|s| s.as_ref().as_i32())
|
||||
.expect("window must have an owner process id"),
|
||||
|
||||
@@ -2265,9 +2265,7 @@ impl WindowManager {
|
||||
|
||||
// Reset any resize adjustments if we want to force a retile
|
||||
if !preserve_resize_dimensions {
|
||||
for resize in &mut workspace.resize_dimensions {
|
||||
*resize = None;
|
||||
}
|
||||
workspace.resize_dimensions.fill(None);
|
||||
|
||||
// and the widths and heights of the Scrolling layout, which are resize
|
||||
// adjustments too
|
||||
@@ -3517,7 +3515,7 @@ impl WindowManager {
|
||||
let rules: &mut Vec<(usize, Layout)> = &mut workspace.layout_rules;
|
||||
rules.retain(|pair| pair.0 != at_container_count);
|
||||
rules.push((at_container_count, Layout::Default(layout)));
|
||||
rules.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
rules.sort_by_key(|a| a.0);
|
||||
|
||||
// If this is the focused workspace on a non-focused screen, let's update it
|
||||
if focused_monitor_idx != monitor_idx && focused_workspace_idx == workspace_idx {
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi-for-mac/master/schema.asc.json",
|
||||
"Archive Utility": {
|
||||
"ignore": [
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Archive Utility",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cloudflare Warp": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Updater",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Cloudflare WARP",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Updating Cloudflare WARP",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Control Center": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Control Center",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Discord": {
|
||||
"ignore": [
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Discord",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "DiscordUpdater",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Finder": {
|
||||
"tabbed": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Finder",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Finder",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Info",
|
||||
"matching_strategy": "EndsWith"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Finder",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Copy",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ghostty": {
|
||||
"tabbed": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Ghostty",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
],
|
||||
"titleless": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Ghostty",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Installer": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Installer",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"MobileDeviceUpdater": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "MobileDeviceUpdater",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Notification Center": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Notification Center",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Photos": {
|
||||
"titleless": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Photos",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"RustRover": {
|
||||
"ignore": [
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "java",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Update",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "RustRover",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "–",
|
||||
"matching_strategy": "DoesNotContain"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"SecurityAgent": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "SecurityAgent",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"System Information": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "System Information",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"System Settings": {
|
||||
"ignore": [
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "System Settings",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Tailscale": {
|
||||
"ignore": [
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Tailscale",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Software Update",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Tailscale",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Updating Tailscale",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Zed": {
|
||||
"ignore": [
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Zed",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Open",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Zen": {
|
||||
"ignore": [
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Zen",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "File Upload",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Zen",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Enter name of file to save to",
|
||||
"matching_strategy": "StartsWith"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"kind": "Exe",
|
||||
"id": "Zen",
|
||||
"matching_strategy": "Equals"
|
||||
},
|
||||
{
|
||||
"kind": "Title",
|
||||
"id": "Picture-in-Picture",
|
||||
"matching_strategy": "Equals"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user