Skip to content

Commit

Permalink
Fix build on non-linux platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Exidex committed Dec 31, 2024
1 parent 40e8d57 commit 434dd7a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rust/plugin_runtime/src/plugins/applications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,25 @@ pub fn wayland(state: Rc<RefCell<OpState>>) -> bool {
}

pub enum DesktopEnvironment {
#[cfg(target_os = "linux")]
Linux(linux::LinuxDesktopEnvironment),
None,
}

impl DesktopEnvironment {
fn new() -> anyhow::Result<Self> {
#[cfg(target_os = "linux")]
Ok(Self::Linux(linux::LinuxDesktopEnvironment::new()?))
let result = Ok(Self::Linux(linux::LinuxDesktopEnvironment::new()?));

#[cfg(not(target_os = "linux"))]
let result = None;

result
}

fn is_wayland(&self) -> bool {
match self {
DesktopEnvironment::Linux(linux) => linux.is_wayland()
DesktopEnvironment::Linux(linux) => linux.is_wayland(),
DesktopEnvironment::None => false
}
}
}
Expand Down

0 comments on commit 434dd7a

Please sign in to comment.