fix: add cfg for unix only packages
This commit is contained in:
parent
58fc034459
commit
b2ce4ccea2
2 changed files with 16 additions and 6 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub use freedesktop_desktop_entry::DesktopEntry;
|
pub use freedesktop_desktop_entry::DesktopEntry;
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub use mime::Mime;
|
pub use mime::Mime;
|
||||||
use std::{
|
use std::path::{Path, PathBuf};
|
||||||
borrow::Cow,
|
#[cfg(not(windows))]
|
||||||
ffi::OsStr,
|
use std::{borrow::Cow, ffi::OsStr};
|
||||||
path::{Path, PathBuf},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum IconSource {
|
pub enum IconSource {
|
||||||
|
|
@ -42,12 +42,14 @@ impl Default for IconSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct DesktopAction {
|
pub struct DesktopAction {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub exec: String,
|
pub exec: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
pub struct DesktopEntryData {
|
pub struct DesktopEntryData {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -62,6 +64,7 @@ pub struct DesktopEntryData {
|
||||||
pub prefers_dgpu: bool,
|
pub prefers_dgpu: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub fn load_applications<'a>(
|
pub fn load_applications<'a>(
|
||||||
locale: impl Into<Option<&'a str>>,
|
locale: impl Into<Option<&'a str>>,
|
||||||
include_no_display: bool,
|
include_no_display: bool,
|
||||||
|
|
@ -69,6 +72,7 @@ pub fn load_applications<'a>(
|
||||||
load_applications_filtered(locale, |de| include_no_display || !de.no_display())
|
load_applications_filtered(locale, |de| include_no_display || !de.no_display())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> bool {
|
pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> bool {
|
||||||
let lowercase_wm_class = match entry.wm_class.as_ref() {
|
let lowercase_wm_class = match entry.wm_class.as_ref() {
|
||||||
Some(s) => Some(s.to_lowercase()),
|
Some(s) => Some(s.to_lowercase()),
|
||||||
|
|
@ -80,6 +84,7 @@ pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> boo
|
||||||
|| app_id.to_lowercase() == entry.name.to_lowercase()
|
|| app_id.to_lowercase() == entry.name.to_lowercase()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub fn load_applications_for_app_ids<'a, 'b>(
|
pub fn load_applications_for_app_ids<'a, 'b>(
|
||||||
locale: impl Into<Option<&'a str>>,
|
locale: impl Into<Option<&'a str>>,
|
||||||
app_ids: impl Iterator<Item = &'b str>,
|
app_ids: impl Iterator<Item = &'b str>,
|
||||||
|
|
@ -123,6 +128,7 @@ pub fn load_applications_for_app_ids<'a, 'b>(
|
||||||
applications
|
applications
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub fn load_applications_filtered<'a, F: FnMut(&DesktopEntry) -> bool>(
|
pub fn load_applications_filtered<'a, F: FnMut(&DesktopEntry) -> bool>(
|
||||||
locale: impl Into<Option<&'a str>>,
|
locale: impl Into<Option<&'a str>>,
|
||||||
mut filter: F,
|
mut filter: F,
|
||||||
|
|
@ -148,6 +154,7 @@ pub fn load_applications_filtered<'a, F: FnMut(&DesktopEntry) -> bool>(
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub fn load_desktop_file<'a>(
|
pub fn load_desktop_file<'a>(
|
||||||
locale: impl Into<Option<&'a str>>,
|
locale: impl Into<Option<&'a str>>,
|
||||||
path: impl AsRef<Path>,
|
path: impl AsRef<Path>,
|
||||||
|
|
@ -160,6 +167,7 @@ pub fn load_desktop_file<'a>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
impl DesktopEntryData {
|
impl DesktopEntryData {
|
||||||
fn from_desktop_entry<'a>(
|
fn from_desktop_entry<'a>(
|
||||||
locale: impl Into<Option<&'a str>>,
|
locale: impl Into<Option<&'a str>>,
|
||||||
|
|
@ -229,6 +237,7 @@ impl DesktopEntryData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub async fn spawn_desktop_exec<S, I, K, V>(exec: S, env_vars: I, app_id: Option<&str>)
|
pub async fn spawn_desktop_exec<S, I, K, V>(exec: S, env_vars: I, app_id: Option<&str>)
|
||||||
where
|
where
|
||||||
S: AsRef<str>,
|
S: AsRef<str>,
|
||||||
|
|
@ -293,6 +302,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
#[cfg(feature = "desktop-systemd-scope")]
|
#[cfg(feature = "desktop-systemd-scope")]
|
||||||
#[zbus::proxy(
|
#[zbus::proxy(
|
||||||
interface = "org.freedesktop.systemd1.Manager",
|
interface = "org.freedesktop.systemd1.Manager",
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ pub mod keyboard_nav;
|
||||||
|
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
pub mod desktop;
|
pub mod desktop;
|
||||||
#[cfg(feature = "process")]
|
#[cfg(all(feature = "process", not(windows)))]
|
||||||
pub mod process;
|
pub mod process;
|
||||||
|
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue