refactor(rust): use eyre::Result uniformly

Matching the emerging style in komorebi for Mac
This commit is contained in:
LGUG2Z
2025-09-30 18:21:11 -07:00
parent 52a745d0a3
commit 6eb2905e00
20 changed files with 328 additions and 285 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
use crate::config::LabelPrefix;
use crate::render::RenderConfig;
use crate::widgets::widget::BarWidget;
use color_eyre::eyre;
use eframe::egui::Align;
use eframe::egui::Context;
use eframe::egui::Label;
@@ -80,7 +81,7 @@ pub struct Keyboard {
/// - `Ok(String)`: The name of the active keyboard layout as a valid UTF-8 string.
/// - `Err(())`: Indicates that the function failed to retrieve the locale name or encountered
/// invalid UTF-16 characters during conversion.
fn get_active_keyboard_layout() -> Result<String, ()> {
fn get_active_keyboard_layout() -> eyre::Result<String, ()> {
let foreground_window_tid = unsafe { GetWindowThreadProcessId(GetForegroundWindow(), None) };
let lcid = unsafe { GetKeyboardLayout(foreground_window_tid) };
+2 -1
View File
@@ -2,6 +2,7 @@ use crate::config::DisplayFormat;
use crate::render::RenderConfig;
use crate::selected_frame::SelectableFrame;
use crate::widgets::komorebi::KomorebiLayoutConfig;
use color_eyre::eyre;
use eframe::egui::Context;
use eframe::egui::CornerRadius;
use eframe::egui::FontId;
@@ -34,7 +35,7 @@ pub enum KomorebiLayout {
}
impl<'de> Deserialize<'de> for KomorebiLayout {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D>(deserializer: D) -> eyre::Result<Self, D::Error>
where
D: Deserializer<'de>,
{