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(any(target_os = "linux", target_os = "macos"))]
7mod linux_sound;
8#[cfg(target_os = "linux")]
9mod linux_tray;
10#[cfg(not(windows))]
11mod stub;
12#[cfg(target_os = "linux")]
13mod x11_input;
14#[cfg(target_os = "linux")]
15pub use linux_tray::Tray;
16#[cfg(not(windows))]
17pub use stub::*;
18
19pub type NativeHandle = isize;
20
21#[cfg_attr(not(windows), allow(dead_code))]
22mod stack_plan;
23
24#[derive(Debug, Clone, Copy, PartialEq)]
25pub struct WorkArea {
26 pub left: i32,
27 pub top: i32,
28 pub right: i32,
29 pub bottom: i32,
30 pub scale: f32,
31}
32
33#[derive(Debug, Clone, Copy, PartialEq, Eq)]
34pub struct ScreenRect {
35 pub left: i32,
36 pub top: i32,
37 pub right: i32,
38 pub bottom: i32,
39}
40
41impl ScreenRect {
42 pub fn width(&self) -> i32 {
43 self.right - self.left
44 }
45
46 pub fn height(&self) -> i32 {
47 self.bottom - self.top
48 }
49}
50
51#[derive(Debug, Clone, Copy, PartialEq)]
52pub struct ShareGeometry {
53 pub target: ScreenRect,
54 pub work: WorkArea,
55}
56
57#[derive(Debug, Clone, Copy, PartialEq, Eq)]
58pub enum TrayStatusDuration {
59 HalfHour,
60 OneHour,
61 TwoHours,
62 Today,
63 ThisWeek,
64}
65
66#[derive(Debug, Clone, Copy, PartialEq, Eq)]
67pub enum TrayCommand {
68 Toggle,
69 Open,
70 /// Publish a forced status with no expiry (same as the profile menu).
71 SetStatus(chatsvc::ForcedKind),
72 /// Apply a duration to the currently forced status (ignored when none / Available).
73 SetStatusDuration(TrayStatusDuration),
74 ResetStatus,
75 Notifications,
76 Quit,
77}
78
79/// Snapshot the tray menu needs to show presence correctly.
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}