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

refactor: tidy and format

This commit is contained in:
Jake Stanger 2022-10-10 21:59:44 +01:00
parent b1c66b9117
commit 5ce50b0987
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
10 changed files with 73 additions and 126 deletions

View file

@ -4,12 +4,12 @@ use crate::icon::get_icon;
use crate::modules::launcher::{ItemEvent, LauncherUpdate};
use crate::modules::ModuleUpdateEvent;
use crate::popup::Popup;
use crate::wayland::ToplevelInfo;
use gtk::prelude::*;
use gtk::{Button, IconTheme, Image};
use std::rc::Rc;
use std::sync::RwLock;
use tokio::sync::mpsc::Sender;
use crate::wayland::ToplevelInfo;
#[derive(Debug, Clone)]
pub struct Item {

View file

@ -108,7 +108,7 @@ impl Module<gtk::Box> for LauncherModule {
let mut items = items.lock().expect("Failed to get lock on items");
for (window, _) in open_windows.clone().into_iter() {
for (window, _) in open_windows.clone() {
let item = items.get_mut(&window.app_id);
match item {
Some(item) => {
@ -154,7 +154,8 @@ impl Module<gtk::Box> for LauncherModule {
ToplevelChange::New => {
let new_item = {
let mut items = items();
match items.get_mut(&app_id) {
let item = items.get_mut(&app_id);
match item {
None => {
let item: Item = window.into();
items.insert(app_id.clone(), item.clone());
@ -180,7 +181,8 @@ impl Module<gtk::Box> for LauncherModule {
ToplevelChange::Close => {
let remove_item = {
let mut items = items();
match items.get_mut(&app_id) {
let item = items.get_mut(&app_id);
match item {
Some(item) => {
item.unmerge_toplevel(&window);
@ -239,7 +241,7 @@ impl Module<gtk::Box> for LauncherModule {
send_update(LauncherUpdate::Title(app_id, window.id, title)).await?;
}
_ => {}
ToplevelChange::Fullscreen(_) => {}
}
}
@ -290,7 +292,7 @@ impl Module<gtk::Box> for LauncherModule {
.toplevels
.read()
.expect("Failed to get read lock on toplevels");
let seat = wl.seats.first().unwrap();
let seat = wl.seats.first().expect("Failed to get Wayland seat");
if let Some((_top, handle)) = toplevels.get(&id) {
handle.activate(seat);
};