summaryrefslogtreecommitdiff
path: root/src/wm_info_provider.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/wm_info_provider.rs')
-rw-r--r--src/wm_info_provider.rs41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/wm_info_provider.rs b/src/wm_info_provider.rs
index 12e4fb8..e11e48e 100644
--- a/src/wm_info_provider.rs
+++ b/src/wm_info_provider.rs
@@ -1,5 +1,3 @@
-mod river;
-
use wayrs_client::connection::Connection;
use wayrs_client::global::*;
@@ -7,9 +5,19 @@ 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(river::RiverInfoProvider),
+ River(RiverInfoProvider),
+ #[cfg(feature = "hyprland")]
+ Ewu(ExtWorkspaceUnstable),
}
pub type WmInfoCallback = fn(&mut Connection<State>, &mut State, WlOutput, WmInfo);
@@ -20,21 +28,33 @@ impl WmInfoProvider {
globals: &Globals,
callback: WmInfoCallback,
) -> WmInfoProvider {
- let Some(river) = river::RiverInfoProvider::bind(conn, globals, callback) else { return Self::None };
- Self::River(river)
+ if let Some(river) = RiverInfoProvider::bind(conn, globals, callback) {
+ 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(river) => river.new_output(conn, output),
+ Self::River(x) => x.new_output(conn, output),
+ #[cfg(feature = "hyprland")]
+ Self::Ewu(x) => x.new_ouput(conn, output),
}
}
pub fn output_removed(&mut self, conn: &mut Connection<State>, output: WlOutput) {
match self {
Self::None => (),
- Self::River(river) => river.output_removed(conn, output),
+ Self::River(x) => x.output_removed(conn, output),
+ #[cfg(feature = "hyprland")]
+ Self::Ewu(x) => x.output_removed(conn, output),
}
}
@@ -48,17 +68,20 @@ impl WmInfoProvider {
) {
match self {
Self::None => (),
- Self::River(river) => river.click_on_tag(conn, output, seat, tag, btn),
+ 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),
}
}
}
-#[derive(Default)]
+#[derive(Default, Debug)]
pub struct WmInfo {
pub layout_name: Option<String>,
pub tags: Vec<Tag>,
}
+#[derive(Debug)]
pub struct Tag {
pub name: String,
pub is_focused: bool,