summaryrefslogtreecommitdiffstats
path: root/runtime/src/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r--runtime/src/window.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs
index d4111293..9b66cb0e 100644
--- a/runtime/src/window.rs
+++ b/runtime/src/window.rs
@@ -7,6 +7,7 @@ use crate::command::{self, Command};
use crate::core::time::Instant;
use crate::core::window::{Event, Icon, Level, Mode, UserAttention};
use crate::futures::subscription::{self, Subscription};
+use crate::screenshot::Screenshot;
/// Subscribes to the frames of the window of the running application.
///
@@ -115,3 +116,10 @@ pub fn fetch_id<Message>(
pub fn change_icon<Message>(icon: Icon) -> Command<Message> {
Command::single(command::Action::Window(Action::ChangeIcon(icon)))
}
+
+/// Captures a [`Screenshot`] from the window.
+pub fn screenshot<Message>(
+ f: impl FnOnce(Screenshot) -> Message + Send + 'static,
+) -> Command<Message> {
+ Command::single(command::Action::Window(Action::Screenshot(Box::new(f))))
+}