BlueGit

ict rusty-teams

Files

rusty-teams / crates / app-base / src / notify / platform / mod.rs

mod.rs

mod.rs 1.9 KiB Download Raw
1#[cfg(windows)]
2mod windows_impl;
3#[cfg(windows)]
4pub use windows_impl::*;
5
6#[cfg(target_os = "linux")]
7mod linux_notifications;
8#[cfg(any(target_os = "linux", target_os = "macos"))]
9mod linux_sound;
10#[cfg(target_os = "linux")]
11mod linux_tray;
12#[cfg(not(windows))]
13mod stub;
14#[cfg(target_os = "linux")]
15mod x11_input;
16#[cfg(target_os = "linux")]
17pub use linux_notifications::{
18 BusNotification, DesktopNotifications, NotificationEvent, NotificationImage,
19 notifications_inhibited,
20};
21#[cfg(target_os = "linux")]
22pub use linux_tray::Tray;
23#[cfg(not(windows))]
24pub use stub::*;
25
26pub type NativeHandle = isize;
27
28#[cfg_attr(not(windows), allow(dead_code))]
29mod stack_plan;
30
31#[derive(Debug, Clone, Copy, PartialEq)]
32pub struct WorkArea {
33 pub left: i32,
34 pub top: i32,
35 pub right: i32,
36 pub bottom: i32,
37 pub scale: f32,
38}
39
40#[derive(Debug, Clone, Copy, PartialEq, Eq)]
41pub struct ScreenRect {
42 pub left: i32,
43 pub top: i32,
44 pub right: i32,
45 pub bottom: i32,
46}
47
48impl ScreenRect {
49 pub fn width(&self) -> i32 {
50 self.right - self.left
51 }
52
53 pub fn height(&self) -> i32 {
54 self.bottom - self.top
55 }
56}
57
58#[derive(Debug, Clone, Copy, PartialEq)]
59pub struct ShareGeometry {
60 pub target: ScreenRect,
61 pub work: WorkArea,
62}
63
64#[derive(Debug, Clone, Copy, PartialEq, Eq)]
65pub enum TrayCommand {
66 Toggle,
67 Open,
68 SetStatus(chatsvc::ForcedKind),
69 SetStatusDuration(crate::status_choice::StatusDuration),
70 ResetStatus,
71 Notifications,
72 Quit,
73}
74
75#[derive(Debug, Clone, PartialEq, Eq)]
76pub struct TrayPresence {
77 pub title: String,
78 pub forced: Option<chatsvc::ForcedKind>,
79 pub mention: bool,
80}
81
82impl TrayPresence {
83 pub fn new(
84 title: impl Into<String>,
85 forced: Option<chatsvc::ForcedKind>,
86 mention: bool,
87 ) -> Self {
88 Self {
89 title: title.into(),
90 forced,
91 mention,
92 }
93 }
94}