add os guards
This commit is contained in:
@@ -12,6 +12,7 @@ use tray_icon::{
|
|||||||
};
|
};
|
||||||
use winit::{application::ApplicationHandler, event::StartCause};
|
use winit::{application::ApplicationHandler, event::StartCause};
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
use crate::tray_battery_icon_state::{TrayBatteryIconState, WindowsIconKey};
|
use crate::tray_battery_icon_state::{TrayBatteryIconState, WindowsIconKey};
|
||||||
|
|
||||||
const NO_COMPATIBLE_DEVICE: &str = "No compatible device found. Is the dongle plugged in?";
|
const NO_COMPATIBLE_DEVICE: &str = "No compatible device found. Is the dongle plugged in?";
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ pub enum TrayBatteryIconState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
pub struct WindowsIconKey {
|
pub struct WindowsIconKey {
|
||||||
pub percent: u8,
|
pub percent: u8,
|
||||||
pub charging: bool,
|
pub charging: bool,
|
||||||
@@ -38,6 +39,7 @@ impl TrayBatteryIconState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
pub fn windows_icon_key(self) -> Option<WindowsIconKey> {
|
pub fn windows_icon_key(self) -> Option<WindowsIconKey> {
|
||||||
match self {
|
match self {
|
||||||
Self::Connected { percent, charging } => Some(WindowsIconKey { percent, charging }),
|
Self::Connected { percent, charging } => Some(WindowsIconKey { percent, charging }),
|
||||||
|
|||||||
Reference in New Issue
Block a user