fix(tray): hide module when no items are visible#5028
Open
JeremieRodon wants to merge 1 commit into
Open
Conversation
Tray::update() already had logic to hide the module when all child items were passive, but it was only re-run on item add/remove — never on a status change. When the last visible item transitioned to Passive, the item hid itself but the now-empty module remained visible. Connect Tray to each item's Gtk::EventBox signal_show/signal_hide so update() runs on every visibility transition, and simplify update() to check child->get_visible() directly instead of inspecting the `passive` CSS class. The Tray-level `show-passive-items` read becomes redundant since Item already honours it when deciding its own visibility; remove it along with the now-unused Tray::show_passive_ member. Fixes: Alexays#3721
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When all tray items are in the
Passivestate, the tray module remains visible as an empty placeholder, taking up space in the bar. See #3721 for one user-visible manifestation.Root cause
Tray::update()already walked the children and hid the whole module if none should be shown. Butupdate()only ran on construction and inonAdd/onRemove.Item::setStatustoggles the item's ownevent_boxvisibility on everyStatusproperty change but never notified the Tray, so module visibility was never re-evaluated on anActive↔Passivetransition.Fix
Connect each item's
Gtk::EventBox::signal_showandsignal_hideinTray::onAddsodp.emit()fires on every visibility transition. The connections die with the item's widget — no explicit teardown needed.Simplify
Tray::update()to a singlestd::any_ofoverchild->get_visible(). The previous predicate checked thepassiveCSS class as a proxy for visibility, which duplicated state already encoded in the widget itself.Remove
Tray::show_passive_and its config read:Itemalready readsshow-passive-itemsand applies it when deciding its own visibility, so the Tray-level copy was redundant. The behavior ofshow-passive-itemsis unchanged. The.passiveCSS selector documented inwaybar-tray.5is still set byItem::setStatusand continues to work for styling.Fixes #3721