Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
MalpenZibo committed Nov 8, 2024
1 parent dece4bf commit f525e37
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 67 deletions.
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl App {
if let Some(clipboard_cmd) = self.config.clipboard_cmd.as_ref() {
utils::launcher::execute_command(clipboard_cmd.to_string());
}
Command::none()
Task::none()
}
Message::Workspaces(msg) => {
self.workspaces.update(msg);
Expand Down
7 changes: 3 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use app::App;
use config::{read_config, Position};
use config::read_config;
use flexi_logger::{
Age, Cleanup, Criterion, FileSpec, LogSpecBuilder, LogSpecification, Logger, Naming,
};
use iced::Font;
use log::{error, LevelFilter};
use log::error;
use std::panic;
use std::{backtrace::Backtrace, borrow::Cow, panic};
use std::{backtrace::Backtrace, borrow::Cow};

mod app;
mod centerbox;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use crate::{
components::icons::{icon, Icons},
style::HeaderButtonStyle,
};
use iced::{theme, widget::button, Element};
use iced::{widget::button, Element};

pub fn clipboard<'a>() -> Element<'a, Message> {
button(icon(Icons::Clipboard))
.padding([2, 7])
.on_press(Message::OpenClipboard)
.style(theme::Button::custom(HeaderButtonStyle::Full))
.style(HeaderButtonStyle::Full.into_style())
.into()
}
98 changes: 38 additions & 60 deletions src/modules/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ use iced::{
alignment,
stream::channel,
widget::{button, container, text, Row},
widget::{container, mouse_area, text, Row},
Background, Border, Color, Element, Element, Length, Length, Subscription, Subscription, Theme,
Element, Length, Subscription,
};
use log::{debug, error};
use std::{
Expand Down Expand Up @@ -238,18 +237,13 @@ impl Workspaces {
move |e| {
debug!("workspace added: {:?}", e);
let output = output.clone();
move |_| {
let output = output.clone();
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect(
"error getting workspaces: workspace added event",
);
}
})
}
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect("error getting workspaces: workspace added event");
}
})
}
});

Expand All @@ -258,18 +252,13 @@ impl Workspaces {
move |e| {
debug!("workspace changed: {:?}", e);
let output = output.clone();
move |_| {
let output = output.clone();
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect(
"error getting workspaces: workspace change event",
);
}
})
}
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect("error getting workspaces: workspace change event");
}
})
}
});

Expand All @@ -278,18 +267,15 @@ impl Workspaces {
move |e| {
debug!("workspace deleted: {:?}", e);
let output = output.clone();
move |_| {
let output = output.clone();
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect(
"error getting workspaces: workspace destroy event",
);
}
})
}
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect(
"error getting workspaces: workspace destroy event",
);
}
})
}
});

Expand All @@ -298,18 +284,13 @@ impl Workspaces {
move |e| {
debug!("workspace moved: {:?}", e);
let output = output.clone();
move |_| {
let output = output.clone();
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect(
"error getting workspaces: workspace moved event",
);
}
})
}
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect("error getting workspaces: workspace moved event");
}
})
}
});

Expand Down Expand Up @@ -351,16 +332,13 @@ impl Workspaces {
let output = output.clone();
move |_| {
let output = output.clone();
move |_| {
let output = output.clone();
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect("error getting workspaces: window close event");
}
})
}
Box::pin(async move {
if let Ok(mut output) = output.write() {
output
.try_send(Message::WorkspacesChanged(get_workspaces()))
.expect("error getting workspaces: window close event");
}
})
}
});

Expand Down

0 comments on commit f525e37

Please sign in to comment.