mirror of
https://github.com/polybar/polybar.git
synced 2024-11-25 13:55:47 -05:00
Implement tray-reversed option (#3182)
* implement tray-reversed option * update changelog * Update src/x11/tray_manager.cpp Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com> * Update CHANGELOG.md --------- Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
This commit is contained in:
parent
f59f509923
commit
9476ad80b8
3 changed files with 18 additions and 1 deletions
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `internal/battery`: Added `ramp-charging` tag.
|
||||
([`#3172`](https://github.com/polybar/polybar/pull/3172))
|
||||
by [@stringlapse](https://github.com/stringlapse).
|
||||
- Added tray-reversed = false option to tray module. Makes tray icons order reversed. ([`#3181`](https://github.com/polybar/polybar/discussions/3181))
|
||||
|
||||
### Changed
|
||||
- `internal/pulseaudio`: Volume adjustments now preserve balance instead of volume ratios ([`#3123`](https://github.com/polybar/polybar/issues/3123), [`#3169`](https://github.com/polybar/polybar/pull/3169)) by [`@parmort`](https://github.com/parmort)
|
||||
|
|
|
@ -66,6 +66,11 @@ struct tray_settings {
|
|||
*/
|
||||
rgba foreground{};
|
||||
|
||||
/**
|
||||
* Reverse the order of tray icons
|
||||
*/
|
||||
bool reversed{false};
|
||||
|
||||
/**
|
||||
* Window ID of tray selection owner.
|
||||
*
|
||||
|
|
|
@ -75,6 +75,7 @@ void manager::setup(const config& conf, const string& section_name) {
|
|||
m_opts.foreground = conf.get(section_name, "tray-foreground", m_bar_opts.foreground);
|
||||
|
||||
m_opts.selection_owner = m_bar_opts.x_data.window;
|
||||
m_opts.reversed = conf.get(section_name, "tray-reversed", m_opts.reversed);
|
||||
|
||||
m_log.info("tray: spacing=%upx padding=%upx size=%upx", m_opts.spacing, m_opts.padding, client_height);
|
||||
|
||||
|
@ -250,7 +251,7 @@ void manager::reconfigure_clients() {
|
|||
|
||||
unsigned count = 0;
|
||||
|
||||
for (auto& client : m_clients) {
|
||||
auto reconfigure_client = [&] (auto& client) {
|
||||
try {
|
||||
client->ensure_state();
|
||||
|
||||
|
@ -267,6 +268,16 @@ void manager::reconfigure_clients() {
|
|||
client.reset();
|
||||
has_error = true;
|
||||
}
|
||||
};
|
||||
|
||||
if (m_opts.reversed) {
|
||||
for (auto it = m_clients.rbegin(); it != m_clients.rend(); ++it) {
|
||||
reconfigure_client(*it);
|
||||
}
|
||||
} else {
|
||||
for (auto it = m_clients.begin(); it != m_clients.end(); ++it) {
|
||||
reconfigure_client(*it);
|
||||
}
|
||||
}
|
||||
|
||||
if (has_error) {
|
||||
|
|
Loading…
Reference in a new issue