add os guards

This commit is contained in:
George
2026-03-22 21:47:00 +04:00
parent 6ca275ab59
commit ba0af952d9
2 changed files with 3 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ use tray_icon::{
};
use winit::{application::ApplicationHandler, event::StartCause};
#[cfg(target_os = "windows")]
use crate::tray_battery_icon_state::{TrayBatteryIconState, WindowsIconKey};
const NO_COMPATIBLE_DEVICE: &str = "No compatible device found. Is the dongle plugged in?";

View File

@@ -12,6 +12,7 @@ pub enum TrayBatteryIconState {
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg(target_os = "windows")]
pub struct WindowsIconKey {
pub percent: u8,
pub charging: bool,
@@ -38,6 +39,7 @@ impl TrayBatteryIconState {
}
}
#[cfg(target_os = "windows")]
pub fn windows_icon_key(self) -> Option<WindowsIconKey> {
match self {
Self::Connected { percent, charging } => Some(WindowsIconKey { percent, charging }),