From 0df7a085de6fb0ebfe7af640e60fb496e52656aa Mon Sep 17 00:00:00 2001 From: Gustav Sörnäs Date: Tue, 14 Jan 2025 09:10:45 +0100 Subject: add write-to-disk argument to screenshot actions --- niri-config/src/lib.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'niri-config') diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index fb7ae213..612eec12 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -1185,16 +1185,21 @@ pub enum Action { Spawn(#[knuffel(arguments)] Vec), DoScreenTransition(#[knuffel(property(name = "delay-ms"))] Option), #[knuffel(skip)] - ConfirmScreenshot, + ConfirmScreenshot { + write_to_disk: bool, + }, #[knuffel(skip)] CancelScreenshot, #[knuffel(skip)] ScreenshotTogglePointer, Screenshot, - ScreenshotScreen, - ScreenshotWindow, + ScreenshotScreen(#[knuffel(property(name = "write-to-disk"), default = true)] bool), + ScreenshotWindow(#[knuffel(property(name = "write-to-disk"), default = true)] bool), #[knuffel(skip)] - ScreenshotWindowById(u64), + ScreenshotWindowById { + id: u64, + write_to_disk: bool, + }, CloseWindow, #[knuffel(skip)] CloseWindowById(u64), @@ -1351,9 +1356,17 @@ impl From for Action { niri_ipc::Action::Spawn { command } => Self::Spawn(command), niri_ipc::Action::DoScreenTransition { delay_ms } => Self::DoScreenTransition(delay_ms), niri_ipc::Action::Screenshot {} => Self::Screenshot, - niri_ipc::Action::ScreenshotScreen {} => Self::ScreenshotScreen, - niri_ipc::Action::ScreenshotWindow { id: None } => Self::ScreenshotWindow, - niri_ipc::Action::ScreenshotWindow { id: Some(id) } => Self::ScreenshotWindowById(id), + niri_ipc::Action::ScreenshotScreen { write_to_disk } => { + Self::ScreenshotScreen(write_to_disk) + } + niri_ipc::Action::ScreenshotWindow { + id: None, + write_to_disk, + } => Self::ScreenshotWindow(write_to_disk), + niri_ipc::Action::ScreenshotWindow { + id: Some(id), + write_to_disk, + } => Self::ScreenshotWindowById { id, write_to_disk }, niri_ipc::Action::CloseWindow { id: None } => Self::CloseWindow, niri_ipc::Action::CloseWindow { id: Some(id) } => Self::CloseWindowById(id), niri_ipc::Action::FullscreenWindow { id: None } => Self::FullscreenWindow, -- cgit