diff --git a/man/waybar-wlr-taskbar.5.scd b/man/waybar-wlr-taskbar.5.scd index 56d0b228..ae30316b 100644 --- a/man/waybar-wlr-taskbar.5.scd +++ b/man/waybar-wlr-taskbar.5.scd @@ -84,6 +84,11 @@ Addressed by *wlr/taskbar* default: false ++ If set to true, task buttons stretch to fill the available space in the taskbar and long titles are ellipsized to fit. Only takes effect on a horizontal bar; on a vertical bar the buttons keep their content-based size. If set to false, buttons are sized to their content. +*truncate*: ++ + typeof: bool ++ + default: false ++ + If set to true, the task button text will be ellipsized (truncated with …) when the available button width is smaller than the label text. + *on-click*: ++ typeof: string ++ The action which should be triggered when clicking on the application button with the left mouse button. diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp index 2cfe1736..206a6b0e 100644 --- a/src/modules/wlr/taskbar.cpp +++ b/src/modules/wlr/taskbar.cpp @@ -138,6 +138,17 @@ Task::Task(const waybar::Bar& bar, const Json::Value& config, Taskbar* tbar, content_.show(); button.add(content_); + // Apply optional label truncation (ellipsize). + if (config_["truncate"].isBool() && config_["truncate"].asBool()) { + text_before_.set_single_line_mode(true); + text_before_.set_ellipsize(Pango::ELLIPSIZE_END); + text_before_.set_line_wrap(false); + + text_after_.set_single_line_mode(true); + text_after_.set_ellipsize(Pango::ELLIPSIZE_END); + text_after_.set_line_wrap(false); + } + format_before_.clear(); format_after_.clear();