From 23cd5aa78a26ccf57c6a7993313e42a5c39d43d8 Mon Sep 17 00:00:00 2001 From: Lin Xianyi Date: Sun, 19 Oct 2025 11:22:31 +0000 Subject: Add --path argument for niri msg screenshot* commands (#2126) * Check for empty screenshot parent before creating Avoids a warning. * Add --path argument for niri msg screenshot* commands * fix --------- Co-authored-by: Ivan Molodetskikh --- niri-config/src/binds.rs | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'niri-config/src') diff --git a/niri-config/src/binds.rs b/niri-config/src/binds.rs index 37ac1665..71181fc0 100644 --- a/niri-config/src/binds.rs +++ b/niri-config/src/binds.rs @@ -118,16 +118,27 @@ pub enum Action { CancelScreenshot, #[knuffel(skip)] ScreenshotTogglePointer, - Screenshot(#[knuffel(property(name = "show-pointer"), default = true)] bool), + Screenshot( + #[knuffel(property(name = "show-pointer"), default = true)] bool, + // Path; not settable from knuffel + Option, + ), ScreenshotScreen( #[knuffel(property(name = "write-to-disk"), default = true)] bool, #[knuffel(property(name = "show-pointer"), default = true)] bool, + // Path; not settable from knuffel + Option, + ), + ScreenshotWindow( + #[knuffel(property(name = "write-to-disk"), default = true)] bool, + // Path; not settable from knuffel + Option, ), - ScreenshotWindow(#[knuffel(property(name = "write-to-disk"), default = true)] bool), #[knuffel(skip)] ScreenshotWindowById { id: u64, write_to_disk: bool, + path: Option, }, ToggleKeyboardShortcutsInhibit, CloseWindow, @@ -364,19 +375,28 @@ impl From for Action { niri_ipc::Action::Spawn { command } => Self::Spawn(command), niri_ipc::Action::SpawnSh { command } => Self::SpawnSh(command), niri_ipc::Action::DoScreenTransition { delay_ms } => Self::DoScreenTransition(delay_ms), - niri_ipc::Action::Screenshot { show_pointer } => Self::Screenshot(show_pointer), + niri_ipc::Action::Screenshot { show_pointer, path } => { + Self::Screenshot(show_pointer, path) + } niri_ipc::Action::ScreenshotScreen { write_to_disk, show_pointer, - } => Self::ScreenshotScreen(write_to_disk, show_pointer), + path, + } => Self::ScreenshotScreen(write_to_disk, show_pointer, path), niri_ipc::Action::ScreenshotWindow { id: None, write_to_disk, - } => Self::ScreenshotWindow(write_to_disk), + path, + } => Self::ScreenshotWindow(write_to_disk, path), niri_ipc::Action::ScreenshotWindow { id: Some(id), write_to_disk, - } => Self::ScreenshotWindowById { id, write_to_disk }, + path, + } => Self::ScreenshotWindowById { + id, + write_to_disk, + path, + }, niri_ipc::Action::ToggleKeyboardShortcutsInhibit {} => { Self::ToggleKeyboardShortcutsInhibit } -- cgit