mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-16 22:31:03 +02:00
build: fix more coupling issues with keyboard/workspace/sway
This commit is contained in:
parent
caa288656c
commit
557ef4c898
4 changed files with 14 additions and 18 deletions
|
@ -95,7 +95,7 @@ workspaces = ["futures-lite"]
|
||||||
"workspaces+hyprland" = ["workspaces", "hyprland"]
|
"workspaces+hyprland" = ["workspaces", "hyprland"]
|
||||||
"workspaces+niri" = ["workspaces"]
|
"workspaces+niri" = ["workspaces"]
|
||||||
|
|
||||||
sway = ["swayipc-async"]
|
sway = ["swayipc-async", "futures-lite"]
|
||||||
|
|
||||||
schema = ["dep:schemars"]
|
schema = ["dep:schemars"]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use super::{
|
use super::{KeyboardLayoutClient, KeyboardLayoutUpdate, Visibility, Workspace, WorkspaceUpdate};
|
||||||
KeyboardLayoutClient, KeyboardLayoutUpdate, Visibility, Workspace, WorkspaceClient,
|
|
||||||
WorkspaceUpdate,
|
|
||||||
};
|
|
||||||
use crate::{arc_mut, lock, send, spawn_blocking};
|
use crate::{arc_mut, lock, send, spawn_blocking};
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
use hyprland::ctl::switch_xkb_layout;
|
use hyprland::ctl::switch_xkb_layout;
|
||||||
|
@ -326,7 +323,8 @@ impl Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WorkspaceClient for Client {
|
#[cfg(feature = "workspaces")]
|
||||||
|
impl super::WorkspaceClient for Client {
|
||||||
fn focus(&self, id: i64) {
|
fn focus(&self, id: i64) {
|
||||||
let identifier = WorkspaceIdentifierWithSpecial::Id(id as i32);
|
let identifier = WorkspaceIdentifierWithSpecial::Id(id as i32);
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,17 @@ use std::sync::Arc;
|
||||||
use tokio::sync::broadcast;
|
use tokio::sync::broadcast;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
#[cfg(feature = "workspaces+hyprland")]
|
#[cfg(any(feature = "keyboard+hyprland", feature = "workspaces+hyprland"))]
|
||||||
pub mod hyprland;
|
pub mod hyprland;
|
||||||
#[cfg(feature = "workspaces+niri")]
|
#[cfg(feature = "workspaces+niri")]
|
||||||
pub mod niri;
|
pub mod niri;
|
||||||
#[cfg(feature = "workspaces+sway")]
|
#[cfg(any(feature = "keyboard+sway", feature = "workspaces+sway"))]
|
||||||
pub mod sway;
|
pub mod sway;
|
||||||
|
|
||||||
pub enum Compositor {
|
pub enum Compositor {
|
||||||
#[cfg(feature = "workspaces+sway")]
|
#[cfg(any(feature = "keyboard+sway", feature = "workspaces+sway"))]
|
||||||
Sway,
|
Sway,
|
||||||
#[cfg(feature = "workspaces+hyprland")]
|
#[cfg(any(feature = "keyboard+hyprland", feature = "workspaces+hyprland"))]
|
||||||
Hyprland,
|
Hyprland,
|
||||||
#[cfg(feature = "workspaces+niri")]
|
#[cfg(feature = "workspaces+niri")]
|
||||||
Niri,
|
Niri,
|
||||||
|
@ -30,9 +30,9 @@ impl Display for Compositor {
|
||||||
f,
|
f,
|
||||||
"{}",
|
"{}",
|
||||||
match self {
|
match self {
|
||||||
#[cfg(feature = "workspaces+sway")]
|
#[cfg(any(feature = "keyboard+sway", feature = "workspaces+sway"))]
|
||||||
Self::Sway => "Sway",
|
Self::Sway => "Sway",
|
||||||
#[cfg(feature = "workspaces+hyprland")]
|
#[cfg(any(feature = "keyboard+sway", feature = "workspaces+hyprland"))]
|
||||||
Self::Hyprland => "Hyprland",
|
Self::Hyprland => "Hyprland",
|
||||||
#[cfg(feature = "workspaces+niri")]
|
#[cfg(feature = "workspaces+niri")]
|
||||||
Self::Niri => "Niri",
|
Self::Niri => "Niri",
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
use super::{
|
use super::{KeyboardLayoutClient, KeyboardLayoutUpdate, Visibility, Workspace, WorkspaceUpdate};
|
||||||
KeyboardLayoutClient, KeyboardLayoutUpdate, Visibility, Workspace, WorkspaceClient,
|
|
||||||
WorkspaceUpdate,
|
|
||||||
};
|
|
||||||
use crate::clients::sway::Client;
|
use crate::clients::sway::Client;
|
||||||
use crate::{await_sync, error, send, spawn};
|
use crate::{await_sync, error, send, spawn};
|
||||||
use color_eyre::Report;
|
use color_eyre::Report;
|
||||||
use swayipc_async::{InputChange, InputEvent, Node, WorkspaceChange, WorkspaceEvent};
|
use swayipc_async::{InputChange, InputEvent, Node, WorkspaceChange, WorkspaceEvent};
|
||||||
use tokio::sync::broadcast::{Receiver, channel};
|
use tokio::sync::broadcast::{Receiver, channel};
|
||||||
|
|
||||||
impl WorkspaceClient for Client {
|
#[cfg(feature = "workspaces")]
|
||||||
|
impl super::WorkspaceClient for Client {
|
||||||
fn focus(&self, id: i64) {
|
fn focus(&self, id: i64) {
|
||||||
let client = self.connection().clone();
|
let client = self.connection().clone();
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
|
@ -215,7 +213,7 @@ impl KeyboardLayoutClient for Client {
|
||||||
impl TryFrom<InputEvent> for KeyboardLayoutUpdate {
|
impl TryFrom<InputEvent> for KeyboardLayoutUpdate {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from(value: InputEvent) -> std::result::Result<Self, Self::Error> {
|
fn try_from(value: InputEvent) -> Result<Self, Self::Error> {
|
||||||
match value.change {
|
match value.change {
|
||||||
InputChange::XkbLayout => {
|
InputChange::XkbLayout => {
|
||||||
if let Some(layout) = value.input.xkb_active_layout_name {
|
if let Some(layout) = value.input.xkb_active_layout_name {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue