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
Re-read DPI before displaying new notification #382
Comments
I assume you're using an external monitor sometimes and others the laptop screen and that's why the dpi changes. Have you tried the |
As I see from description, this option calculates DPI directly from xrandr's monitor geometry, bypassing fontconfig/xrdb/ |
There was a pretty big discussion about DPI handling in #240, from a comment in that thread:
So theoretically it should be affected by |
I've just tested it. No, it ignores |
I'm not sure about |
Looks like you're right, I'll look into this tomorrow. The best way to implement this would probably be to re-query Upside:
Downside:
|
BTW, does dunst ignore fontconfig DPI setting? It may be a good idea to just rely on fontconfig to get DPI, because it would simplify and unify things. Many applications effectively get DPI form fontconfig, and fontconfig itself falls back to xrdb and then [supposedly] to xrandr in case its own DPI is unset. |
Currently yes, haven't looked into fontconfig at all. If |
Well, one way or another, fontconfig is already used in text rendering in dunst anyway, so it would be logical to also use it for DPI handling when |
I've implemented this in the I expect a draw call to also be needed there but if it works fine without it even better. |
That's because of pango, dunst internally doesn't use fontconfig directly. |
It does not work in my case.
Also tried disconnecting and reconnecting the external monitor for my rerandr3 script to apply basically the same values as above automatically. Dunst does not get new DPI. |
I'm using Intel GPU with modesetting driver and Openbox+Compton as WM. |
Oops apparently I forgot to post an update on this, I thought that I could simply add the code to re-read the dpi and the existing render functionality would take over from there but this isn't the case, Yet another issue that is on-hold waiting for the drawing refactor. |
When changing the DPI via xrandr --dpi <DPI>, xrandr will send a RRScreenChangeEvent and the DPI value should get adjusted. Falsely, we thought randr_update() would catch up and query the right monitor values. But nothing changes, because we query the XRRMonitorInfo. The monitor info contains the real physical width and height of the monitor's screen. But xrandr --dpi only changes the - let's say - virtual screen size of the virtual overall screen (and therefore changing the DPI to the matching value). Important commands to understand: - Changes dpi of the virtual screen xrandr --dpi - Gives info about the "virtual" screen size (used by DisplayWidth) xdpyinfo | grep -B1 resolution - Gives info about the "physical" screen size (used by XRRMonitorInfo) xrandr -q I know, that I'm probably not right and might not understand the topic in its full size yet[0]. But I'm 100% sure, that the terms "monitor", "screen", "screens", "output" and "display" do not have a consistent naming scheme. [0] https://twitter.com/dechampsgu/status/857924498280124416 Fixes dunst-project#382
When changing the DPI via xrandr --dpi <DPI>, xrandr will send a RRScreenChangeEvent and the DPI value should get adjusted. Falsely, we thought randr_update() would catch up and query the right monitor values. But nothing changes, because we query the XRRMonitorInfo. The monitor info contains the real physical width and height of the monitor's screen. But xrandr --dpi only changes the - let's say - virtual screen size of the virtual overall screen (and therefore changing the DPI to the matching value). Important commands to understand: - Changes dpi of the virtual screen xrandr --dpi - Gives info about the "virtual" screen size (used by DisplayWidth) xdpyinfo | grep -B1 resolution - Gives info about the "physical" screen size (used by XRRMonitorInfo) xrandr -q I know, that I'm probably not right and might not understand the topic in its full size yet[0]. But I'm 100% sure, that the terms "monitor", "screen", "screens", "output" and "display" do not have a consistent naming scheme. [0] https://twitter.com/dechampsgu/status/857924498280124416 Fixes dunst-project#382
@Vladimir-csp Could you please test the PR #608. I'd love to see it fixed. |
Unfortunately, I see no difference. The next notification after changing DPI appears with the size consistent with dunst startup conditions. |
Mhmm. That's not cool. Changing it via Are you running off the right branch?
What's your setting of |
I use a script that sets DPI via
I've built a package from it.
|
What does
Report after changing the DPI? |
it reports correct values |
So, it does report correct DPI, matching with the DPI set by |
Yes. I'm switching between 96 and 120, changes are applied correctly in all three ways: xrandr, xrdb, fontconfig |
Ok, I added another debug commit. Could you please rebuild it and start dunst with |
Launched
|
This isn't working because the impementation in #608 favors Xft over the |
Is it possible to delay read until a new notification is shown? |
Oh yes, @tsipinakis is right. Sorry, I failed communicating my own code 🙈
When should we query it? There's no event semantics to listen on for changed values. It's huge overhead to query the DB per notification. The only way is either to invalidate the Xft value:
Then dunst will use the value given by |
Invalidating xrdb value will affect some software that for some reason relies exclusively on it. I've experimented extensively with DPI setting and came to conclusion that the best way to reach out to all the apps it is to carpet-bomb every source of the value: xrandr, xrdb, fontconfig. I have a hook in autorandr that does just that. To avoid any race with the settings or overhead from constant querying, rely on xrandr event, but postpone the actual read till next notification. |
When changing the DPI via xrandr --dpi <DPI>, xrandr will send a RRScreenChangeEvent and the DPI value should get adjusted. Falsely, we thought randr_update() would catch up and query the right monitor values. But nothing changes, because we query the XRRMonitorInfo. The monitor info contains the real physical width and height of the monitor's screen. But xrandr --dpi only changes the - let's say - virtual screen size of the virtual overall screen (and therefore changing the DPI to the matching value). Important commands to understand: - Changes dpi of the virtual screen xrandr --dpi - Gives info about the "virtual" screen size (used by DisplayWidth) xdpyinfo | grep -B1 resolution - Gives info about the "physical" screen size (used by XRRMonitorInfo) xrandr -q I know, that I'm probably not right and might not understand the topic in its full size yet[0]. But I'm 100% sure, that the terms "monitor", "screen", "screens", "output" and "display" do not have a consistent naming scheme. [0] https://twitter.com/dechampsgu/status/857924498280124416 Fixes dunst-project#382
When changing the DPI via xrandr --dpi <DPI>, xrandr will send a RRScreenChangeEvent and the DPI value should get adjusted. Falsely, we thought randr_update() would catch up and query the right monitor values. But nothing changes, because we query the XRRMonitorInfo. The monitor info contains the real physical width and height of the monitor's screen. But xrandr --dpi only changes the - let's say - virtual screen size of the virtual overall screen (and therefore changing the DPI to the matching value). Important commands to understand: - Changes dpi of the virtual screen xrandr --dpi - Gives info about the "virtual" screen size (used by DisplayWidth) xdpyinfo | grep -B1 resolution - Gives info about the "physical" screen size (used by XRRMonitorInfo) xrandr -q I know, that I'm probably not right and might not understand the topic in its full size yet[0]. But I'm 100% sure, that the terms "monitor", "screen", "screens", "output" and "display" do not have a consistent naming scheme. [0] https://twitter.com/dechampsgu/status/857924498280124416 Fixes dunst-project#382
When changing the DPI via xrandr --dpi <DPI>, xrandr will send a RRScreenChangeEvent and the DPI value should get adjusted. Falsely, we thought randr_update() would catch up and query the right monitor values. But nothing changes, because we query the XRRMonitorInfo. The monitor info contains the real physical width and height of the monitor's screen. But xrandr --dpi only changes the - let's say - virtual screen size of the virtual overall screen (and therefore changing the DPI to the matching value). Important commands to understand: - Changes dpi of the virtual screen xrandr --dpi - Gives info about the "virtual" screen size (used by DisplayWidth) xdpyinfo | grep -B1 resolution - Gives info about the "physical" screen size (used by XRRMonitorInfo) xrandr -q I know, that I'm probably not right and might not understand the topic in its full size yet[0]. But I'm 100% sure, that the terms "monitor", "screen", "screens", "output" and "display" do not have a consistent naming scheme. [0] https://twitter.com/dechampsgu/status/857924498280124416 Fixes dunst-project#382
@Vladimir-csp #608 has been updated to invalidate the cached dpi value when a screen update is received as you suggested. Can you try it out and see if that works for you? |
I do not see any change in behavior, still using startup dpi and not reacting to changes. |
When changing the DPI via xrandr --dpi <DPI>, xrandr will send a RRScreenChangeEvent and the DPI value should get adjusted. Falsely, we thought randr_update() would catch up and query the right monitor values. But nothing changes, because we query the XRRMonitorInfo. The monitor info contains the real physical width and height of the monitor's screen. But xrandr --dpi only changes the - let's say - virtual screen size of the virtual overall screen (and therefore changing the DPI to the matching value). Important commands to understand: - Changes dpi of the virtual screen xrandr --dpi - Gives info about the "virtual" screen size (used by DisplayWidth) xdpyinfo | grep -B1 resolution - Gives info about the "physical" screen size (used by XRRMonitorInfo) xrandr -q I know, that I'm probably not right and might not understand the topic in its full size yet[0]. But I'm 100% sure, that the terms "monitor", "screen", "screens", "output" and "display" do not have a consistent naming scheme. [0] https://twitter.com/dechampsgu/status/857924498280124416 Fixes dunst-project#382
I finally found out. Long story short: it was an odyssey. @Vladimir-csp Could you please test this again? It should work like a charm.
I have to step back of this. There is actually an event, which you can listen on. And it's super easy to listen on it. The only thing: xlib doesn't do it 👿 |
at commit 2d37902. No change.
|
echo "Xft.dpi: 96" | xrdb -merge
./dunst -config dunstrc &
notify-send -u critical Test 1234
echo "Xft.dpi: 120" | xrdb -merge @Vladimir-csp The above commands work for me for switching dunst to 120 dpi with 2d37902, can you try again with the default dunstrc? |
It works with default config, but does not work with mine.
Debug messages with default config contain
but with my config they are absent:
|
There has to be the message Please recompile with a The only thing, which could be wrong, would be the atom check: if (ev.xproperty.atom == XA_RESOURCE_MANAGER) { But this time, it works flawless on my machine. I checked everything. |
|
Reproduced with the dunstrc provided. @bebehei Found the bug ;) The problem is with
With any other follow mode we subscribe to |
@bebehei seems inactive/busy and hasn't responded to my pings or email, I'll take over until the 1.4 release which I'm not proud of how much it's been delayed. @Vladimir-csp I've pushed a fix for the bug mentioned above can you confirm this works for you now? |
It works! |
When changing the DPI via xrandr --dpi <DPI>, xrandr will send a RRScreenChangeEvent and the DPI value should get adjusted. Falsely, we thought randr_update() would catch up and query the right monitor values. But nothing changes, because we query the XRRMonitorInfo. The monitor info contains the real physical width and height of the monitor's screen. But xrandr --dpi only changes the - let's say - virtual screen size of the virtual overall screen (and therefore changing the DPI to the matching value). Important commands to understand: - Changes dpi of the virtual screen xrandr --dpi - Gives info about the "virtual" screen size (used by DisplayWidth) xdpyinfo | grep -B1 resolution - Gives info about the "physical" screen size (used by XRRMonitorInfo) xrandr -q I know, that I'm probably not right and might not understand the topic in its full size yet[0]. But I'm 100% sure, that the terms "monitor", "screen", "screens", "output" and "display" do not have a consistent naming scheme. [0] https://twitter.com/dechampsgu/status/857924498280124416 Fixes dunst-project#382
Awesome! Merged, it'll be included in the 1.4 release which will be the next week or so. |
Traveling laptop use case.
DPI can change on the fly, but running dunst will continue using outdated value that was in effect back when it was started.
The text was updated successfully, but these errors were encountered: