mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Move config into a separate crate
Get miette and knuffel deps contained within.
This commit is contained in:
Generated
+13
-2
@@ -1704,11 +1704,10 @@ dependencies = [
|
|||||||
"directories",
|
"directories",
|
||||||
"git-version",
|
"git-version",
|
||||||
"keyframe",
|
"keyframe",
|
||||||
"knuffel",
|
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"logind-zbus",
|
"logind-zbus",
|
||||||
"miette",
|
"niri-config",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
"pipewire",
|
"pipewire",
|
||||||
"png",
|
"png",
|
||||||
@@ -1728,6 +1727,18 @@ dependencies = [
|
|||||||
"zbus",
|
"zbus",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "niri-config"
|
||||||
|
version = "0.1.0-alpha.3"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.4.1",
|
||||||
|
"directories",
|
||||||
|
"knuffel",
|
||||||
|
"miette",
|
||||||
|
"smithay",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.26.4"
|
version = "0.26.4"
|
||||||
|
|||||||
+29
-13
@@ -1,13 +1,35 @@
|
|||||||
[package]
|
[workspace.package]
|
||||||
name = "niri"
|
|
||||||
version = "0.1.0-alpha.3"
|
version = "0.1.0-alpha.3"
|
||||||
description = "A scrollable-tiling Wayland compositor"
|
description = "A scrollable-tiling Wayland compositor"
|
||||||
authors = ["Ivan Molodetskikh <yalterz@gmail.com>"]
|
authors = ["Ivan Molodetskikh <yalterz@gmail.com>"]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
repository = "https://github.com/YaLTeR/niri"
|
||||||
|
|
||||||
|
[workspace.dependencies]
|
||||||
|
bitflags = "2.4.1"
|
||||||
|
directories = "5.0.1"
|
||||||
|
tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] }
|
||||||
|
|
||||||
|
[workspace.dependencies.smithay]
|
||||||
|
git = "https://github.com/Smithay/smithay.git"
|
||||||
|
# path = "../smithay"
|
||||||
|
default-features = false
|
||||||
|
|
||||||
|
[workspace.dependencies.smithay-drm-extras]
|
||||||
|
git = "https://github.com/Smithay/smithay.git"
|
||||||
|
# path = "../smithay/smithay-drm-extras"
|
||||||
|
|
||||||
|
[package]
|
||||||
|
name = "niri"
|
||||||
|
version.workspace = true
|
||||||
|
description.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/YaLTeR/niri"
|
|
||||||
keywords = ["wayland", "compositor", "tiling", "smithay", "wm"]
|
keywords = ["wayland", "compositor", "tiling", "smithay", "wm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -20,29 +42,27 @@ clap = { version = "4.4.13", features = ["derive"] }
|
|||||||
directories = "5.0.1"
|
directories = "5.0.1"
|
||||||
git-version = "0.3.9"
|
git-version = "0.3.9"
|
||||||
keyframe = { version = "1.1.1", default-features = false }
|
keyframe = { version = "1.1.1", default-features = false }
|
||||||
knuffel = "3.2.0"
|
|
||||||
libc = "0.2.151"
|
libc = "0.2.151"
|
||||||
logind-zbus = { version = "3.1.2", optional = true }
|
logind-zbus = { version = "3.1.2", optional = true }
|
||||||
log = { version = "0.4.20", features = ["max_level_trace", "release_max_level_debug"] }
|
log = { version = "0.4.20", features = ["max_level_trace", "release_max_level_debug"] }
|
||||||
miette = "5.10.0"
|
niri-config = { version = "0.1.0-alpha.3", path = "niri-config" }
|
||||||
notify-rust = { version = "4.10.0", optional = true }
|
notify-rust = { version = "4.10.0", optional = true }
|
||||||
pipewire = { version = "0.7.2", optional = true }
|
pipewire = { version = "0.7.2", optional = true }
|
||||||
png = "0.17.10"
|
png = "0.17.10"
|
||||||
portable-atomic = { version = "1.6.0", default-features = false, features = ["float"] }
|
portable-atomic = { version = "1.6.0", default-features = false, features = ["float"] }
|
||||||
profiling = "1.0.13"
|
profiling = "1.0.13"
|
||||||
sd-notify = "0.4.1"
|
sd-notify = "0.4.1"
|
||||||
|
smithay-drm-extras.workspace = true
|
||||||
serde = { version = "1.0.195", features = ["derive"] }
|
serde = { version = "1.0.195", features = ["derive"] }
|
||||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||||
tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] }
|
tracing.workspace = true
|
||||||
tracy-client = { version = "0.16.5", default-features = false }
|
tracy-client = { version = "0.16.5", default-features = false }
|
||||||
url = { version = "2.5.0", optional = true }
|
url = { version = "2.5.0", optional = true }
|
||||||
xcursor = "0.3.5"
|
xcursor = "0.3.5"
|
||||||
zbus = { version = "3.14.1", optional = true }
|
zbus = { version = "3.14.1", optional = true }
|
||||||
|
|
||||||
[dependencies.smithay]
|
[dependencies.smithay]
|
||||||
git = "https://github.com/Smithay/smithay.git"
|
workspace = true
|
||||||
# path = "../smithay"
|
|
||||||
default-features = false
|
|
||||||
features = [
|
features = [
|
||||||
"backend_drm",
|
"backend_drm",
|
||||||
"backend_egl",
|
"backend_egl",
|
||||||
@@ -58,10 +78,6 @@ features = [
|
|||||||
"wayland_frontend",
|
"wayland_frontend",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies.smithay-drm-extras]
|
|
||||||
git = "https://github.com/Smithay/smithay.git"
|
|
||||||
# path = "../smithay/smithay-drm-extras"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
proptest = "1.4.0"
|
proptest = "1.4.0"
|
||||||
proptest-derive = "0.4.0"
|
proptest-derive = "0.4.0"
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
name = "niri-config"
|
||||||
|
version.workspace = true
|
||||||
|
description.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bitflags.workspace = true
|
||||||
|
directories.workspace = true
|
||||||
|
knuffel = "3.2.0"
|
||||||
|
miette = "5.10.0"
|
||||||
|
smithay.workspace = true
|
||||||
|
tracing.workspace = true
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
|
#[macro_use]
|
||||||
|
extern crate tracing;
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
use directories::ProjectDirs;
|
use directories::ProjectDirs;
|
||||||
use miette::{miette, Context, IntoDiagnostic};
|
use miette::{miette, Context, IntoDiagnostic, NarratableReportHandler};
|
||||||
use smithay::input::keyboard::keysyms::KEY_NoSymbol;
|
use smithay::input::keyboard::keysyms::KEY_NoSymbol;
|
||||||
use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE};
|
use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE};
|
||||||
use smithay::input::keyboard::{Keysym, XkbConfig};
|
use smithay::input::keyboard::{Keysym, XkbConfig};
|
||||||
@@ -407,6 +410,10 @@ impl Default for DebugConfig {
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn load(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
|
pub fn load(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
|
||||||
|
Self::load_internal(path).context("error loading config")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load_internal(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
|
||||||
let path = if let Some(path) = path {
|
let path = if let Some(path) = path {
|
||||||
path
|
path
|
||||||
} else {
|
} else {
|
||||||
@@ -436,7 +443,7 @@ impl Default for Config {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Config::parse(
|
Config::parse(
|
||||||
"default-config.kdl",
|
"default-config.kdl",
|
||||||
include_str!("../resources/default-config.kdl"),
|
include_str!("../../resources/default-config.kdl"),
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
@@ -564,6 +571,10 @@ impl FromStr for SizeChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_miette_hook() -> Result<(), miette::InstallError> {
|
||||||
|
miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new())))
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use miette::NarratableReportHandler;
|
use miette::NarratableReportHandler;
|
||||||
+1
-1
@@ -9,6 +9,7 @@ use std::{io, mem};
|
|||||||
|
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use libc::dev_t;
|
use libc::dev_t;
|
||||||
|
use niri_config::Config;
|
||||||
use smithay::backend::allocator::dmabuf::{Dmabuf, DmabufAllocator};
|
use smithay::backend::allocator::dmabuf::{Dmabuf, DmabufAllocator};
|
||||||
use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};
|
use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};
|
||||||
use smithay::backend::allocator::{Format, Fourcc};
|
use smithay::backend::allocator::{Format, Fourcc};
|
||||||
@@ -46,7 +47,6 @@ use wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_
|
|||||||
use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
|
use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
|
||||||
|
|
||||||
use super::RenderResult;
|
use super::RenderResult;
|
||||||
use crate::config::Config;
|
|
||||||
use crate::niri::{RedrawState, State};
|
use crate::niri::{RedrawState, State};
|
||||||
use crate::render_helpers::AsGlesRenderer;
|
use crate::render_helpers::AsGlesRenderer;
|
||||||
use crate::utils::get_monotonic_time;
|
use crate::utils::get_monotonic_time;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use std::rc::Rc;
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::Config;
|
||||||
use smithay::backend::allocator::dmabuf::Dmabuf;
|
use smithay::backend::allocator::dmabuf::Dmabuf;
|
||||||
use smithay::backend::renderer::damage::OutputDamageTracker;
|
use smithay::backend::renderer::damage::OutputDamageTracker;
|
||||||
use smithay::backend::renderer::gles::GlesRenderer;
|
use smithay::backend::renderer::gles::GlesRenderer;
|
||||||
@@ -18,7 +19,6 @@ use smithay::reexports::winit::window::WindowBuilder;
|
|||||||
use smithay::utils::Transform;
|
use smithay::utils::Transform;
|
||||||
|
|
||||||
use super::RenderResult;
|
use super::RenderResult;
|
||||||
use crate::config::Config;
|
|
||||||
use crate::niri::{RedrawState, State};
|
use crate::niri::{RedrawState, State};
|
||||||
use crate::utils::get_monotonic_time;
|
use crate::utils::get_monotonic_time;
|
||||||
use crate::Niri;
|
use crate::Niri;
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use niri_config::{Action, Binds, LayoutAction, Modifiers};
|
||||||
use smithay::backend::input::{
|
use smithay::backend::input::{
|
||||||
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Device, DeviceCapability, Event,
|
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Device, DeviceCapability, Event,
|
||||||
GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _,
|
GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _,
|
||||||
@@ -20,7 +21,6 @@ use smithay::utils::{Logical, Point, SERIAL_COUNTER};
|
|||||||
use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
|
use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
|
||||||
use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
|
use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
|
||||||
|
|
||||||
use crate::config::{Action, Binds, LayoutAction, Modifiers};
|
|
||||||
use crate::niri::State;
|
use crate::niri::State;
|
||||||
use crate::screenshot_ui::ScreenshotUi;
|
use crate::screenshot_ui::ScreenshotUi;
|
||||||
use crate::utils::{center, get_monotonic_time, spawn};
|
use crate::utils::{center, get_monotonic_time, spawn};
|
||||||
@@ -1338,8 +1338,9 @@ fn allowed_during_screenshot(action: &Action) -> bool {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use niri_config::{Action, Bind, Binds, Key, Modifiers};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::config::{Action, Bind, Binds, Key, Modifiers};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bindings_suppress_keys() {
|
fn bindings_suppress_keys() {
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
use std::iter::zip;
|
use std::iter::zip;
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
|
use niri_config::{self, Color};
|
||||||
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
||||||
use smithay::backend::renderer::element::Kind;
|
use smithay::backend::renderer::element::Kind;
|
||||||
use smithay::utils::{Logical, Point, Scale, Size};
|
use smithay::utils::{Logical, Point, Scale, Size};
|
||||||
|
|
||||||
use crate::config::{self, Color};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FocusRing {
|
pub struct FocusRing {
|
||||||
buffers: [SolidColorBuffer; 4],
|
buffers: [SolidColorBuffer; 4],
|
||||||
@@ -21,7 +20,7 @@ pub struct FocusRing {
|
|||||||
pub type FocusRingRenderElement = SolidColorRenderElement;
|
pub type FocusRingRenderElement = SolidColorRenderElement;
|
||||||
|
|
||||||
impl FocusRing {
|
impl FocusRing {
|
||||||
pub fn new(config: config::FocusRing) -> Self {
|
pub fn new(config: niri_config::FocusRing) -> Self {
|
||||||
Self {
|
Self {
|
||||||
buffers: Default::default(),
|
buffers: Default::default(),
|
||||||
locations: Default::default(),
|
locations: Default::default(),
|
||||||
@@ -33,7 +32,7 @@ impl FocusRing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_config(&mut self, config: config::FocusRing) {
|
pub fn update_config(&mut self, config: niri_config::FocusRing) {
|
||||||
self.is_off = config.off;
|
self.is_off = config.off;
|
||||||
self.width = config.width.into();
|
self.width = config.width.into();
|
||||||
self.active_color = config.active_color;
|
self.active_color = config.active_color;
|
||||||
|
|||||||
+4
-4
@@ -33,6 +33,7 @@ use std::mem;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::{self, Config, SizeChange, Struts};
|
||||||
use smithay::backend::renderer::element::AsRenderElements;
|
use smithay::backend::renderer::element::AsRenderElements;
|
||||||
use smithay::backend::renderer::{ImportAll, Renderer};
|
use smithay::backend::renderer::{ImportAll, Renderer};
|
||||||
use smithay::desktop::space::SpaceElement;
|
use smithay::desktop::space::SpaceElement;
|
||||||
@@ -51,7 +52,6 @@ use self::workspace::{
|
|||||||
compute_working_area, ColumnWidth, OutputId, Workspace, WorkspaceRenderElement,
|
compute_working_area, ColumnWidth, OutputId, Workspace, WorkspaceRenderElement,
|
||||||
};
|
};
|
||||||
use crate::animation::Animation;
|
use crate::animation::Animation;
|
||||||
use crate::config::{self, Config, SizeChange, Struts};
|
|
||||||
use crate::utils::output_size;
|
use crate::utils::output_size;
|
||||||
|
|
||||||
mod focus_ring;
|
mod focus_ring;
|
||||||
@@ -137,8 +137,8 @@ pub struct Options {
|
|||||||
gaps: i32,
|
gaps: i32,
|
||||||
/// Extra padding around the working area in logical pixels.
|
/// Extra padding around the working area in logical pixels.
|
||||||
struts: Struts,
|
struts: Struts,
|
||||||
focus_ring: config::FocusRing,
|
focus_ring: niri_config::FocusRing,
|
||||||
border: config::FocusRing,
|
border: niri_config::FocusRing,
|
||||||
/// Column widths that `toggle_width()` switches between.
|
/// Column widths that `toggle_width()` switches between.
|
||||||
preset_widths: Vec<ColumnWidth>,
|
preset_widths: Vec<ColumnWidth>,
|
||||||
/// Initial width for new columns.
|
/// Initial width for new columns.
|
||||||
@@ -151,7 +151,7 @@ impl Default for Options {
|
|||||||
gaps: 16,
|
gaps: 16,
|
||||||
struts: Default::default(),
|
struts: Default::default(),
|
||||||
focus_ring: Default::default(),
|
focus_ring: Default::default(),
|
||||||
border: config::default_border(),
|
border: niri_config::default_border(),
|
||||||
preset_widths: vec![
|
preset_widths: vec![
|
||||||
ColumnWidth::Proportion(1. / 3.),
|
ColumnWidth::Proportion(1. / 3.),
|
||||||
ColumnWidth::Proportion(0.5),
|
ColumnWidth::Proportion(0.5),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use std::cmp::min;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::SizeChange;
|
||||||
use smithay::backend::renderer::element::utils::{
|
use smithay::backend::renderer::element::utils::{
|
||||||
CropRenderElement, Relocate, RelocateRenderElement,
|
CropRenderElement, Relocate, RelocateRenderElement,
|
||||||
};
|
};
|
||||||
@@ -15,7 +16,6 @@ use super::workspace::{
|
|||||||
};
|
};
|
||||||
use super::{LayoutElement, Options};
|
use super::{LayoutElement, Options};
|
||||||
use crate::animation::Animation;
|
use crate::animation::Animation;
|
||||||
use crate::config::SizeChange;
|
|
||||||
use crate::utils::output_size;
|
use crate::utils::output_size;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use std::iter::zip;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::{PresetWidth, SizeChange, Struts};
|
||||||
use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement;
|
use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement;
|
||||||
use smithay::backend::renderer::element::utils::RelocateRenderElement;
|
use smithay::backend::renderer::element::utils::RelocateRenderElement;
|
||||||
use smithay::backend::renderer::{ImportAll, Renderer};
|
use smithay::backend::renderer::{ImportAll, Renderer};
|
||||||
@@ -17,7 +18,6 @@ use super::focus_ring::{FocusRing, FocusRingRenderElement};
|
|||||||
use super::tile::Tile;
|
use super::tile::Tile;
|
||||||
use super::{LayoutElement, Options};
|
use super::{LayoutElement, Options};
|
||||||
use crate::animation::Animation;
|
use crate::animation::Animation;
|
||||||
use crate::config::{PresetWidth, SizeChange, Struts};
|
|
||||||
use crate::utils::output_size;
|
use crate::utils::output_size;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
+4
-6
@@ -3,7 +3,6 @@ extern crate tracing;
|
|||||||
|
|
||||||
mod animation;
|
mod animation;
|
||||||
mod backend;
|
mod backend;
|
||||||
mod config;
|
|
||||||
mod cursor;
|
mod cursor;
|
||||||
#[cfg(feature = "dbus")]
|
#[cfg(feature = "dbus")]
|
||||||
mod dbus;
|
mod dbus;
|
||||||
@@ -28,12 +27,11 @@ use std::process::Command;
|
|||||||
use std::{env, mem};
|
use std::{env, mem};
|
||||||
|
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use config::Config;
|
|
||||||
#[cfg(not(feature = "xdp-gnome-screencast"))]
|
#[cfg(not(feature = "xdp-gnome-screencast"))]
|
||||||
use dummy_pw_utils as pw_utils;
|
use dummy_pw_utils as pw_utils;
|
||||||
use git_version::git_version;
|
use git_version::git_version;
|
||||||
use miette::{Context, NarratableReportHandler};
|
|
||||||
use niri::{Niri, State};
|
use niri::{Niri, State};
|
||||||
|
use niri_config::Config;
|
||||||
use portable_atomic::Ordering;
|
use portable_atomic::Ordering;
|
||||||
use sd_notify::NotifyState;
|
use sd_notify::NotifyState;
|
||||||
use smithay::reexports::calloop::{self, EventLoop};
|
use smithay::reexports::calloop::{self, EventLoop};
|
||||||
@@ -110,13 +108,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let _client = tracy_client::Client::start();
|
let _client = tracy_client::Client::start();
|
||||||
|
|
||||||
// Set a better error printer for config loading.
|
// Set a better error printer for config loading.
|
||||||
miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new()))).unwrap();
|
niri_config::set_miette_hook().unwrap();
|
||||||
|
|
||||||
// Handle subcommands.
|
// Handle subcommands.
|
||||||
if let Some(subcommand) = cli.subcommand {
|
if let Some(subcommand) = cli.subcommand {
|
||||||
match subcommand {
|
match subcommand {
|
||||||
Sub::Validate { config } => {
|
Sub::Validate { config } => {
|
||||||
Config::load(config).context("error loading config")?;
|
Config::load(config)?;
|
||||||
info!("config is valid");
|
info!("config is valid");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -130,7 +128,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Load the config.
|
// Load the config.
|
||||||
let (mut config, path) = match Config::load(cli.config).context("error loading config") {
|
let (mut config, path) = match Config::load(cli.config) {
|
||||||
Ok((config, path)) => (config, Some(path)),
|
Ok((config, path)) => (config, Some(path)),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!("{err:?}");
|
warn!("{err:?}");
|
||||||
|
|||||||
+1
-1
@@ -10,6 +10,7 @@ use std::{env, mem, thread};
|
|||||||
|
|
||||||
use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode;
|
use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
use niri_config::{Config, TrackLayout};
|
||||||
use smithay::backend::allocator::Fourcc;
|
use smithay::backend::allocator::Fourcc;
|
||||||
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
||||||
use smithay::backend::renderer::element::surface::{
|
use smithay::backend::renderer::element::surface::{
|
||||||
@@ -86,7 +87,6 @@ use smithay::wayland::virtual_keyboard::VirtualKeyboardManagerState;
|
|||||||
use crate::animation;
|
use crate::animation;
|
||||||
use crate::backend::tty::{SurfaceDmabufFeedback, TtyFrame, TtyRenderer, TtyRendererError};
|
use crate::backend::tty::{SurfaceDmabufFeedback, TtyFrame, TtyRenderer, TtyRendererError};
|
||||||
use crate::backend::{Backend, RenderResult, Tty, Winit};
|
use crate::backend::{Backend, RenderResult, Tty, Winit};
|
||||||
use crate::config::{Config, TrackLayout};
|
|
||||||
use crate::cursor::{CursorManager, CursorTextureCache, RenderCursor, XCursor};
|
use crate::cursor::{CursorManager, CursorTextureCache, RenderCursor, XCursor};
|
||||||
#[cfg(feature = "dbus")]
|
#[cfg(feature = "dbus")]
|
||||||
use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri};
|
use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use std::mem;
|
|||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
|
use niri_config::Action;
|
||||||
use smithay::backend::allocator::Fourcc;
|
use smithay::backend::allocator::Fourcc;
|
||||||
use smithay::backend::input::{ButtonState, MouseButton};
|
use smithay::backend::input::{ButtonState, MouseButton};
|
||||||
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
||||||
@@ -18,7 +19,6 @@ use smithay::output::{Output, WeakOutput};
|
|||||||
use smithay::utils::{Buffer, Physical, Point, Rectangle, Scale, Size, Transform};
|
use smithay::utils::{Buffer, Physical, Point, Rectangle, Scale, Size, Transform};
|
||||||
|
|
||||||
use crate::backend::tty::{TtyFrame, TtyRenderer, TtyRendererError};
|
use crate::backend::tty::{TtyFrame, TtyRenderer, TtyRendererError};
|
||||||
use crate::config::Action;
|
|
||||||
use crate::render_helpers::PrimaryGpuTextureRenderElement;
|
use crate::render_helpers::PrimaryGpuTextureRenderElement;
|
||||||
|
|
||||||
const BORDER: i32 = 2;
|
const BORDER: i32 = 2;
|
||||||
|
|||||||
+1
-2
@@ -11,12 +11,11 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use anyhow::{ensure, Context};
|
use anyhow::{ensure, Context};
|
||||||
use directories::UserDirs;
|
use directories::UserDirs;
|
||||||
|
use niri_config::Config;
|
||||||
use smithay::output::Output;
|
use smithay::output::Output;
|
||||||
use smithay::reexports::rustix::time::{clock_gettime, ClockId};
|
use smithay::reexports::rustix::time::{clock_gettime, ClockId};
|
||||||
use smithay::utils::{Logical, Point, Rectangle, Size};
|
use smithay::utils::{Logical, Point, Rectangle, Size};
|
||||||
|
|
||||||
use crate::config::Config;
|
|
||||||
|
|
||||||
pub fn clone2<T: Clone, U: Clone>(t: (&T, &U)) -> (T, U) {
|
pub fn clone2<T: Clone, U: Clone>(t: (&T, &U)) -> (T, U) {
|
||||||
(t.0.clone(), t.1.clone())
|
(t.0.clone(), t.1.clone())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user