mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-19 02:06:57 +02:00
feat(bar): add more logging around error paths
This commit is contained in:
@@ -5,6 +5,7 @@ use crate::widget::BarWidget;
|
|||||||
use crate::MAX_LABEL_WIDTH;
|
use crate::MAX_LABEL_WIDTH;
|
||||||
use crate::WIDGET_SPACING;
|
use crate::WIDGET_SPACING;
|
||||||
use crossbeam_channel::Receiver;
|
use crossbeam_channel::Receiver;
|
||||||
|
use crossbeam_channel::TryRecvError;
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Color32;
|
use eframe::egui::Color32;
|
||||||
use eframe::egui::ColorImage;
|
use eframe::egui::ColorImage;
|
||||||
@@ -437,7 +438,16 @@ impl KomorebiNotificationState {
|
|||||||
rx_gui: Receiver<komorebi_client::Notification>,
|
rx_gui: Receiver<komorebi_client::Notification>,
|
||||||
bg_color: Rc<RefCell<Color32>>,
|
bg_color: Rc<RefCell<Color32>>,
|
||||||
) {
|
) {
|
||||||
if let Ok(notification) = rx_gui.try_recv() {
|
match rx_gui.try_recv() {
|
||||||
|
Err(error) => match error {
|
||||||
|
TryRecvError::Empty => {}
|
||||||
|
TryRecvError::Disconnected => {
|
||||||
|
tracing::error!(
|
||||||
|
"failed to receive komorebi notification on gui thread: {error}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Ok(notification) => {
|
||||||
if let NotificationEvent::Socket(SocketMessage::ReloadStaticConfiguration(path)) =
|
if let NotificationEvent::Socket(SocketMessage::ReloadStaticConfiguration(path)) =
|
||||||
notification.event
|
notification.event
|
||||||
{
|
{
|
||||||
@@ -471,7 +481,8 @@ impl KomorebiNotificationState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if should_add {
|
if should_add {
|
||||||
workspaces.push(ws.name().to_owned().unwrap_or_else(|| format!("{}", i + 1)));
|
workspaces
|
||||||
|
.push(ws.name().to_owned().unwrap_or_else(|| format!("{}", i + 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +500,8 @@ impl KomorebiNotificationState {
|
|||||||
self.layout = KomorebiLayout::Paused;
|
self.layout = KomorebiLayout::Paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(container) = monitor.workspaces()[focused_workspace_idx].monocle_container()
|
if let Some(container) =
|
||||||
|
monitor.workspaces()[focused_workspace_idx].monocle_container()
|
||||||
{
|
{
|
||||||
self.focused_container_information = (
|
self.focused_container_information = (
|
||||||
container
|
container
|
||||||
@@ -528,3 +540,4 @@ impl KomorebiNotificationState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
mod bar;
|
mod bar;
|
||||||
mod cpu;
|
|
||||||
mod battery;
|
mod battery;
|
||||||
mod config;
|
mod config;
|
||||||
|
mod cpu;
|
||||||
mod date;
|
mod date;
|
||||||
mod komorebi;
|
mod komorebi;
|
||||||
mod media;
|
mod media;
|
||||||
@@ -370,19 +370,22 @@ fn main() -> color_eyre::Result<()> {
|
|||||||
|
|
||||||
match String::from_utf8(buffer) {
|
match String::from_utf8(buffer) {
|
||||||
Ok(notification_string) => {
|
Ok(notification_string) => {
|
||||||
if let Ok(notification) =
|
match serde_json::from_str::<komorebi_client::Notification>(
|
||||||
serde_json::from_str::<komorebi_client::Notification>(
|
|
||||||
¬ification_string,
|
¬ification_string,
|
||||||
)
|
) {
|
||||||
{
|
Ok(notification) => {
|
||||||
tracing::debug!("received notification from komorebi");
|
tracing::debug!("received notification from komorebi");
|
||||||
|
|
||||||
if let Err(error) = tx_gui.send(notification) {
|
if let Err(error) = tx_gui.send(notification) {
|
||||||
tracing::error!("could not send komorebi notification update to gui: {error}")
|
tracing::error!("could not send komorebi notification update to gui thread: {error}")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx_komorebi.request_repaint();
|
ctx_komorebi.request_repaint();
|
||||||
}
|
}
|
||||||
|
Err(error) => {
|
||||||
|
tracing::error!("could not deserialize komorebi notification: {error}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
|
|||||||
Reference in New Issue
Block a user