summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml8
-rw-r--r--src/shared_state.rs3
-rw-r--r--src/wm_info_provider.rs9
3 files changed, 19 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 2dcdce7..8c06541 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,12 +16,18 @@ serde_json = "1"
serde = { version = "1", features = ["derive"] }
signal-hook = { version = "0.3", default-features = false }
toml = { version = "0.8", default-features = false, features = ["parse"] }
-wayrs-client = "1.0"
+wayrs-client = "1.0"
wayrs-protocols = { version = "0.14", features = ["wlr-layer-shell-unstable-v1", "viewporter", "fractional-scale-v1"] }
wayrs-utils = { version = "0.17", features = ["cursor", "shm_alloc", "seats"] }
clap = { version = "4.3", default-features = false, features = ["derive", "std", "help", "usage"] }
libc = "0.2"
+[features]
+default = ["river", "niri", "hyprland"]
+river = []
+niri = []
+hyprland = []
+
[profile.release]
lto = "fat"
strip = true
diff --git a/src/shared_state.rs b/src/shared_state.rs
index 169107b..015fa08 100644
--- a/src/shared_state.rs
+++ b/src/shared_state.rs
@@ -22,14 +22,17 @@ impl SharedState {
<dyn Any>::downcast_mut(self.wm_info_provider.as_mut())
}
+ #[cfg(feature = "river")]
pub fn get_river(&mut self) -> Option<&mut wm_info_provider::RiverInfoProvider> {
self.downcast_provider()
}
+ #[cfg(feature = "hyprland")]
pub fn get_hyprland(&mut self) -> Option<&mut wm_info_provider::HyprlandInfoProvider> {
self.downcast_provider()
}
+ #[cfg(feature = "niri")]
pub fn get_niri(&mut self) -> Option<&mut wm_info_provider::NiriInfoProvider> {
self.downcast_provider()
}
diff --git a/src/wm_info_provider.rs b/src/wm_info_provider.rs
index 4c5e904..2beff89 100644
--- a/src/wm_info_provider.rs
+++ b/src/wm_info_provider.rs
@@ -12,13 +12,19 @@ use crate::state::State;
mod dummy;
pub use dummy::*;
+#[cfg(feature = "river")]
mod river;
+#[cfg(feature = "river")]
pub use river::*;
+#[cfg(feature = "hyprland")]
mod hyprland;
+#[cfg(feature = "hyprland")]
pub use hyprland::*;
+#[cfg(feature = "niri")]
mod niri;
+#[cfg(feature = "niri")]
pub use niri::*;
pub trait WmInfoProvider: Any {
@@ -49,14 +55,17 @@ pub trait WmInfoProvider: Any {
}
pub fn bind(conn: &mut Connection<State>, config: &WmConfig) -> Box<dyn WmInfoProvider> {
+ #[cfg(feature = "river")]
if let Some(river) = RiverInfoProvider::bind(conn, config) {
return Box::new(river);
}
+ #[cfg(feature = "hyprland")]
if let Some(hyprland) = HyprlandInfoProvider::new() {
return Box::new(hyprland);
}
+ #[cfg(feature = "niri")]
if let Some(niri) = NiriInfoProvider::new() {
return Box::new(niri);
}