[GH-ISSUE #96] Images look really low quality #4276

Closed
opened 2026-05-23 00:52:22 +01:00 by JakeStanger · 36 comments
Owner

Originally created by @yavko on GitHub (Apr 3, 2023).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/96

Describe the bug

icons and cover art look blurry, hidpi issue perhaps?

Expected behavior

images are displayed at the right resolution

System information:

  • Distro: NixOS 23.05
  • Compositor: Hyprland
  • Ironbar version: master at 0.11

Additional context

probably hidpi

Screenshots

icon image
another icon (only play is icon)
image

Originally created by @yavko on GitHub (Apr 3, 2023). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/96 **Describe the bug** icons and cover art look blurry, hidpi issue perhaps? **Expected behavior** images are displayed at the right resolution **System information:** - Distro: NixOS 23.05 - Compositor: Hyprland - Ironbar version: master at `0.11` **Additional context** probably hidpi **Screenshots** icon ![image](https://user-images.githubusercontent.com/15178513/229386557-eda707db-e0de-40ec-a47a-82694f788667.png) another icon (only play is icon) ![image](https://user-images.githubusercontent.com/15178513/229386596-60b1bef1-3cac-42ef-949a-4c1e16eecedf.png)
Author
Owner

@JakeStanger commented on GitHub (Apr 3, 2023):

What's your config for the images / how are you loading them / what resolution are they?

Images are loaded at a hard-coded width/height at the moment, so will be resized automatically to that size. That could cause issues.

<!-- gh-comment-id:1495003542 --> @JakeStanger commented on GitHub (Apr 3, 2023): What's your config for the images / how are you loading them / what resolution are they? Images are loaded at a hard-coded width/height at the moment, so will be resized automatically to that size. That could cause issues.
Author
Owner

@yavko commented on GitHub (Apr 4, 2023):

What's your config for the images / how are you loading them / what resolution are they?

Images are loaded at a hard-coded width/height at the moment, so will be resized automatically to that size. That could cause issues.

Well, these are icons from an icon theme, and come from papirus, which is 100% vector.

<!-- gh-comment-id:1495219518 --> @yavko commented on GitHub (Apr 4, 2023): > What's your config for the images / how are you loading them / what resolution are they? > > Images are loaded at a hard-coded width/height at the moment, so will be resized automatically to that size. That could cause issues. Well, these are icons from an icon theme, and come from papirus, which is 100% vector.
Author
Owner

@JakeStanger commented on GitHub (Apr 4, 2023):

Ah, so are they all stored as SVGs?

<!-- gh-comment-id:1496663608 --> @JakeStanger commented on GitHub (Apr 4, 2023): Ah, so are they all stored as SVGs?
Author
Owner

@yavko commented on GitHub (Apr 4, 2023):

Yeah

<!-- gh-comment-id:1496681995 --> @yavko commented on GitHub (Apr 4, 2023): Yeah
Author
Owner

@JakeStanger commented on GitHub (Apr 7, 2023):

Cool, I suspect there's something weird going on with that then, perhaps related to hidpi as you suggest. Are you able to try bitmap images (literally any appropriately sized image will do just to test) and see if you still get the same problem?

<!-- gh-comment-id:1500206448 --> @JakeStanger commented on GitHub (Apr 7, 2023): Cool, I suspect there's something weird going on with that then, perhaps related to hidpi as you suggest. Are you able to try bitmap images (literally any appropriately sized image will do just to test) and see if you still get the same problem?
Author
Owner

@JakeStanger commented on GitHub (Apr 22, 2023):

I've just merged #120 which means you can now set icon_size on modules, and it will render images at that size. When you get a chance, can you try the latest master and see if setting a size larger than the default (24 for music) helps at all?

I also tested with Papirus myself and had no issues before/after, which does point to hidpi.

<!-- gh-comment-id:1518829764 --> @JakeStanger commented on GitHub (Apr 22, 2023): I've just merged #120 which means you can now set `icon_size` on modules, and it will render images at that size. When you get a chance, can you try the latest master and see if setting a size larger than the default (24 for `music`) helps at all? I also tested with Papirus myself and had no issues before/after, which does point to hidpi.
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

I've just merged #120 which means you can now set icon_size on modules, and it will render images at that size. When you get a chance, can you try the latest master and see if setting a size larger than the default (24 for music) helps at all?

I also tested with Papirus myself and had no issues before/after, which does point to hidpi.

On it! Just need to compile :/

<!-- gh-comment-id:1518830248 --> @yavko commented on GitHub (Apr 22, 2023): > I've just merged #120 which means you can now set `icon_size` on modules, and it will render images at that size. When you get a chance, can you try the latest master and see if setting a size larger than the default (24 for `music`) helps at all? > > I also tested with Papirus myself and had no issues before/after, which does point to hidpi. On it! Just need to compile :/
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

Doesn't work, just renders it giantly, same with cover art, are you using pixbufs for the images? I was using pixbufs with images before (gtk4 tho), and if you didn't choose correct display scale, it would render it blurry like it is now.
image

<!-- gh-comment-id:1518849306 --> @yavko commented on GitHub (Apr 22, 2023): Doesn't work, just renders it giantly, same with cover art, are you using pixbufs for the images? I was using pixbufs with images before (gtk4 tho), and if you didn't choose correct display scale, it would render it blurry like it is now. ![image](https://user-images.githubusercontent.com/15178513/233808327-101e110a-6d3c-4ffd-aef4-19200c283a16.png)
Author
Owner

@JakeStanger commented on GitHub (Apr 22, 2023):

Yeah, images are all loaded with pixbufs. I don't think I'm setting the display scale anywhere, so that may well be it. Do you have any info/examples on setting the scale?

<!-- gh-comment-id:1518857202 --> @JakeStanger commented on GitHub (Apr 22, 2023): Yeah, images are all loaded with pixbufs. I don't think I'm setting the display scale anywhere, so that may well be it. Do you have any info/examples on setting the scale?
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

Yeah, images are all loaded with pixbufs. I don't think I'm setting the display scale anywhere, so that may well be it.

This is how i did it in gtk4, though os_icon is a GtkPicture not GtkImage

Also please excuse this bad rust, this was my first rust project over a year ago lol

image

<!-- gh-comment-id:1518867283 --> @yavko commented on GitHub (Apr 22, 2023): > Yeah, images are all loaded with pixbufs. I don't think I'm setting the display scale anywhere, so that may well be it. This is how i did it in gtk4, though `os_icon` is a `GtkPicture` not `GtkImage` > Also please excuse this bad rust, this was my first rust project over a year ago lol ![image](https://user-images.githubusercontent.com/15178513/233808568-66562143-5a8b-4d1e-aeda-ba21c12ebff7.png)
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

Yeah, images are all loaded with pixbufs. I don't think I'm setting the display scale anywhere, so that may well be it.

This is how i did it in gtk4, though os_icon is a GtkPicture not GtkImage image

I just remembered why I did it like this, I did it like this, because I was rendering a tiny icon as a giant image

<!-- gh-comment-id:1518878067 --> @yavko commented on GitHub (Apr 22, 2023): > > Yeah, images are all loaded with pixbufs. I don't think I'm setting the display scale anywhere, so that may well be it. > > This is how i did it in gtk4, though `os_icon` is a `GtkPicture` not `GtkImage` ![image](https://user-images.githubusercontent.com/15178513/233808568-66562143-5a8b-4d1e-aeda-ba21c12ebff7.png) I just remembered why I did it like this, I did it like this, because I was rendering a tiny icon as a giant image
Author
Owner

@JakeStanger commented on GitHub (Apr 22, 2023):

Looks like there's a separate method in GTK3 that they must have renamed to be default in GTK4. Hopefully it's as easy as that and the linked PR sorts it.

<!-- gh-comment-id:1518886988 --> @JakeStanger commented on GitHub (Apr 22, 2023): Looks like there's a separate method in GTK3 that they must have renamed to be default in GTK4. Hopefully it's as easy as that and the linked PR sorts it.
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

Looks like there's a separate method in GTK3 that they must have renamed to be default in GTK4. Hopefully it's as easy as that and the linked PR sorts it.

Me too 😬, compile time :3

<!-- gh-comment-id:1518887235 --> @yavko commented on GitHub (Apr 22, 2023): > Looks like there's a separate method in GTK3 that they must have renamed to be default in GTK4. Hopefully it's as easy as that and the linked PR sorts it. Me too 😬, compile time :3
Author
Owner

@JakeStanger commented on GitHub (Apr 22, 2023):

compile time :3

If you haven't set up sccache I'd recommend it - it can help a lot with frequent compiles

<!-- gh-comment-id:1518887725 --> @JakeStanger commented on GitHub (Apr 22, 2023): > compile time :3 If you haven't set up [sccache](https://github.com/mozilla/sccache) I'd recommend it - it can help a lot with frequent compiles
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

compile time :3

If you haven't set up sccache I'd recommend it - it can help a lot with frequent compiles

I used to have it setup, but idk how to use it with the nix build system, i'll try to do some research on it now lol

<!-- gh-comment-id:1518888051 --> @yavko commented on GitHub (Apr 22, 2023): > > compile time :3 > > If you haven't set up [sccache](https://github.com/mozilla/sccache) I'd recommend it - it can help a lot with frequent compiles I used to have it setup, but idk how to use it with the nix build system, i'll try to do some research on it now lol
Author
Owner

@JakeStanger commented on GitHub (Apr 22, 2023):

Ah of course, that could be an interesting one with nix. I guess an ad-hoc repo clone with a shell env could probably speed it up too?

<!-- gh-comment-id:1518888297 --> @JakeStanger commented on GitHub (Apr 22, 2023): Ah of course, that could be an interesting one with nix. I guess an ad-hoc repo clone with a shell env could probably speed it up too?
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

Okay this is superrr weird, still blurry (also i removed the icon size stuff should i re-add it?)
image
image

Also it can't be a gtk thing, because this doesn't happen in eww, maybe we can look at its source?

<!-- gh-comment-id:1518889469 --> @yavko commented on GitHub (Apr 22, 2023): Okay this is superrr weird, still blurry (also i removed the icon size stuff should i re-add it?) ![image](https://user-images.githubusercontent.com/15178513/233810596-48e1dda1-6b38-470f-96d8-1e0b6587c702.png) ![image](https://user-images.githubusercontent.com/15178513/233810594-9eacf66f-738f-4eae-b275-2c6c88682552.png) Also it can't be a gtk thing, because this doesn't happen in eww, maybe we can look at its source?
Author
Owner

@JakeStanger commented on GitHub (Apr 22, 2023):

Argh. If you try a different theme, does it still occur?

also i removed the icon size stuff should i re-add it?

Yeah worth a shot I guess.

Also it can't be a gtk thing, because this doesn't happen in eww, maybe we can look at its source?

Yeah good idea, seems as good a place to poke around


I do have a laptop that's got a 4K screen, but it's on Gnome on X11 at the moment. I think I'll need to set that up when I get time (probs tomorrow) and see if I can replicate/fix it on there.

<!-- gh-comment-id:1518890062 --> @JakeStanger commented on GitHub (Apr 22, 2023): Argh. If you try a different theme, does it still occur? > also i removed the icon size stuff should i re-add it? Yeah worth a shot I guess. > Also it can't be a gtk thing, because this doesn't happen in eww, maybe we can look at its source? Yeah good idea, seems as good a place to poke around --- I do have a laptop that's got a 4K screen, but it's on Gnome on X11 at the moment. I think I'll need to set that up when I get time (probs tomorrow) and see if I can replicate/fix it on there.
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

No difference, breeze doesn't change, icon size doesnt as well, also i just noticed this error which has been happening for a while, (checked back at logs)
image

<!-- gh-comment-id:1518892099 --> @yavko commented on GitHub (Apr 22, 2023): No difference, breeze doesn't change, icon size doesnt as well, also i just noticed this error which has been happening for a while, (checked back at logs) ![image](https://user-images.githubusercontent.com/15178513/233811028-ba383e65-acc0-463d-81cd-cdc568ff7732.png)
Author
Owner

@JakeStanger commented on GitHub (Apr 22, 2023):

Aha, that looks might suspicious. Have a look at sections 17.12.1.3 and 17.12.1.4 here. A quick google pointed me to those, which sounds relevant?

<!-- gh-comment-id:1518892684 --> @JakeStanger commented on GitHub (Apr 22, 2023): Aha, that looks might suspicious. Have a look at sections 17.12.1.3 and 17.12.1.4 [here](https://nixos.org/manual/nixpkgs/stable/#sec-language-gnome). A quick google pointed me to those, which sounds relevant?
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

Aha, that looks might suspicious. Have a look at sections 17.12.1.3 and 17.12.1.4 here. A quick google pointed me to those, which sounds relevant?

Omg, is this why? I'll add it as dep to flake and test
image

<!-- gh-comment-id:1518893130 --> @yavko commented on GitHub (Apr 22, 2023): > Aha, that looks might suspicious. Have a look at sections 17.12.1.3 and 17.12.1.4 [here](https://nixos.org/manual/nixpkgs/stable/#sec-language-gnome). A quick google pointed me to those, which sounds relevant? Omg, is this why? I'll add it as dep to flake and test ![image](https://user-images.githubusercontent.com/15178513/233811260-6bd85e11-83bb-4315-b8ba-bb5d936b13ae.png)
Author
Owner

@yavko commented on GitHub (Apr 22, 2023):

Aha, that looks might suspicious. Have a look at sections 17.12.1.3 and 17.12.1.4 here. A quick google pointed me to those, which sounds relevant?

Omg, is this why? I'll add it as dep to flake and test image

Turns out its already there, i actually need to add a preFixup

<!-- gh-comment-id:1518893808 --> @yavko commented on GitHub (Apr 22, 2023): > > Aha, that looks might suspicious. Have a look at sections 17.12.1.3 and 17.12.1.4 [here](https://nixos.org/manual/nixpkgs/stable/#sec-language-gnome). A quick google pointed me to those, which sounds relevant? > > Omg, is this why? I'll add it as dep to flake and test ![image](https://user-images.githubusercontent.com/15178513/233811260-6bd85e11-83bb-4315-b8ba-bb5d936b13ae.png) Turns out its already there, i actually need to add a preFixup
Author
Owner

@yavko commented on GitHub (Apr 23, 2023):

My pr mostly fixes the issue, I think I know why eww doesn't have this same issue even tho it doesn't include the preFixUp stuff. I think its because it doesn't use pixbufs for images, in fact it doesn't handle images at all afaik, you give it properties and widget and it will handle those properties directly in gtk, so no taking image or icon and then feeding it into a pixbuf like its done here

<!-- gh-comment-id:1518926741 --> @yavko commented on GitHub (Apr 23, 2023): My pr mostly fixes the issue, I think I know why eww doesn't have this same issue even tho it doesn't include the `preFixUp` stuff. I think its because it doesn't use pixbufs for images, in fact it doesn't handle images at all afaik, you give it properties and widget and it will handle those properties directly in gtk, so no taking image or icon and then feeding it into a pixbuf like its done here
Author
Owner

@JakeStanger commented on GitHub (Apr 23, 2023):

Oh interesting okay, that sounds definitely worth looking into. I'll merge both our PRs because they're steps in the right direction, and I'll leave this issue open to see if I can do what eww's doing and fully resolve it. Thanks for all your help on this one, hugely appreciated.

<!-- gh-comment-id:1519019151 --> @JakeStanger commented on GitHub (Apr 23, 2023): Oh interesting okay, that sounds definitely worth looking into. I'll merge both our PRs because they're steps in the right direction, and I'll leave this issue open to see if I can do what eww's doing and fully resolve it. Thanks for all your help on this one, hugely appreciated.
Author
Owner

@JakeStanger commented on GitHub (Apr 23, 2023):

I think its because it doesn't use pixbufs for images, in fact it doesn't handle images at all afaik

Looks like this isn't the case unfortunately :(

github.com/elkowar/eww@e76206817d/crates/eww/src/widgets/widget_definitions.rs (L517-L518)

<!-- gh-comment-id:1519024543 --> @JakeStanger commented on GitHub (Apr 23, 2023): > I think its because it doesn't use pixbufs for images, in fact it doesn't handle images at all afaik Looks like this isn't the case unfortunately :( https://github.com/elkowar/eww/blob/e76206817de1cb86ec431dcff7d4b04c8b7d36fc/crates/eww/src/widgets/widget_definitions.rs#L517-L518
Author
Owner

@yavko commented on GitHub (Apr 23, 2023):

I think its because it doesn't use pixbufs for images, in fact it doesn't handle images at all afaik

Looks like this isn't the case unfortunately :(

elkowar/eww@e762068/crates/eww/src/widgets/widget_definitions.rs#L517-L518

That's weird, then why didn't it have blurry images

<!-- gh-comment-id:1519164771 --> @yavko commented on GitHub (Apr 23, 2023): > > I think its because it doesn't use pixbufs for images, in fact it doesn't handle images at all afaik > > Looks like this isn't the case unfortunately :( > > [elkowar/eww@`e762068`/crates/eww/src/widgets/widget_definitions.rs#L517-L518](https://github.com/elkowar/eww/blob/e76206817de1cb86ec431dcff7d4b04c8b7d36fc/crates/eww/src/widgets/widget_definitions.rs#L517-L518) That's weird, then why didn't it have blurry images
Author
Owner

@JakeStanger commented on GitHub (Apr 24, 2023):

I think I'm going to need to locally test this to get to the bottom of it. I've tried to set sway up on my laptop but Zorin still ships an ancient version that doesn't support the required wlr protocols :/

I suppose I could put Nix to good use here. Are you able to share your nix config (or at least just the relevant parts of it), and then I can just apply your config on my laptop and (in theory) get a replica environment to test.

Also I've been assuming you're using 4K. Is that the case / what res and scaling are you using?

<!-- gh-comment-id:1520864288 --> @JakeStanger commented on GitHub (Apr 24, 2023): I think I'm going to need to locally test this to get to the bottom of it. I've tried to set sway up on my laptop but Zorin still ships an ancient version that doesn't support the required wlr protocols :/ I suppose I could put Nix to good use here. Are you able to share your nix config (or at least just the relevant parts of it), and then I can just apply your config on my laptop and (in theory) get a replica environment to test. Also I've been assuming you're using 4K. Is that the case / what res and scaling are you using?
Author
Owner

@yavko commented on GitHub (Apr 24, 2023):

So I use 3200x1800, which is almost 4k. Also my NixOS dotfiles are public on GitHub, they haven't been updated in a while, so when I'll get home I'll push all my local changes.

<!-- gh-comment-id:1520913662 --> @yavko commented on GitHub (Apr 24, 2023): So I use 3200x1800, which is almost 4k. Also my NixOS dotfiles are public on GitHub, they haven't been updated in a while, so when I'll get home I'll push all my local changes.
Author
Owner

@yavko commented on GitHub (Apr 25, 2023):

So I use 3200x1800, which is almost 4k. Also my NixOS dotfiles are public on GitHub, they haven't been updated in a while, so when I'll get home I'll push all my local changes.

Okay so I added all my local changes earlier here is link just in case https://github.com/yavko/Dotfiles

<!-- gh-comment-id:1521172025 --> @yavko commented on GitHub (Apr 25, 2023): > So I use 3200x1800, which is almost 4k. Also my NixOS dotfiles are public on GitHub, they haven't been updated in a while, so when I'll get home I'll push all my local changes. Okay so I added all my local changes earlier here is link just in case https://github.com/yavko/Dotfiles
Author
Owner

@JakeStanger commented on GitHub (Apr 30, 2023):

I've managed to get NixOS with your dotfiles running on my laptop, and I can confirm the play icon looks blurry for me too, in both Hyprland and Sway.

My plan next is to have a play with the config/CSS and see if I can get anywhere that way. I'll also test on another distro when I have time to spend setting that up, and see if it occurs there (or if you have something set up where you can do that, that'd be very helpful).


As an aside, it is very awesome that after a few minor tweaks, I can have a near-exact replica of your full system up and running on my machine.

<!-- gh-comment-id:1529087960 --> @JakeStanger commented on GitHub (Apr 30, 2023): I've managed to get NixOS with your dotfiles running on my laptop, and I can confirm the play icon looks blurry for me too, in both Hyprland and Sway. My plan next is to have a play with the config/CSS and see if I can get anywhere that way. I'll also test on another distro when I have time to spend setting that up, and see if it occurs there (or if you have something set up where you can do that, that'd be very helpful). --- As an aside, it is very awesome that after a few minor tweaks, I can have a near-exact replica of your full system up and running on my machine.
Author
Owner

@yavko commented on GitHub (Apr 30, 2023):

and I can confirm the play icon looks blurry for me too, in both Hyprland and Sway.

I'm glad it's not just my system

As an aside, it is very awesome that after a few minor tweaks, I can have a near-exact replica of your full system up and running on my machine.

Nix is great, totally reproducible, that's why I use it!

<!-- gh-comment-id:1529140891 --> @yavko commented on GitHub (Apr 30, 2023): > and I can confirm the play icon looks blurry for me too, in both Hyprland and Sway. I'm glad it's not just my system > As an aside, it is very awesome that after a few minor tweaks, I can have a near-exact replica of your full system up and running on my machine. Nix is great, totally reproducible, that's why I use it!
Author
Owner

@yavko commented on GitHub (May 1, 2023):

Btw, I added some new stuff to my config for hovering, also fixes uptime not working github.com/yavko/Dotfiles@892525329b (diff-c9239733f0)

<!-- gh-comment-id:1529480049 --> @yavko commented on GitHub (May 1, 2023): Btw, I added some new stuff to my config for hovering, also fixes uptime not working https://github.com/yavko/Dotfiles/commit/892525329bd229220ee88d4f4d76b0d1c0de797a#diff-c9239733f0cccdf366d64d7b5c2106980017e8b2c54eb42a305cc85bee53e970
Author
Owner

@JakeStanger commented on GitHub (May 7, 2023):

Ok! One painful install of Arch Linux later, I can confirm it's happening on there as well. I do at least now have a testing ground, so hopefully I can finally get to the bottom of this soon.

<!-- gh-comment-id:1537446574 --> @JakeStanger commented on GitHub (May 7, 2023): Ok! One painful install of Arch Linux later, I can confirm it's happening on there as well. I do at least now have a testing ground, so hopefully I can finally get to the bottom of this soon.
Author
Owner

@JakeStanger commented on GitHub (May 8, 2023):

I think! Think! I've got it. Weirdly no safe Rust API for it, so took a bit of digging.

<!-- gh-comment-id:1538528380 --> @JakeStanger commented on GitHub (May 8, 2023): I think! ***Think!*** I've got it. Weirdly no safe Rust API for it, so took a bit of digging.
Author
Owner

@yavko commented on GitHub (May 8, 2023):

I think! Think! I've got it. Weirdly no safe Rust API for it, so took a bit of digging.

Can't wait to test it once I get home!

<!-- gh-comment-id:1538541496 --> @yavko commented on GitHub (May 8, 2023): > I think! ***Think!*** I've got it. Weirdly no safe Rust API for it, so took a bit of digging. Can't wait to test it once I get home!
Author
Owner

@yavko commented on GitHub (May 9, 2023):

It works!!!!

<!-- gh-comment-id:1539744785 --> @yavko commented on GitHub (May 9, 2023): It works!!!!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#4276
No description provided.