mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 02:31:04 +02:00
build: update deps
new corn version allows unicode keys :)
This commit is contained in:
parent
6442667961
commit
ee67b3be28
6 changed files with 90 additions and 233 deletions
|
@ -1,7 +1,8 @@
|
|||
use lazy_static::lazy_static;
|
||||
use mpd_client::commands::responses::Status;
|
||||
use mpd_client::raw::MpdProtocolError;
|
||||
use mpd_client::{Client, Connection};
|
||||
use mpd_client::client::Connection;
|
||||
use mpd_client::protocol::MpdProtocolError;
|
||||
use mpd_client::responses::Status;
|
||||
use mpd_client::Client;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
|
|
@ -10,8 +10,9 @@ use dirs::{audio_dir, home_dir};
|
|||
use glib::Continue;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{Button, Orientation};
|
||||
use mpd_client::commands::responses::{PlayState, Song, Status};
|
||||
use mpd_client::{commands, Tag};
|
||||
use mpd_client::commands;
|
||||
use mpd_client::responses::{PlayState, Song, Status};
|
||||
use mpd_client::tag::Tag;
|
||||
use regex::Regex;
|
||||
use serde::Deserialize;
|
||||
use std::path::PathBuf;
|
||||
|
|
|
@ -2,7 +2,7 @@ pub use crate::popup::Popup;
|
|||
use gtk::gdk_pixbuf::Pixbuf;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{Button, Image, Label, Orientation};
|
||||
use mpd_client::commands::responses::{PlayState, Song, Status};
|
||||
use mpd_client::responses::{PlayState, Song, Status};
|
||||
use std::path::Path;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
|
|
21
src/style.rs
21
src/style.rs
|
@ -2,10 +2,8 @@ use color_eyre::{Help, Report};
|
|||
use glib::Continue;
|
||||
use gtk::prelude::CssProviderExt;
|
||||
use gtk::{gdk, gio, CssProvider, StyleContext};
|
||||
use notify::{DebouncedEvent, RecursiveMode, Watcher};
|
||||
use notify::{Event, RecursiveMode, Result, Watcher};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::mpsc;
|
||||
use std::time::Duration;
|
||||
use tokio::spawn;
|
||||
use tracing::{error, info};
|
||||
|
||||
|
@ -28,21 +26,22 @@ pub fn load_css(style_path: PathBuf) {
|
|||
let screen = gdk::Screen::default().expect("Failed to get default GTK screen");
|
||||
StyleContext::add_provider_for_screen(&screen, &provider, 800);
|
||||
|
||||
let (watcher_tx, watcher_rx) = mpsc::channel::<DebouncedEvent>();
|
||||
let (tx, rx) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
|
||||
|
||||
spawn(async move {
|
||||
match notify::watcher(watcher_tx, Duration::from_millis(500)) {
|
||||
match notify::recommended_watcher(move |res: Result<Event>| match res {
|
||||
Ok(event) => {
|
||||
if let Some(path) = event.paths.first() {
|
||||
tx.send(path.clone())
|
||||
.expect("Failed to send style changed message");
|
||||
}
|
||||
}
|
||||
Err(e) => error!("Error occurred when watching stylesheet: {:?}", e),
|
||||
}) {
|
||||
Ok(mut watcher) => {
|
||||
watcher
|
||||
.watch(&style_path, RecursiveMode::NonRecursive)
|
||||
.expect("Unexpected error when attempting to watch CSS");
|
||||
|
||||
loop {
|
||||
if let Ok(DebouncedEvent::Write(path)) = watcher_rx.recv() {
|
||||
tx.send(path).expect("Failed to send style changed message");
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => error!(
|
||||
"{:?}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue