BlueGit

ict rusty-teams

Files

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

mod.rs

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