mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Move ColumnDisplay to niri-ipc
This commit is contained in:
+3
-13
@@ -14,7 +14,7 @@ use knuffel::Decode as _;
|
||||
use layer_rule::LayerRule;
|
||||
use miette::{miette, Context, IntoDiagnostic, NarratableReportHandler};
|
||||
use niri_ipc::{
|
||||
ConfiguredMode, LayoutSwitchTarget, PositionChange, SizeChange, Transform,
|
||||
ColumnDisplay, ConfiguredMode, LayoutSwitchTarget, PositionChange, SizeChange, Transform,
|
||||
WorkspaceReferenceArg,
|
||||
};
|
||||
use smithay::backend::renderer::Color32F;
|
||||
@@ -458,7 +458,7 @@ pub struct Layout {
|
||||
pub always_center_single_column: bool,
|
||||
#[knuffel(child)]
|
||||
pub empty_workspace_above_first: bool,
|
||||
#[knuffel(child, unwrap(argument), default)]
|
||||
#[knuffel(child, unwrap(argument, str), default = Self::default().default_column_display)]
|
||||
pub default_column_display: ColumnDisplay,
|
||||
#[knuffel(child, unwrap(argument), default = Self::default().gaps)]
|
||||
pub gaps: FloatOrInt<0, 65535>,
|
||||
@@ -478,7 +478,7 @@ impl Default for Layout {
|
||||
center_focused_column: Default::default(),
|
||||
always_center_single_column: false,
|
||||
empty_workspace_above_first: false,
|
||||
default_column_display: Default::default(),
|
||||
default_column_display: ColumnDisplay::Normal,
|
||||
gaps: FloatOrInt(16.),
|
||||
struts: Default::default(),
|
||||
preset_window_heights: Default::default(),
|
||||
@@ -797,16 +797,6 @@ impl From<PresetSize> for SizeChange {
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct DefaultPresetSize(pub Option<PresetSize>);
|
||||
|
||||
/// How windows display in a column.
|
||||
#[derive(knuffel::DecodeScalar, Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ColumnDisplay {
|
||||
/// Windows arranged vertically, spread across the working area height.
|
||||
#[default]
|
||||
Normal,
|
||||
/// Windows are in tabs.
|
||||
Tabbed,
|
||||
}
|
||||
|
||||
#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq)]
|
||||
pub struct Struts {
|
||||
#[knuffel(child, unwrap(argument), default)]
|
||||
|
||||
@@ -690,6 +690,16 @@ pub enum LayoutSwitchTarget {
|
||||
Index(u8),
|
||||
}
|
||||
|
||||
/// How windows display in a column.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
pub enum ColumnDisplay {
|
||||
/// Windows are tiled vertically across the working area height.
|
||||
Normal,
|
||||
/// Windows are in tabs.
|
||||
Tabbed,
|
||||
}
|
||||
|
||||
/// Output actions that niri can perform.
|
||||
// Variants in this enum should match the spelling of the ones in niri-config. Most thigs from
|
||||
// niri-config should be present here.
|
||||
@@ -1202,6 +1212,18 @@ impl FromStr for LayoutSwitchTarget {
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for ColumnDisplay {
|
||||
type Err = &'static str;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"normal" => Ok(Self::Normal),
|
||||
"tabbed" => Ok(Self::Tabbed),
|
||||
_ => Err(r#"invalid column display, can be "normal" or "tabbed""#),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Transform {
|
||||
type Err = &'static str;
|
||||
|
||||
|
||||
+3
-3
@@ -39,10 +39,10 @@ use std::time::Duration;
|
||||
|
||||
use monitor::MonitorAddWindowTarget;
|
||||
use niri_config::{
|
||||
CenterFocusedColumn, ColumnDisplay, Config, CornerRadius, FloatOrInt, PresetSize, Struts,
|
||||
CenterFocusedColumn, Config, CornerRadius, FloatOrInt, PresetSize, Struts,
|
||||
Workspace as WorkspaceConfig, WorkspaceReference,
|
||||
};
|
||||
use niri_ipc::{PositionChange, SizeChange};
|
||||
use niri_ipc::{ColumnDisplay, PositionChange, SizeChange};
|
||||
use scrolling::{Column, ColumnWidth, InsertHint, InsertPosition};
|
||||
use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement;
|
||||
use smithay::backend::renderer::element::Id;
|
||||
@@ -341,7 +341,7 @@ impl Default for Options {
|
||||
center_focused_column: Default::default(),
|
||||
always_center_single_column: false,
|
||||
empty_workspace_above_first: false,
|
||||
default_column_display: Default::default(),
|
||||
default_column_display: ColumnDisplay::Normal,
|
||||
preset_column_widths: vec![
|
||||
PresetSize::Proportion(1. / 3.),
|
||||
PresetSize::Proportion(0.5),
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::iter::{self, zip};
|
||||
use std::rc::Rc;
|
||||
use std::time::Duration;
|
||||
|
||||
use niri_config::{CenterFocusedColumn, ColumnDisplay, CornerRadius, PresetSize, Struts};
|
||||
use niri_ipc::SizeChange;
|
||||
use niri_config::{CenterFocusedColumn, CornerRadius, PresetSize, Struts};
|
||||
use niri_ipc::{ColumnDisplay, SizeChange};
|
||||
use ordered_float::NotNan;
|
||||
use smithay::backend::renderer::gles::GlesRenderer;
|
||||
use smithay::utils::{Logical, Point, Rectangle, Scale, Serial, Size};
|
||||
|
||||
Reference in New Issue
Block a user