| 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(windows, target_os = "macos"))] |
| 9 | mod tray_icon_impl; |
| 10 | #[cfg(any(windows, target_os = "macos"))] |
| 11 | pub use tray_icon_impl::Tray; |
| 12 | |
| 13 | #[cfg(any(target_os = "linux", target_os = "macos"))] |
| 14 | mod linux_sound; |
| 15 | #[cfg(target_os = "linux")] |
| 16 | mod linux_tray; |
| 17 | #[cfg(not(windows))] |
| 18 | mod stub; |
| 19 | #[cfg(target_os = "linux")] |
| 20 | mod x11_input; |
| 21 | #[cfg(target_os = "linux")] |
| 22 | pub use linux_notifications::{ |
| 23 | BusNotification, DesktopNotifications, NotificationEvent, NotificationImage, |
| 24 | notifications_inhibited, |
| 25 | }; |
| 26 | #[cfg(target_os = "linux")] |
| 27 | pub use linux_tray::Tray; |
| 28 | #[cfg(not(windows))] |
| 29 | pub use stub::*; |
| 30 | |
| 31 | pub type NativeHandle = isize; |
| 32 | |
| 33 | #[cfg_attr(not(windows), allow(dead_code))] |
| 34 | mod stack_plan; |
| 35 | |
| 36 | #[derive(Debug, Clone, Copy, PartialEq)] |
| 37 | pub 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)] |
| 46 | pub struct ScreenRect { |
| 47 | pub left: i32, |
| 48 | pub top: i32, |
| 49 | pub right: i32, |
| 50 | pub bottom: i32, |
| 51 | } |
| 52 | |
| 53 | impl 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)] |
| 64 | pub struct ShareGeometry { |
| 65 | pub target: ScreenRect, |
| 66 | pub work: WorkArea, |
| 67 | } |
| 68 | |
| 69 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 70 | pub 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)] |
| 81 | pub struct TrayPresence { |
| 82 | pub title: String, |
| 83 | pub forced: Option<chatsvc::ForcedKind>, |
| 84 | pub mention: bool, |
| 85 | } |
| 86 | |
| 87 | impl 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 | } |