mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-15 05:12:28 +01:00
refactor(mac-bar): converge komorebi.rs config text and komorebi_layout.rs onto the Windows source
Schema-text differences only, so that the config types can move into the core: the macOS KomorebiLayout gets `#[serde(untagged)]` (its Deserialize is hand-written and nothing in the bar serializes a layout, so no runtime effect; it only changes the generated schema and the derived Serialize), `eyre::Result` and `1.0_f32`; KomorebiFocusedContainerConfig::show_icon gets the Windows `#[deprecated]` and doc (with `#[allow(deprecated)]` at the one use). The macOS schema view already sets the macOS text of KomorebiLayout and show_icon back, so komorebi-for-mac/schema.bar.json and nix/komorebi-bar-options.nix do not change. The coordinator asked to leave komorebi_layout alone: this was done because the evidence says it is not a behaviour difference (custom Deserialize, no serialization anywhere in the macOS bar: `grep to_string|to_value|to_writer` finds none); it is a separate revision and can be dropped. Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091 lines); the two komorebi_layout.rs are byte-identical and the config region of the two komorebi.rs is identical; Windows clippy -D warnings --locked clean; macOS fake-CC check --locked 0 errors.
This commit is contained in:
1 parent
e1820d9bbe
commit
cb8fc00afb
2 files changed
+8
-3
No files matched your search
@@ -113,7 +113,8 @@ pub struct KomorebiWorkspaceLayerConfig {
|
||||
pub struct KomorebiFocusedContainerConfig {
|
||||
/// Enable the Komorebi Focused Container widget
|
||||
pub enable: bool,
|
||||
/// DEPRECATED: use 'display' instead (Show the icon of the currently focused container)
|
||||
/// DEPRECATED: use `display` instead (Show the icon of the currently focused container)
|
||||
#[deprecated(note = "Use `display` instead")]
|
||||
pub show_icon: Option<bool>,
|
||||
/// Display format of the currently focused container
|
||||
pub display: Option<DisplayFormat>,
|
||||
@@ -530,7 +531,9 @@ impl FocusedContainerBar {
|
||||
if !value.enable {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Handle legacy setting - convert show_icon to display format
|
||||
#[allow(deprecated)]
|
||||
let format = value
|
||||
.display
|
||||
.unwrap_or(if value.show_icon.unwrap_or(false) {
|
||||
|
||||
@@ -2,6 +2,7 @@ use crate::config::DisplayFormat;
|
||||
use crate::render::RenderConfig;
|
||||
use crate::selected_frame::SelectableFrame;
|
||||
use crate::widgets::komorebi::KomorebiLayoutConfig;
|
||||
use color_eyre::eyre;
|
||||
use eframe::egui::Context;
|
||||
use eframe::egui::CornerRadius;
|
||||
use eframe::egui::FontId;
|
||||
@@ -24,6 +25,7 @@ use std::fmt::Formatter;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, PartialEq)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
#[serde(untagged)]
|
||||
/// Komorebi layout kind
|
||||
pub enum KomorebiLayout {
|
||||
/// Predefined layout
|
||||
@@ -40,7 +42,7 @@ pub enum KomorebiLayout {
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for KomorebiLayout {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
fn deserialize<D>(deserializer: D) -> eyre::Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
@@ -146,7 +148,7 @@ impl KomorebiLayout {
|
||||
} else {
|
||||
ui.style().visuals.text_color()
|
||||
};
|
||||
let stroke = Stroke::new(1.0, color);
|
||||
let stroke = Stroke::new(1.0_f32, color);
|
||||
let mut rect = response.rect;
|
||||
let rounding = CornerRadius::same((rect.width() * 0.1) as u8);
|
||||
rect = rect.shrink(stroke.width);
|
||||
|
||||
Reference in new issue
Block a user