From 12af08edb7423a1753302e2be94a6699d9e3b27a Mon Sep 17 00:00:00 2001 From: rawalrauf Date: Tue, 9 Dec 2025 09:43:49 +0000 Subject: [PATCH] feat(wlr/taskbar): add active-last option Add 'active-last' configuration option to wlr-taskbar module. This option moves the currently active window to the last position in the taskbar, complementing the existing 'active-first' option. Usage: "wlr/taskbar": { "active-last": true } Note: active-first and active-last are mutually exclusive options. --- man/waybar-wlr-taskbar.5.scd | 7 ++++++- src/modules/wlr/taskbar.cpp | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/man/waybar-wlr-taskbar.5.scd b/man/waybar-wlr-taskbar.5.scd index af1ba97f7..5d2cd97f8 100644 --- a/man/waybar-wlr-taskbar.5.scd +++ b/man/waybar-wlr-taskbar.5.scd @@ -52,10 +52,15 @@ Addressed by *wlr/taskbar* default: false ++ If set to true, always reorder the tasks in the taskbar so that the currently active one is first. Otherwise don't reorder. +*active-last*: ++ + typeof: bool ++ + default: false ++ + If set to true, always reorder the tasks in the taskbar so that the currently active one is last. Otherwise don't reorder. + *sort-by-app-id*: ++ typeof: bool ++ default: false ++ - If set to true, group tasks by their app_id. Cannot be used with 'active-first'. + If set to true, group tasks by their app_id. Cannot be used with 'active-first' or 'active-last'. *on-click*: ++ typeof: string ++ diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp index c5c522d85..786cfdb02 100644 --- a/src/modules/wlr/taskbar.cpp +++ b/src/modules/wlr/taskbar.cpp @@ -350,8 +350,11 @@ void Task::handle_done() { button.get_style_context()->remove_class("fullscreen"); } - if (config_["active-first"].isBool() && config_["active-first"].asBool() && active()) + if (config_["active-first"].isBool() && config_["active-first"].asBool() && active()) { tbar_->move_button(button, 0); + } else if (config_["active-last"].isBool() && config_["active-last"].asBool() && active()) { + tbar_->move_button(button, -1); + } tbar_->dp.emit(); }