bar icon indicating copy to clipboard operation
bar copied to clipboard

DPI settings?

Open SuperFluffy opened this issue 9 years ago • 9 comments

Is there a way to teach bar to use my system's native DPI (213)? I have set that value in /etc/X11/xorg.conf.d, and also for the Xft.dpi setting in .Xresources (although that one most likely isn't touched by bar). Everything is scaling rather nicely, except that bar is really really tiny (and the font terminus is already set to size 16).

SuperFluffy avatar Mar 05 '15 21:03 SuperFluffy

I guess the bar should stretch or do something like that, summoning @jvvv for ideas

LemonBoy avatar Mar 14 '15 13:03 LemonBoy

I'll do some investigating. Last time I looked into parsing the X Resource Database stuff, there was no direct support. Maybe there is some progress on it somewhere. When I did a port of 9wm to xcb, I was interested in this for an eventual port I had intended to do of larswm to xcb... this was a big part of the reason I put it on the back burner. It will be interesting to see if there has been any new developments. Give me some time to do some digging. Either way, I will look into coming up with something useful for resolution values, etc.

jvvv avatar Mar 14 '15 20:03 jvvv

Ok, I did some initial poking around. Getting data from X Resource Database would require HUGE amounts of code to implement for pure libxcb based program as we have in lemonbar. Btw, even the xcb maintainers seem to be hesitant to do this; I seem to remember one mailing list post mentioning something about 10 foot poles. The only other way of doing it that I can think of is to use the Xrm* libX11 functions... this is not a road I think is worth the travel. I think we would have to use the X11-XCB compat libs and now we have a major rewrite to make the compat stuff to fit. (I may be wrong about this, but that is how I understand things at this time). I am forming an inkling of an idea about using the dpi to change font size, but would require scalable fonts. This may be doable, though time will tell.

jvvv avatar Mar 16 '15 23:03 jvvv

Oh, I didn't mean to parse the Xresource at all, the dpi value can be easily calculated from the monitor size and providing a way to override the default dpi value is trivial. The part that is not very clear to me is how to handle the stretching of the window and the fonts :|

LemonBoy avatar Mar 17 '15 15:03 LemonBoy

Some updates on this, it's just a matter of setting up a proportion between the dimension at 96dpi and the one at Xdpi, so in the end new_size = old_size * new_dpi / 96. Easy peasy. Since bar spans across the space and time and monitors we need to take into account the different dpi-ness of each monitor. No rocket science is involved, hence it may (or may not) be done soon :)

LemonBoy avatar Apr 22 '15 22:04 LemonBoy

I've finally come back to this. Code in PR #128 is ready for testing, critique. Not sure this is exactly what you were talking about, but I'm open to different ways to implement it.

jvvv avatar May 27 '15 02:05 jvvv

I've encountered problems on a HiDPI monitor as well. All problems were solved by switching to https://github.com/krypt-n/bar, which supports Xft fonts. I am aware that the changes in the fork are too many, so it probably will never be merged. But what about @jvvv changes? I have yet to try them, but it would be great @LemonBoy reviewed them.

rubik avatar Jun 01 '16 19:06 rubik

You can achieve similar results by tweaking the font sizes by hand, which is what more or less the PR you linked to does.

LemonBoy avatar Jun 01 '16 20:06 LemonBoy

I have no problems on hidpi monitor if I set a dpi in Xorg.conf, Xresources and xrandr.

Popkultur avatar Oct 08 '17 20:10 Popkultur