forge
Explore
Log in

Don't you dare go Hollow

Move config into a separate crate

Browse files at this commit

64c41fa2c8853aefc8f62bf9492043a6c25b8c8fIvan MolodetskikhParent: 4e0aa39
Get miette and knuffel deps contained within.
Cargo.lockmodified+13 -2
@@ -1704,11 +1704,10 @@ dependencies = [
1704 "directories",1704 "directories",
1705 "git-version",1705 "git-version",
1706 "keyframe",1706 "keyframe",
1707- "knuffel",
1708 "libc",1707 "libc",
1709 "log",1708 "log",
1710 "logind-zbus",1709 "logind-zbus",
1711- "miette",1710+ "niri-config",
1712 "notify-rust",1711 "notify-rust",
1713 "pipewire",1712 "pipewire",
1714 "png",1713 "png",
@@ -1728,6 +1727,18 @@ dependencies = [
1728 "zbus",1727 "zbus",
1729 ]1728 ]
1730 1729
1730+[[package]]
1731+name = "niri-config"
1732+version = "0.1.0-alpha.3"
1733+dependencies = [
1734+ "bitflags 2.4.1",
1735+ "directories",
1736+ "knuffel",
1737+ "miette",
1738+ "smithay",
1739+ "tracing",
1740+]
1741+
1731 [[package]]1742 [[package]]
1732 name = "nix"1743 name = "nix"
1733 version = "0.26.4"1744 version = "0.26.4"
Cargo.tomlmodified+29 -13
@@ -1,13 +1,35 @@
1-[package]1+[workspace.package]
2-name = "niri"
3 version = "0.1.0-alpha.3"2 version = "0.1.0-alpha.3"
4 description = "A scrollable-tiling Wayland compositor"3 description = "A scrollable-tiling Wayland compositor"
5 authors = ["Ivan Molodetskikh <yalterz@gmail.com>"]4 authors = ["Ivan Molodetskikh <yalterz@gmail.com>"]
6 license = "GPL-3.0-or-later"5 license = "GPL-3.0-or-later"
7 edition = "2021"6 edition = "2021"
7+repository = "https://github.com/YaLTeR/niri"
8+
9+[workspace.dependencies]
10+bitflags = "2.4.1"
11+directories = "5.0.1"
12+tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] }
13+
14+[workspace.dependencies.smithay]
15+git = "https://github.com/Smithay/smithay.git"
16+# path = "../smithay"
17+default-features = false
18+
19+[workspace.dependencies.smithay-drm-extras]
20+git = "https://github.com/Smithay/smithay.git"
21+# path = "../smithay/smithay-drm-extras"
22+
23+[package]
24+name = "niri"
25+version.workspace = true
26+description.workspace = true
27+authors.workspace = true
28+license.workspace = true
29+edition.workspace = true
30+repository.workspace = true
8 31
9 readme = "README.md"32 readme = "README.md"
10-repository = "https://github.com/YaLTeR/niri"
11 keywords = ["wayland", "compositor", "tiling", "smithay", "wm"]33 keywords = ["wayland", "compositor", "tiling", "smithay", "wm"]
12 34
13 [dependencies]35 [dependencies]
@@ -20,29 +42,27 @@ clap = { version = "4.4.13", features = ["derive"] }
20 directories = "5.0.1"42 directories = "5.0.1"
21 git-version = "0.3.9"43 git-version = "0.3.9"
22 keyframe = { version = "1.1.1", default-features = false }44 keyframe = { version = "1.1.1", default-features = false }
23-knuffel = "3.2.0"
24 libc = "0.2.151"45 libc = "0.2.151"
25 logind-zbus = { version = "3.1.2", optional = true }46 logind-zbus = { version = "3.1.2", optional = true }
26 log = { version = "0.4.20", features = ["max_level_trace", "release_max_level_debug"] }47 log = { version = "0.4.20", features = ["max_level_trace", "release_max_level_debug"] }
27-miette = "5.10.0"48+niri-config = { version = "0.1.0-alpha.3", path = "niri-config" }
28 notify-rust = { version = "4.10.0", optional = true }49 notify-rust = { version = "4.10.0", optional = true }
29 pipewire = { version = "0.7.2", optional = true }50 pipewire = { version = "0.7.2", optional = true }
30 png = "0.17.10"51 png = "0.17.10"
31 portable-atomic = { version = "1.6.0", default-features = false, features = ["float"] }52 portable-atomic = { version = "1.6.0", default-features = false, features = ["float"] }
32 profiling = "1.0.13"53 profiling = "1.0.13"
33 sd-notify = "0.4.1"54 sd-notify = "0.4.1"
55+smithay-drm-extras.workspace = true
34 serde = { version = "1.0.195", features = ["derive"] }56 serde = { version = "1.0.195", features = ["derive"] }
35 tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }57 tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
36-tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] }58+tracing.workspace = true
37 tracy-client = { version = "0.16.5", default-features = false }59 tracy-client = { version = "0.16.5", default-features = false }
38 url = { version = "2.5.0", optional = true }60 url = { version = "2.5.0", optional = true }
39 xcursor = "0.3.5"61 xcursor = "0.3.5"
40 zbus = { version = "3.14.1", optional = true }62 zbus = { version = "3.14.1", optional = true }
41 63
42 [dependencies.smithay]64 [dependencies.smithay]
43-git = "https://github.com/Smithay/smithay.git"65+workspace = true
44-# path = "../smithay"
45-default-features = false
46 features = [66 features = [
47 "backend_drm",67 "backend_drm",
48 "backend_egl",68 "backend_egl",
@@ -58,10 +78,6 @@ features = [
58 "wayland_frontend",78 "wayland_frontend",
59 ]79 ]
60 80
61-[dependencies.smithay-drm-extras]
62-git = "https://github.com/Smithay/smithay.git"
63-# path = "../smithay/smithay-drm-extras"
64-
65 [dev-dependencies]81 [dev-dependencies]
66 proptest = "1.4.0"82 proptest = "1.4.0"
67 proptest-derive = "0.4.0"83 proptest-derive = "0.4.0"
niri-config/Cargo.tomladded+16 -0
@@ -0,0 +1,16 @@
1+[package]
2+name = "niri-config"
3+version.workspace = true
4+description.workspace = true
5+authors.workspace = true
6+license.workspace = true
7+edition.workspace = true
8+repository.workspace = true
9+
10+[dependencies]
11+bitflags.workspace = true
12+directories.workspace = true
13+knuffel = "3.2.0"
14+miette = "5.10.0"
15+smithay.workspace = true
16+tracing.workspace = true
src/config.rs → niri-config/src/lib.rsrenamed+13 -2
@@ -1,9 +1,12 @@
1+#[macro_use]
2+extern crate tracing;
3+
1 use std::path::PathBuf;4 use std::path::PathBuf;
2 use std::str::FromStr;5 use std::str::FromStr;
3 6
4 use bitflags::bitflags;7 use bitflags::bitflags;
5 use directories::ProjectDirs;8 use directories::ProjectDirs;
6-use miette::{miette, Context, IntoDiagnostic};9+use miette::{miette, Context, IntoDiagnostic, NarratableReportHandler};
7 use smithay::input::keyboard::keysyms::KEY_NoSymbol;10 use smithay::input::keyboard::keysyms::KEY_NoSymbol;
8 use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE};11 use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE};
9 use smithay::input::keyboard::{Keysym, XkbConfig};12 use smithay::input::keyboard::{Keysym, XkbConfig};
@@ -407,6 +410,10 @@ impl Default for DebugConfig {
407 410
408 impl Config {411 impl Config {
409 pub fn load(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {412 pub fn load(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
413+ Self::load_internal(path).context("error loading config")
414+ }
415+
416+ fn load_internal(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
410 let path = if let Some(path) = path {417 let path = if let Some(path) = path {
411 path418 path
412 } else {419 } else {
@@ -436,7 +443,7 @@ impl Default for Config {
436 fn default() -> Self {443 fn default() -> Self {
437 Config::parse(444 Config::parse(
438 "default-config.kdl",445 "default-config.kdl",
439- include_str!("../resources/default-config.kdl"),446+ include_str!("../../resources/default-config.kdl"),
440 )447 )
441 .unwrap()448 .unwrap()
442 }449 }
@@ -564,6 +571,10 @@ impl FromStr for SizeChange {
564 }571 }
565 }572 }
566 573
574+pub fn set_miette_hook() -> Result<(), miette::InstallError> {
575+ miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new())))
576+}
577+
567 #[cfg(test)]578 #[cfg(test)]
568 mod tests {579 mod tests {
569 use miette::NarratableReportHandler;580 use miette::NarratableReportHandler;
src/backend/tty.rsmodified+1 -1
@@ -9,6 +9,7 @@ use std::{io, mem};
9 9
10 use anyhow::{anyhow, Context};10 use anyhow::{anyhow, Context};
11 use libc::dev_t;11 use libc::dev_t;
12+use niri_config::Config;
12 use smithay::backend::allocator::dmabuf::{Dmabuf, DmabufAllocator};13 use smithay::backend::allocator::dmabuf::{Dmabuf, DmabufAllocator};
13 use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};14 use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};
14 use smithay::backend::allocator::{Format, Fourcc};15 use smithay::backend::allocator::{Format, Fourcc};
@@ -46,7 +47,6 @@ use wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_
46 use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;47 use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
47 48
48 use super::RenderResult;49 use super::RenderResult;
49-use crate::config::Config;
50 use crate::niri::{RedrawState, State};50 use crate::niri::{RedrawState, State};
51 use crate::render_helpers::AsGlesRenderer;51 use crate::render_helpers::AsGlesRenderer;
52 use crate::utils::get_monotonic_time;52 use crate::utils::get_monotonic_time;
src/backend/winit.rsmodified+1 -1
@@ -5,6 +5,7 @@ use std::rc::Rc;
5 use std::sync::{Arc, Mutex};5 use std::sync::{Arc, Mutex};
6 use std::time::Duration;6 use std::time::Duration;
7 7
8+use niri_config::Config;
8 use smithay::backend::allocator::dmabuf::Dmabuf;9 use smithay::backend::allocator::dmabuf::Dmabuf;
9 use smithay::backend::renderer::damage::OutputDamageTracker;10 use smithay::backend::renderer::damage::OutputDamageTracker;
10 use smithay::backend::renderer::gles::GlesRenderer;11 use smithay::backend::renderer::gles::GlesRenderer;
@@ -18,7 +19,6 @@ use smithay::reexports::winit::window::WindowBuilder;
18 use smithay::utils::Transform;19 use smithay::utils::Transform;
19 20
20 use super::RenderResult;21 use super::RenderResult;
21-use crate::config::Config;
22 use crate::niri::{RedrawState, State};22 use crate::niri::{RedrawState, State};
23 use crate::utils::get_monotonic_time;23 use crate::utils::get_monotonic_time;
24 use crate::Niri;24 use crate::Niri;
src/input.rsmodified+3 -2
@@ -1,6 +1,7 @@
1 use std::any::Any;1 use std::any::Any;
2 use std::collections::HashSet;2 use std::collections::HashSet;
3 3
4+use niri_config::{Action, Binds, LayoutAction, Modifiers};
4 use smithay::backend::input::{5 use smithay::backend::input::{
5 AbsolutePositionEvent, Axis, AxisSource, ButtonState, Device, DeviceCapability, Event,6 AbsolutePositionEvent, Axis, AxisSource, ButtonState, Device, DeviceCapability, Event,
6 GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _,7 GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _,
@@ -20,7 +21,6 @@ use smithay::utils::{Logical, Point, SERIAL_COUNTER};
20 use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};21 use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
21 use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};22 use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
22 23
23-use crate::config::{Action, Binds, LayoutAction, Modifiers};
24 use crate::niri::State;24 use crate::niri::State;
25 use crate::screenshot_ui::ScreenshotUi;25 use crate::screenshot_ui::ScreenshotUi;
26 use crate::utils::{center, get_monotonic_time, spawn};26 use crate::utils::{center, get_monotonic_time, spawn};
@@ -1338,8 +1338,9 @@ fn allowed_during_screenshot(action: &Action) -> bool {
1338 1338
1339 #[cfg(test)]1339 #[cfg(test)]
1340 mod tests {1340 mod tests {
1341+ use niri_config::{Action, Bind, Binds, Key, Modifiers};
1342+
1341 use super::*;1343 use super::*;
1342- use crate::config::{Action, Bind, Binds, Key, Modifiers};
1343 1344
1344 #[test]1345 #[test]
1345 fn bindings_suppress_keys() {1346 fn bindings_suppress_keys() {
src/layout/focus_ring.rsmodified+3 -4
@@ -1,12 +1,11 @@
1 use std::iter::zip;1 use std::iter::zip;
2 2
3 use arrayvec::ArrayVec;3 use arrayvec::ArrayVec;
4+use niri_config::{self, Color};
4 use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};5 use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
5 use smithay::backend::renderer::element::Kind;6 use smithay::backend::renderer::element::Kind;
6 use smithay::utils::{Logical, Point, Scale, Size};7 use smithay::utils::{Logical, Point, Scale, Size};
7 8
8-use crate::config::{self, Color};
9-
10 #[derive(Debug)]9 #[derive(Debug)]
11 pub struct FocusRing {10 pub struct FocusRing {
12 buffers: [SolidColorBuffer; 4],11 buffers: [SolidColorBuffer; 4],
@@ -21,7 +20,7 @@ pub struct FocusRing {
21 pub type FocusRingRenderElement = SolidColorRenderElement;20 pub type FocusRingRenderElement = SolidColorRenderElement;
22 21
23 impl FocusRing {22 impl FocusRing {
24- pub fn new(config: config::FocusRing) -> Self {23+ pub fn new(config: niri_config::FocusRing) -> Self {
25 Self {24 Self {
26 buffers: Default::default(),25 buffers: Default::default(),
27 locations: Default::default(),26 locations: Default::default(),
@@ -33,7 +32,7 @@ impl FocusRing {
33 }32 }
34 }33 }
35 34
36- pub fn update_config(&mut self, config: config::FocusRing) {35+ pub fn update_config(&mut self, config: niri_config::FocusRing) {
37 self.is_off = config.off;36 self.is_off = config.off;
38 self.width = config.width.into();37 self.width = config.width.into();
39 self.active_color = config.active_color;38 self.active_color = config.active_color;
src/layout/mod.rsmodified+4 -4
@@ -33,6 +33,7 @@ use std::mem;
33 use std::rc::Rc;33 use std::rc::Rc;
34 use std::time::Duration;34 use std::time::Duration;
35 35
36+use niri_config::{self, Config, SizeChange, Struts};
36 use smithay::backend::renderer::element::AsRenderElements;37 use smithay::backend::renderer::element::AsRenderElements;
37 use smithay::backend::renderer::{ImportAll, Renderer};38 use smithay::backend::renderer::{ImportAll, Renderer};
38 use smithay::desktop::space::SpaceElement;39 use smithay::desktop::space::SpaceElement;
@@ -51,7 +52,6 @@ use self::workspace::{
51 compute_working_area, ColumnWidth, OutputId, Workspace, WorkspaceRenderElement,52 compute_working_area, ColumnWidth, OutputId, Workspace, WorkspaceRenderElement,
52 };53 };
53 use crate::animation::Animation;54 use crate::animation::Animation;
54-use crate::config::{self, Config, SizeChange, Struts};
55 use crate::utils::output_size;55 use crate::utils::output_size;
56 56
57 mod focus_ring;57 mod focus_ring;
@@ -137,8 +137,8 @@ pub struct Options {
137 gaps: i32,137 gaps: i32,
138 /// Extra padding around the working area in logical pixels.138 /// Extra padding around the working area in logical pixels.
139 struts: Struts,139 struts: Struts,
140- focus_ring: config::FocusRing,140+ focus_ring: niri_config::FocusRing,
141- border: config::FocusRing,141+ border: niri_config::FocusRing,
142 /// Column widths that `toggle_width()` switches between.142 /// Column widths that `toggle_width()` switches between.
143 preset_widths: Vec<ColumnWidth>,143 preset_widths: Vec<ColumnWidth>,
144 /// Initial width for new columns.144 /// Initial width for new columns.
@@ -151,7 +151,7 @@ impl Default for Options {
151 gaps: 16,151 gaps: 16,
152 struts: Default::default(),152 struts: Default::default(),
153 focus_ring: Default::default(),153 focus_ring: Default::default(),
154- border: config::default_border(),154+ border: niri_config::default_border(),
155 preset_widths: vec![155 preset_widths: vec![
156 ColumnWidth::Proportion(1. / 3.),156 ColumnWidth::Proportion(1. / 3.),
157 ColumnWidth::Proportion(0.5),157 ColumnWidth::Proportion(0.5),
src/layout/monitor.rsmodified+1 -1
@@ -2,6 +2,7 @@ use std::cmp::min;
2 use std::rc::Rc;2 use std::rc::Rc;
3 use std::time::Duration;3 use std::time::Duration;
4 4
5+use niri_config::SizeChange;
5 use smithay::backend::renderer::element::utils::{6 use smithay::backend::renderer::element::utils::{
6 CropRenderElement, Relocate, RelocateRenderElement,7 CropRenderElement, Relocate, RelocateRenderElement,
7 };8 };
@@ -15,7 +16,6 @@ use super::workspace::{
15 };16 };
16 use super::{LayoutElement, Options};17 use super::{LayoutElement, Options};
17 use crate::animation::Animation;18 use crate::animation::Animation;
18-use crate::config::SizeChange;
19 use crate::utils::output_size;19 use crate::utils::output_size;
20 20
21 #[derive(Debug)]21 #[derive(Debug)]
src/layout/workspace.rsmodified+1 -1
@@ -3,6 +3,7 @@ use std::iter::zip;
3 use std::rc::Rc;3 use std::rc::Rc;
4 use std::time::Duration;4 use std::time::Duration;
5 5
6+use niri_config::{PresetWidth, SizeChange, Struts};
6 use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement;7 use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement;
7 use smithay::backend::renderer::element::utils::RelocateRenderElement;8 use smithay::backend::renderer::element::utils::RelocateRenderElement;
8 use smithay::backend::renderer::{ImportAll, Renderer};9 use smithay::backend::renderer::{ImportAll, Renderer};
@@ -17,7 +18,6 @@ use super::focus_ring::{FocusRing, FocusRingRenderElement};
17 use super::tile::Tile;18 use super::tile::Tile;
18 use super::{LayoutElement, Options};19 use super::{LayoutElement, Options};
19 use crate::animation::Animation;20 use crate::animation::Animation;
20-use crate::config::{PresetWidth, SizeChange, Struts};
21 use crate::utils::output_size;21 use crate::utils::output_size;
22 22
23 #[derive(Debug)]23 #[derive(Debug)]
src/main.rsmodified+4 -6
@@ -3,7 +3,6 @@ extern crate tracing;
3 3
4 mod animation;4 mod animation;
5 mod backend;5 mod backend;
6-mod config;
7 mod cursor;6 mod cursor;
8 #[cfg(feature = "dbus")]7 #[cfg(feature = "dbus")]
9 mod dbus;8 mod dbus;
@@ -28,12 +27,11 @@ use std::process::Command;
28 use std::{env, mem};27 use std::{env, mem};
29 28
30 use clap::{Parser, Subcommand};29 use clap::{Parser, Subcommand};
31-use config::Config;
32 #[cfg(not(feature = "xdp-gnome-screencast"))]30 #[cfg(not(feature = "xdp-gnome-screencast"))]
33 use dummy_pw_utils as pw_utils;31 use dummy_pw_utils as pw_utils;
34 use git_version::git_version;32 use git_version::git_version;
35-use miette::{Context, NarratableReportHandler};
36 use niri::{Niri, State};33 use niri::{Niri, State};
34+use niri_config::Config;
37 use portable_atomic::Ordering;35 use portable_atomic::Ordering;
38 use sd_notify::NotifyState;36 use sd_notify::NotifyState;
39 use smithay::reexports::calloop::{self, EventLoop};37 use smithay::reexports::calloop::{self, EventLoop};
@@ -110,13 +108,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
110 let _client = tracy_client::Client::start();108 let _client = tracy_client::Client::start();
111 109
112 // Set a better error printer for config loading.110 // Set a better error printer for config loading.
113- miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new()))).unwrap();111+ niri_config::set_miette_hook().unwrap();
114 112
115 // Handle subcommands.113 // Handle subcommands.
116 if let Some(subcommand) = cli.subcommand {114 if let Some(subcommand) = cli.subcommand {
117 match subcommand {115 match subcommand {
118 Sub::Validate { config } => {116 Sub::Validate { config } => {
119- Config::load(config).context("error loading config")?;117+ Config::load(config)?;
120 info!("config is valid");118 info!("config is valid");
121 return Ok(());119 return Ok(());
122 }120 }
@@ -130,7 +128,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
130 );128 );
131 129
132 // Load the config.130 // Load the config.
133- let (mut config, path) = match Config::load(cli.config).context("error loading config") {131+ let (mut config, path) = match Config::load(cli.config) {
134 Ok((config, path)) => (config, Some(path)),132 Ok((config, path)) => (config, Some(path)),
135 Err(err) => {133 Err(err) => {
136 warn!("{err:?}");134 warn!("{err:?}");
src/niri.rsmodified+1 -1
@@ -10,6 +10,7 @@ use std::{env, mem, thread};
10 10
11 use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode;11 use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode;
12 use anyhow::Context;12 use anyhow::Context;
13+use niri_config::{Config, TrackLayout};
13 use smithay::backend::allocator::Fourcc;14 use smithay::backend::allocator::Fourcc;
14 use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};15 use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
15 use smithay::backend::renderer::element::surface::{16 use smithay::backend::renderer::element::surface::{
@@ -86,7 +87,6 @@ use smithay::wayland::virtual_keyboard::VirtualKeyboardManagerState;
86 use crate::animation;87 use crate::animation;
87 use crate::backend::tty::{SurfaceDmabufFeedback, TtyFrame, TtyRenderer, TtyRendererError};88 use crate::backend::tty::{SurfaceDmabufFeedback, TtyFrame, TtyRenderer, TtyRendererError};
88 use crate::backend::{Backend, RenderResult, Tty, Winit};89 use crate::backend::{Backend, RenderResult, Tty, Winit};
89-use crate::config::{Config, TrackLayout};
90 use crate::cursor::{CursorManager, CursorTextureCache, RenderCursor, XCursor};90 use crate::cursor::{CursorManager, CursorTextureCache, RenderCursor, XCursor};
91 #[cfg(feature = "dbus")]91 #[cfg(feature = "dbus")]
92 use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri};92 use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri};
src/screenshot_ui.rsmodified+1 -1
@@ -5,6 +5,7 @@ use std::mem;
5 5
6 use anyhow::Context;6 use anyhow::Context;
7 use arrayvec::ArrayVec;7 use arrayvec::ArrayVec;
8+use niri_config::Action;
8 use smithay::backend::allocator::Fourcc;9 use smithay::backend::allocator::Fourcc;
9 use smithay::backend::input::{ButtonState, MouseButton};10 use smithay::backend::input::{ButtonState, MouseButton};
10 use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};11 use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
@@ -18,7 +19,6 @@ use smithay::output::{Output, WeakOutput};
18 use smithay::utils::{Buffer, Physical, Point, Rectangle, Scale, Size, Transform};19 use smithay::utils::{Buffer, Physical, Point, Rectangle, Scale, Size, Transform};
19 20
20 use crate::backend::tty::{TtyFrame, TtyRenderer, TtyRendererError};21 use crate::backend::tty::{TtyFrame, TtyRenderer, TtyRendererError};
21-use crate::config::Action;
22 use crate::render_helpers::PrimaryGpuTextureRenderElement;22 use crate::render_helpers::PrimaryGpuTextureRenderElement;
23 23
24 const BORDER: i32 = 2;24 const BORDER: i32 = 2;
src/utils.rsmodified+1 -2
@@ -11,12 +11,11 @@ use std::time::Duration;
11 11
12 use anyhow::{ensure, Context};12 use anyhow::{ensure, Context};
13 use directories::UserDirs;13 use directories::UserDirs;
14+use niri_config::Config;
14 use smithay::output::Output;15 use smithay::output::Output;
15 use smithay::reexports::rustix::time::{clock_gettime, ClockId};16 use smithay::reexports::rustix::time::{clock_gettime, ClockId};
16 use smithay::utils::{Logical, Point, Rectangle, Size};17 use smithay::utils::{Logical, Point, Rectangle, Size};
17 18
18-use crate::config::Config;
19-
20 pub fn clone2<T: Clone, U: Clone>(t: (&T, &U)) -> (T, U) {19 pub fn clone2<T: Clone, U: Clone>(t: (&T, &U)) -> (T, U) {
21 (t.0.clone(), t.1.clone())20 (t.0.clone(), t.1.clone())
22 }21 }