mod config; mod ui; use color_eyre::Result; use color_eyre::eyre::Report; use config::*; use gtk::prelude::*; use gtk::{Align, Button, Orientation}; use indexmap::IndexMap; use serde::Deserialize; use tokio::sync::mpsc; use super::{ModuleLocation, PopupButton}; use crate::channels::{AsyncSenderExt, BroadcastReceiverExt}; use crate::config::BarPosition; use crate::gtk_helpers::IronbarGtkExt; use crate::modules::{ Module, ModuleInfo, ModuleParts, ModulePopup, ModuleUpdateEvent, WidgetContext, }; use crate::{module_impl, spawn}; pub use config::MenuModule; /// XDG button and menu from parsed config. #[derive(Debug, Clone)] pub struct XdgSection { pub label: String, pub icon: Option, pub applications: IndexMap, } #[derive(Debug, Deserialize, Clone)] pub struct MenuApplication { pub label: String, pub file_name: String, pub categories: Vec, } #[derive(Debug)] pub enum MenuEntry { Xdg(XdgSection), Custom(CustomEntry), } impl MenuEntry { pub fn label(&self) -> String { match self { Self::Xdg(entry) => entry.label.clone(), Self::Custom(entry) => entry.label.clone(), } } pub fn icon(&self) -> Option { match self { Self::Xdg(entry) => entry.icon.clone(), Self::Custom(entry) => entry.icon.clone(), } } } impl Module