-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dunst does not use the correct DPI for rendering text #240
Comments
+1 is there currently a workaround for this? |
+1, more people would hit this as high dpi monitors on laptops/desktops are getting popular. |
JFI: the obvious workaround is to increase the font size, e.g. |
That doesn't increase the icon sizes though. It also makes cross-machine configuration annoying. |
Yep, currently running into this which is forcing me to uninstall dunst and use notify-osd instead :( |
I have a branch which does work. Just need to do some more work to store the DPI and use it in the places where 256 is hardcoded right now. Also, the DPI should be updated and everything redrawn when the monitor is changed in case monitors have different DPIs. |
@mathstuf Hi, any update on this? How can we help? |
The code needs to get the real value instead of 256 at the bottom of the diff. Hadn't found the function when I was looking and haven't gone back since. |
I've also hit this snag. Glad to see some work is going into it. |
FYI, still haven't worked on it in a while :( . Feel free to update my branch to get the real DPI from X. |
I'll pull and see what I can do. |
Here is a patch that uses an Xresources setting, dunst.dpi. |
I'm not certain, but won't the client need both values (or just the XResource value)? IIUC, |
X does no scaling, the clients need to do it themselves. And yes, one should use the Xresources value only, which is what all the big toolkits and applications do. |
Hmm. All I do is set the DPI with xrandr; no X resource setting at all and non-GTK2 apps using toolkits look OK with just that. |
Some toolkits will set the X resource for you based on the X11 dpi. |
It seems the user has two levels of control here (assuming the user can configure the X server; I think this is generally not the case, but typically most systems are single-user, self-administered, and thus ...):
I think you should prefer to make your X server configuration reflect reality, and let the X clients do the right thing, given the user preferences/configuration. X server includes scaling mechanisms other than this DPI setting, which you might prefer ( I recently started using a laptop w/ a 15.6" 4K display; I've configured X to properly set the physical dimensions of the display (§ Monitor | It's worth noting that X's * note: How is it that Xft (X FreeType) winds up controlling the DPI (and via Xresources config, to boot)? How "standard" is this actually? What about fontconfig? Clients that don't respect |
IMHO the right thing to do is respect the |
Xft.dpi can be set per X11 DISPLAY as well, e.g. using Note that an X11 DISPLAY is not the same as a RandR output, and most setups use multiple RandR outputs on the same X11 DISPLAY these days. X11 does not support different dpi values on different RandR outputs. I still strongly recommend to go with Xft.dpi first and fall back to RandR values if at all. |
See https://sources.debian.net/src/x11-xserver-utils/7.7%2B7/xrandr/xrandr.c/#L3514 for the source. AFAICT, the option will look up the DPI of the specified output (based on its physical height) and will set it for the entire X11 DISPLAY. This is not a per-output setting. |
@stapelberg Sorry, "display" was a bad choice of word for me. I was refering to a physical display (not Xorg displays), meaning an actualy output.
|
Okay. Setting the DPI per output and relying on applications to query that setting implies:
Given dunst’s special nature (using non-moveable overlay windows), I can see how picking up the per-output DPI value seems like a cool trick. I still don’t think it’s a clean solution, and given the abundant disregard for DPI settings by popular apps and toolkits (which all just use Xft.dpi instead), likely only very few users will ever notice this feature exists. That being said, I don’t care in the end what is implemented — I just want you to understand the trade-offs you’re making by deviating from the de-facto standard of using Xft.dpi. |
Like you said, dunst is in a very special situation (non-moveable windows). But it also has another special nature: it's generally used by people who know how to RTFM (compared to say, gnome users), so cleanly documenting which DPI value dunst uses should have any this working properly for any interested users. Also, the only way to break with the broken de-facto standard is to start using the other one that actually makes the right assumptions! 😄
I actually do care, because |
Xrandr DPI is also per-DISPLAY, not per-output (X itself only supports a single DPI value; Xrandr isn't going to fix that). The flag being associated with a display just makes it be the one used for calculations rather than some other display or otherwise calculated DPI. You need Wayland for per-output DPI settings. The closet you can get now is to standardize in the lowest DPI across your screens and use Xrandr to zoom/magnify the higher DPI monitors. |
An effort was done to fix this in the fixdpi branch. Can someone with a high dpi monitor test these changes before they are merged? Any feedback is appreciated. Dunst should give priority to the |
Weird, make sure you compiled with Xrandr enabled (It should be on by default if you didn't make any changes to config.mk) What's the output of |
I installed using this: make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11
make PREFIX=/usr install
|
I pushed a commit with some debug output(I should really add some proper logging sometime). |
Sorry, looking at the debug output make me look closer at my setup, it turns out that I was setting Testing properly again, detection works fine:
Sorry for the mixup. I do admit though, that font looks bolder and larger than anticipated. Is this just scaling, or is the font-size itself being increased? |
I assume the font size is being increased but I can't be sure since all we're doing internally is passing the dpi value to cairo and it handles the font setup and rendering.
Looks like the dpi calculation thinks your dpi is 220 which contradicts the 160 you had set as the dpi value later so that might be why the font looks bigger than usual. |
TBH, the result is bold and fat. Closer inspection makes me think that the font is being grown more than it should: For example, here's the screenshot at 106 dpi, manually scaled 150% with GIMP (this is what scaling to 160dpi should look like): Here's a screenshot taken with Note that the font is actually larger than expected.
Oh, the screen is physically 220dpi (so this is working fine). I set it to 160dpi because that's the scaling that I prefer (but that's totally personal). At 220dpi, everything looks too big for me (and, the increased pixel density lets me read smaller text, etc). To be extra clear on that: the calculation was fine; 160dpi is a personal adjustment I make and does not reflect the actual screen's dpi. |
Finally, kudos on the per-screen dpi detection, it's (sadly) not something seen very commonly. |
Finally got some time to work on this again after 2 weeks of inactivity.
That might have been because of the decimal places, I made the calculation round down the result which should improve if not completely fix this. Additionally, I found that using a different dpi per screen can cause some visual inconsistencies if you have multiple screens with slightly different dpis so I moved the per-screen dpi detection feature as an opt in experimental feature in the dunstrc until we figure out what can be done about that. |
Changes have been merged to master this should now be fixed. |
@tsipinakis, can you clarify this statement, please? How is it that Dunst is able to support a per-monitor (X11 Output) DPI? You yourself noted that X11 does not support this, and that such support is a major goal of the Wayland project. As I understand, support for this under X11 would require the user to configure Dunst directly to understand which Outputs have which DPIs; X11 has no specification to store or communicate this data/configuration. https://github.com/dunst-project/dunst/blob/master/dunstrc#L189 -- seems to indicate that this feature only works when one doesn't specify an I'd like to test this functionality (primarily, the major goal of getting Dunstrc to respect |
First of all, due to some visual inconsistencies that was changed from a fallback to an opt-in experimental feature, see the example dunstrc. The per-monitor dpi section refers to per randr output. We use the physical screen dimensions as reported by randr to calculate approximately that screens dpi. See here for the code(Don't ask me how that calculation works, it's still magic to me :) ). Which is one of the reason we changed the X11 monitor extension we use from xinerama to randr. Documentation is my next big goal before we release the next version so it should also help clarify how parts of dunst work. |
To respond to your edit, this was added as an experiment since it was mentioned earlier in this thread that it would be a welcome feature and due to the way we implemented dpi handling it was a very simple change. It is still unclear how well it will work in a real-world scenario, I haven't even tested it that well myself since all my monitors have basically the same dpi, which is why it's experimental. According to my tests |
I tested the base functionality here -- it works well. I will test the experimental bit once I get to a second monitor this week. Question: dunst runs as a systemd user service on my setup (Debian Sid) -- I have dunst built and installed to Additionally, does Dunst support a "reload configuration" signal, like say, i3, does? i3 uses this signal to re-inspect the value of |
@tsipinakis, this changeset does not properly increase the scale of the icon for the notification. |
I don't understand what you're trying to accomplish in your first question, can you give a few more details? Why are you trying to set the PATH?
Not at the moment,
If you use the |
Regarding my first question: I am trying to get the Dunst instance that runs in my system's setup (an out-of-the-box config from Debian Sid) to use the version I built with In fact, Dunst is managed by dbus, which is managed by systemd. After Re:
|
I assume you run dbus under systemd so it's started with the |
Note that session DBus services aren't really supported by systemd anyways. See systemd/systemd#892. |
Right, we've hijacked this issue enough lets move the discussion to #314. |
When using a hi-dpi display (also often called “retina display”) and the default “monospace 8” as font, the fonts rendered in dunst are significantly smaller than in other GTK applications and e.g. i3.
I think dunst should use code similar to https://github.com/i3/i3/blob/fec61791e1b26ecb7fedcd86c0c4b68634dd4169/libi3/font.c#L37-L55 instead of calling
pango_cairo_create_layout
directly in x.c.To reproduce, use
xrandr --dpi 192
and setXft.dpi: 192
in~/.Xresources
The text was updated successfully, but these errors were encountered: