| 1 | #[cfg(windows)] |
| 2 | mod windows_impl; |
| 3 | #[cfg(windows)] |
| 4 | pub use windows_impl::*; |
| 5 | |
| 6 | #[cfg(target_os = "linux")] |
| 7 | mod linux_notifications; |
| 8 | #[cfg(any(target_os = "linux", target_os = "macos"))] |
| 9 | mod linux_sound; |
| 10 | #[cfg(target_os = "linux")] |
| 11 | mod linux_tray; |
| 12 | #[cfg(not(windows))] |
| 13 | mod stub; |
| 14 | #[cfg(target_os = "linux")] |
| 15 | mod x11_input; |
| 16 | #[cfg(target_os = "linux")] |
| 17 | pub use linux_notifications::{ |
| 18 | BusNotification, DesktopNotifications, NotificationEvent, NotificationImage, |
| 19 | notifications_inhibited, |
| 20 | }; |
| 21 | #[cfg(target_os = "linux")] |
| 22 | pub use linux_tray::Tray; |
| 23 | #[cfg(not(windows))] |
| 24 | pub use stub::*; |
| 25 | |
| 26 | pub type NativeHandle = isize; |
| 27 | |
| 28 | #[cfg_attr(not(windows), allow(dead_code))] |
| 29 | mod stack_plan; |
| 30 | |
| 31 | #[derive(Debug, Clone, Copy, PartialEq)] |
| 32 | pub 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)] |
| 41 | pub struct ScreenRect { |
| 42 | pub left: i32, |
| 43 | pub top: i32, |
| 44 | pub right: i32, |
| 45 | pub bottom: i32, |
| 46 | } |
| 47 | |
| 48 | impl 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)] |
| 59 | pub struct ShareGeometry { |
| 60 | pub target: ScreenRect, |
| 61 | pub work: WorkArea, |
| 62 | } |
| 63 | |
| 64 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 65 | pub 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)] |
| 76 | pub struct TrayPresence { |
| 77 | pub title: String, |
| 78 | pub forced: Option<chatsvc::ForcedKind>, |
| 79 | pub mention: bool, |
| 80 | } |
| 81 | |
| 82 | impl 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 | } |