aboutsummaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/utils.rs b/src/utils.rs
index bf25819b..07c737df 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -11,8 +11,9 @@ use std::time::Duration;
use anyhow::{ensure, Context};
use directories::UserDirs;
+use smithay::output::Output;
use smithay::reexports::rustix::time::{clock_gettime, ClockId};
-use smithay::utils::{Logical, Point, Rectangle};
+use smithay::utils::{Logical, Point, Rectangle, Size};
use crate::config::Config;
@@ -25,6 +26,16 @@ pub fn center(rect: Rectangle<i32, Logical>) -> Point<i32, Logical> {
rect.loc + rect.size.downscale(2).to_point()
}
+pub fn output_size(output: &Output) -> Size<i32, Logical> {
+ let output_scale = output.current_scale().integer_scale();
+ let output_transform = output.current_transform();
+ let output_mode = output.current_mode().unwrap();
+
+ output_transform
+ .transform_size(output_mode.size)
+ .to_logical(output_scale)
+}
+
pub fn make_screenshot_path(config: &Config) -> anyhow::Result<Option<PathBuf>> {
let Some(path) = &config.screenshot_path else {
return Ok(None);