1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-02 03:01:04 +02:00

feat(focused): ability to truncate label text

This commit is contained in:
Jake Stanger 2023-01-28 23:01:44 +00:00
parent 97502559b3
commit 07dbf78010
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
6 changed files with 77 additions and 61 deletions

View file

@ -1,5 +1,5 @@
use crate::clients::wayland::{self, ToplevelChange};
use crate::config::CommonConfig;
use crate::config::{CommonConfig, TruncateMode};
use crate::modules::{Module, ModuleInfo, ModuleUpdateEvent, ModuleWidget, WidgetContext};
use crate::{await_sync, icon, read_lock, send_async};
use color_eyre::Result;
@ -25,6 +25,8 @@ pub struct FocusedModule {
/// GTK icon theme to use.
icon_theme: Option<String>,
truncate: Option<TruncateMode>,
#[serde(flatten)]
pub common: Option<CommonConfig>,
}
@ -102,6 +104,10 @@ impl Module<gtk::Box> for FocusedModule {
let icon = Image::builder().name("icon").build();
let label = Label::builder().name("label").build();
if let Some(truncate) = self.truncate {
truncate.truncate_label(&label);
}
container.add(&icon);
container.add(&label);