workaround for icons not rendered for apps existing before waybar launch #3393
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.
This is a workaround for #3366 .
Using gdb, I can see that
handle_app_id
can sometimes run whentbar_->icon_themes()
has 0 elements. This happens in multi output settings and can result in empty icons for apps that have been started before waybar.It looks to me that the Tasks can be present before
Taskbar::Taskbar
has run, I could also confirm this by temporarily setting a bool flag in the constructor. If anyone can, I would appreciate any more detailed explanation why that is even possible, because I don't understand it at all.With an explanation there's probably better ways to do this. :) But the code in this PR addresses this by setting the app_ids for all of the taskbar's tasks again at the end of Taskbar's constructor, leading to another icon lookup with
icon_themes()
available forhandle_app_id
.