From 32d42749f9b4c44fb0b8b46b2236884c4198b594 Mon Sep 17 00:00:00 2001 From: Erik Reider <35975961+ErikReider@users.noreply.github.com> Date: Fri, 28 Jan 2022 18:42:52 +0100 Subject: [PATCH 1/2] use pack_end instead of pack_start --- src/modules/sni/tray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/sni/tray.cpp b/src/modules/sni/tray.cpp index c32c0d6a..46068575 100644 --- a/src/modules/sni/tray.cpp +++ b/src/modules/sni/tray.cpp @@ -25,7 +25,7 @@ Tray::Tray(const std::string& id, const Bar& bar, const Json::Value& config) } void Tray::onAdd(std::unique_ptr& item) { - box_.pack_start(item->event_box); + box_.pack_end(item->event_box); dp.emit(); } From 941cf47693ad9ea48054634f30684691c352247f Mon Sep 17 00:00:00 2001 From: Erik Reider <35975961+ErikReider@users.noreply.github.com> Date: Fri, 28 Jan 2022 19:14:46 +0100 Subject: [PATCH 2/2] Add config option "reverse-direction" --- man/waybar-tray.5.scd | 4 ++++ src/modules/sni/tray.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/man/waybar-tray.5.scd b/man/waybar-tray.5.scd index c664594d..bfd1f296 100644 --- a/man/waybar-tray.5.scd +++ b/man/waybar-tray.5.scd @@ -29,6 +29,10 @@ Addressed by *tray* typeof: integer ++ Defines the spacing between the tray icons. +*reverse-direction*: ++ + typeof: bool ++ + Defines if new app icons should be added in a reverse order + *on-update*: ++ typeof: string ++ Command to execute when the module is updated. diff --git a/src/modules/sni/tray.cpp b/src/modules/sni/tray.cpp index 46068575..94120be6 100644 --- a/src/modules/sni/tray.cpp +++ b/src/modules/sni/tray.cpp @@ -25,7 +25,11 @@ Tray::Tray(const std::string& id, const Bar& bar, const Json::Value& config) } void Tray::onAdd(std::unique_ptr& item) { - box_.pack_end(item->event_box); + if (config_["reverse-direction"].isBool() && config_["reverse-direction"].asBool()) { + box_.pack_end(item->event_box); + } else { + box_.pack_start(item->event_box); + } dp.emit(); }