summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxVerevkin <maxxverrr@gmail.com>2023-06-01 16:32:34 +0300
committerMaxVerevkin <maxxverrr@gmail.com>2023-06-01 16:32:34 +0300
commit13c08ca31ee1ccbbeceb8962d739a077048d59ac (patch)
tree9fe36b384cf106a02da8ecb4fb4cd93185b3755c /src
parent2c9bc7c4b6609bf6b840f6494618034a6dd3cafc (diff)
downloadi3bar-mango-13c08ca31ee1ccbbeceb8962d739a077048d59ac.tar.gz
pub hyprland support behind feature flag
Diffstat (limited to 'src')
-rw-r--r--src/protocol.rs2
-rw-r--r--src/wm_info_provider.rs26
-rw-r--r--src/wm_info_provider/ext_workspace_unstable.rs1
-rw-r--r--src/wm_info_provider/river.rs1
4 files changed, 20 insertions, 10 deletions
diff --git a/src/protocol.rs b/src/protocol.rs
index c393850..d14d92a 100644
--- a/src/protocol.rs
+++ b/src/protocol.rs
@@ -4,4 +4,6 @@ pub use wayrs_protocols::viewporter::*;
pub use wayrs_protocols::wlr_layer_shell_unstable_v1::*;
wayrs_client::scanner::generate!("protocols/river-status-unstable-v1.xml");
wayrs_client::scanner::generate!("protocols/river-control-unstable-v1.xml");
+
+#[cfg(feature = "hyprland")]
wayrs_client::scanner::generate!("protocols/ext-workspace-unstable-v1.xml");
diff --git a/src/wm_info_provider.rs b/src/wm_info_provider.rs
index 134bc77..e11e48e 100644
--- a/src/wm_info_provider.rs
+++ b/src/wm_info_provider.rs
@@ -1,18 +1,22 @@
-mod ext_workspace_unstable;
-mod river;
-
use wayrs_client::connection::Connection;
use wayrs_client::global::*;
use crate::pointer_btn::PointerBtn;
use crate::protocol::*;
use crate::state::State;
+
+#[cfg(feature = "hyprland")]
+mod ext_workspace_unstable;
+#[cfg(feature = "hyprland")]
use ext_workspace_unstable::*;
+
+mod river;
use river::*;
pub enum WmInfoProvider {
None,
River(RiverInfoProvider),
+ #[cfg(feature = "hyprland")]
Ewu(ExtWorkspaceUnstable),
}
@@ -25,18 +29,22 @@ impl WmInfoProvider {
callback: WmInfoCallback,
) -> WmInfoProvider {
if let Some(river) = RiverInfoProvider::bind(conn, globals, callback) {
- Self::River(river)
- } else if let Some(ext_wp_u) = ExtWorkspaceUnstable::bind(conn, globals, callback) {
- Self::Ewu(ext_wp_u)
- } else {
- Self::None
+ return Self::River(river);
}
+
+ #[cfg(feature = "hyprland")]
+ if let Some(ext_wp_u) = ExtWorkspaceUnstable::bind(conn, globals, callback) {
+ return Self::Ewu(ext_wp_u);
+ }
+
+ Self::None
}
pub fn new_ouput(&mut self, conn: &mut Connection<State>, output: WlOutput) {
match self {
Self::None => (),
Self::River(x) => x.new_output(conn, output),
+ #[cfg(feature = "hyprland")]
Self::Ewu(x) => x.new_ouput(conn, output),
}
}
@@ -45,6 +53,7 @@ impl WmInfoProvider {
match self {
Self::None => (),
Self::River(x) => x.output_removed(conn, output),
+ #[cfg(feature = "hyprland")]
Self::Ewu(x) => x.output_removed(conn, output),
}
}
@@ -60,6 +69,7 @@ impl WmInfoProvider {
match self {
Self::None => (),
Self::River(x) => x.click_on_tag(conn, output, seat, tag, btn),
+ #[cfg(feature = "hyprland")]
Self::Ewu(x) => x.click_on_tag(conn, output, seat, tag, btn),
}
}
diff --git a/src/wm_info_provider/ext_workspace_unstable.rs b/src/wm_info_provider/ext_workspace_unstable.rs
index 793f78f..0af550b 100644
--- a/src/wm_info_provider/ext_workspace_unstable.rs
+++ b/src/wm_info_provider/ext_workspace_unstable.rs
@@ -4,7 +4,6 @@ use wayrs_client::object::ObjectId;
use wayrs_client::proxy::Proxy;
use super::*;
-use crate::protocol::*;
use crate::state::State;
pub struct ExtWorkspaceUnstable {
diff --git a/src/wm_info_provider/river.rs b/src/wm_info_provider/river.rs
index c7740a3..82fa5d8 100644
--- a/src/wm_info_provider/river.rs
+++ b/src/wm_info_provider/river.rs
@@ -4,7 +4,6 @@ use wayrs_client::connection::Connection;
use wayrs_client::{cstr, global::*};
use super::*;
-use crate::protocol::*;
use crate::state::State;
pub struct RiverInfoProvider {