mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-04 04:01:03 +02:00
feat: new focused window module
This commit is contained in:
parent
e416e03b0a
commit
dc14cb003f
13 changed files with 222 additions and 88 deletions
|
@ -1,4 +1,5 @@
|
|||
use crate::modules::{Module, ModuleInfo};
|
||||
use crate::sway::{Workspace, WorkspaceEvent};
|
||||
use gtk::prelude::*;
|
||||
use gtk::{Button, Orientation};
|
||||
use ksway::client::Client;
|
||||
|
@ -13,22 +14,10 @@ use tokio::task::spawn_blocking;
|
|||
pub struct WorkspacesModule {
|
||||
name_map: Option<HashMap<String, String>>,
|
||||
|
||||
#[serde(default = "default_false")]
|
||||
#[serde(default = "crate::config::default_false")]
|
||||
all_monitors: bool,
|
||||
}
|
||||
|
||||
const fn default_false() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct Workspace {
|
||||
name: String,
|
||||
focused: bool,
|
||||
// num: i32,
|
||||
output: String,
|
||||
}
|
||||
|
||||
impl Workspace {
|
||||
fn as_button(&self, name_map: &HashMap<String, String>, tx: &mpsc::Sender<String>) -> Button {
|
||||
let button = Button::builder()
|
||||
|
@ -52,13 +41,6 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct WorkspaceEvent {
|
||||
change: String,
|
||||
old: Option<Workspace>,
|
||||
current: Option<Workspace>,
|
||||
}
|
||||
|
||||
impl Module<gtk::Box> for WorkspacesModule {
|
||||
fn into_widget(self, info: &ModuleInfo) -> gtk::Box {
|
||||
let mut sway = Client::connect().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue