adding spacer
This commit is contained in:
parent
eb83bb3c38
commit
aaa21aff21
1 changed files with 28 additions and 16 deletions
38
src/main.rs
38
src/main.rs
|
@ -13,7 +13,7 @@ use iced::font::Weight;
|
|||
use iced::futures::SinkExt;
|
||||
use iced::stream;
|
||||
use iced::widget::image::Handle;
|
||||
use iced::widget::{container, horizontal_space, image, row, svg, text};
|
||||
use iced::widget::{button, container, horizontal_space, image, row, svg, text};
|
||||
use iced::{
|
||||
time, Background, Border, Color, Element, Event, Font, Length, Shadow, Subscription, Task,
|
||||
Vector,
|
||||
|
@ -92,7 +92,7 @@ struct Panel {
|
|||
}
|
||||
|
||||
#[to_layer_message]
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug)]
|
||||
enum Message {
|
||||
Launch(usize),
|
||||
Time(DateTime<Local>),
|
||||
|
@ -100,6 +100,8 @@ enum Message {
|
|||
WorkspaceChange(Vec<Workspace>),
|
||||
ActiveWorkspaceChange(event_listener::WorkspaceEventData),
|
||||
ActiveWindowChange((String, String)),
|
||||
AddSystemTray(SystemTray),
|
||||
None,
|
||||
}
|
||||
|
||||
impl Panel {
|
||||
|
@ -143,9 +145,9 @@ impl Panel {
|
|||
system_tray: None,
|
||||
};
|
||||
|
||||
// let sys_task = Task::perform(app.add_sys_tray(), |app| app = app );
|
||||
let sys_task = Task::perform(add_sys_tray(), |m| m);
|
||||
|
||||
(app, Task::none())
|
||||
(app, sys_task)
|
||||
}
|
||||
fn namespace(&self) -> String {
|
||||
String::from("panel")
|
||||
|
@ -204,7 +206,9 @@ impl Panel {
|
|||
}
|
||||
Message::ActiveWindowChange(w) => {
|
||||
debug!(?w);
|
||||
self.active_window = w.0;
|
||||
self.active_window =
|
||||
w.0.trim_start_matches("\u{180e}\u{200b}\u{200c}")
|
||||
.to_string();
|
||||
let class;
|
||||
if &w.1 == "lw" {
|
||||
class = "LibreWolf";
|
||||
|
@ -225,6 +229,11 @@ impl Panel {
|
|||
debug!(?svg);
|
||||
self.active_window_icon_svg = svg;
|
||||
}
|
||||
Message::AddSystemTray(system_tray) => {
|
||||
debug!(?system_tray);
|
||||
self.system_tray = Some(system_tray);
|
||||
}
|
||||
Message::None => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
Task::none()
|
||||
|
@ -404,10 +413,15 @@ impl Panel {
|
|||
)
|
||||
.color(Color::parse("#ff6ac1").unwrap());
|
||||
|
||||
let spacer = text!(" | ");
|
||||
|
||||
// let sys_tray = vec![button()]
|
||||
|
||||
let row = row!(
|
||||
container(row!(workspaces, icon, window, horizontal_space()).spacing(10)),
|
||||
container(clock),
|
||||
container(row!(horizontal_space(), disk, cpu, mem, battery).spacing(5))
|
||||
container(row!(horizontal_space(), disk, cpu, mem, battery).spacing(5)),
|
||||
spacer,
|
||||
)
|
||||
.spacing(5)
|
||||
.padding([0, 20]);
|
||||
|
@ -444,19 +458,17 @@ impl Panel {
|
|||
text_color: theme.palette().text,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn add_sys_tray(mut self) -> Self {
|
||||
async fn add_sys_tray() -> Message {
|
||||
let sys_tray = SystemTray::new().await;
|
||||
match sys_tray {
|
||||
Ok(s) => {
|
||||
self.system_tray = Some(s);
|
||||
}
|
||||
Ok(s) => Message::AddSystemTray(s),
|
||||
Err(e) => {
|
||||
error!(?e, "Sys tray couldn't be initialized")
|
||||
error!(?e, "Sys tray couldn't be initialized");
|
||||
Message::None
|
||||
}
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn convert(num: f64) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue