1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-18 07:11:04 +02:00

refactor: update to rust 2024, fix strict clippy warnings

This commit is contained in:
Jake Stanger 2025-02-21 16:35:54 +00:00
parent 79c917857c
commit 202c19efd4
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
57 changed files with 132 additions and 124 deletions

View file

@ -10,7 +10,7 @@ use hyprland::dispatch::{Dispatch, DispatchType, WorkspaceIdentifierWithSpecial}
use hyprland::event_listener::EventListener;
use hyprland::prelude::*;
use hyprland::shared::{HyprDataVec, WorkspaceType};
use tokio::sync::broadcast::{channel, Receiver, Sender};
use tokio::sync::broadcast::{Receiver, Sender, channel};
use tracing::{debug, error, info};
#[derive(Debug)]
@ -250,7 +250,7 @@ impl Client {
//
// Here we are trying to recover `layout_name` from `keyboard_name`
let layout = layout_event.keyboard_name.as_str().split(",").nth(1);
let layout = layout_event.keyboard_name.as_str().split(',').nth(1);
let Some(layout) = layout else {
error!(
"Failed to get layout from string: {}. The failed logic is a workaround for a bug in `hyprland 0.4.0-alpha.3`", layout_event.keyboard_name);

View file

@ -1,3 +1,4 @@
use crate::clients::ClientResult;
use crate::register_fallible_client;
use cfg_if::cfg_if;
use color_eyre::{Help, Report, Result};
@ -67,7 +68,7 @@ impl Compositor {
pub fn create_keyboard_layout_client(
clients: &mut super::Clients,
) -> Result<Arc<dyn KeyboardLayoutClient + Send + Sync>> {
) -> ClientResult<dyn KeyboardLayoutClient + Send + Sync> {
let current = Self::get_current();
debug!("Getting keyboard_layout client for: {current}");
match current {
@ -76,9 +77,7 @@ impl Compositor {
.sway()
.map(|client| client as Arc<dyn KeyboardLayoutClient + Send + Sync>),
#[cfg(feature = "keyboard+hyprland")]
Self::Hyprland => clients
.hyprland()
.map(|client| client as Arc<dyn KeyboardLayoutClient + Send + Sync>),
Self::Hyprland => Ok(clients.hyprland()),
Self::Niri | Self::Unsupported => Err(Report::msg("Unsupported compositor").note(
"Currently keyboard layout functionality are only supported by Sway and Hyprland",
)),
@ -98,9 +97,7 @@ impl Compositor {
.sway()
.map(|client| client as Arc<dyn WorkspaceClient + Send + Sync>),
#[cfg(feature = "workspaces+hyprland")]
Self::Hyprland => clients
.hyprland()
.map(|client| client as Arc<dyn WorkspaceClient + Send + Sync>),
Self::Hyprland => Ok(clients.hyprland()),
#[cfg(feature = "workspaces+niri")]
Self::Niri => Ok(Arc::new(niri::Client::new())),
Self::Unsupported => Err(Report::msg("Unsupported compositor")

View file

@ -3,7 +3,7 @@
/// to reduce compile times.
use crate::clients::compositor::Workspace as IronWorkspace;
use crate::{await_sync, clients::compositor::Visibility};
use color_eyre::eyre::{eyre, Result};
use color_eyre::eyre::{Result, eyre};
use core::str;
use serde::{Deserialize, Serialize};
use std::{env, path::Path};

View file

@ -6,7 +6,7 @@ use crate::clients::sway::Client;
use crate::{await_sync, error, send, spawn};
use color_eyre::Report;
use swayipc_async::{InputChange, InputEvent, Node, WorkspaceChange, WorkspaceEvent};
use tokio::sync::broadcast::{channel, Receiver};
use tokio::sync::broadcast::{Receiver, channel};
impl WorkspaceClient for Client {
fn focus(&self, id: i64) {