wlr/taskbar: reload icon when the widget scale factor changes - #5262
Merged
Alexays merged 1 commit intoAug 27, 2026
Conversation
Task icons are rasterized once, at toplevel creation, using Gtk::Widget::get_scale_factor(). When a bar is (re)created every existing toplevel gets its Task built before the bar surface has entered its output, so GTK falls back to the scale of monitor 0. On a mixed-DPI setup that is the wrong scale and the icon stays blurry until the app is restarted. Reload the icon whenever the image's scale-factor property changes.
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
wlr/taskbarrasterizes each task's icon once, inTask::handle_app_id()/handle_title(), aticon-size × icon_.get_scale_factor()(IconLoader::image_load_icon). It is never re-rendered afterwards.When a bar is created (waybar start, config reload, or an output being hotplugged) every already-existing toplevel gets its
Taskbuilt before the bar's surface has entered its output. At that pointgtk_widget_get_scale_factor()falls back to the scale of monitor 0 (GTK 3gtkwidget.c). On a mixed-DPI setup that guess is wrong for any bar that isn't on monitor 0, so the icon is rasterized at the wrong scale and stays blurry until the application is restarted. Windows opened after the bar has settled get a correct, crisp icon — which makes the symptom look random.Repro: laptop panel at scale 2 (or a fractional scale Hyprland rounds up to 2) plus an external monitor at scale 1 that is the first output, open a few windows, then restart waybar or replug the external monitor. Icons of the pre-existing windows are blurry on the HiDPI bar; newly opened windows are sharp.
Fix
Connect to the image's
scale-factorproperty and reload the icon when it changes. GTK emits this once the surface enters its output (and on any later scale change), so tasks created during the window where the scale is still a guess get re-rasterized at the right size. No-op for bars whose guess was already right.Tested on Hyprland with eDP-1 @1.5 + HDMI-A-1 @1 (waybar 0.15.0 + this patch, and current master builds).