Airblader / i3

A fork of the i3 window manager with gaps and some other features. :warning: i3-gaps has been merged into i3.
BSD 3-Clause "New" or "Revised" License
5.87k stars 318 forks source link

[Feature Request] Respect DPI scaling for i3bar height #319

Closed MartinodF closed 5 years ago

MartinodF commented 5 years ago

I'm submitting a…

[ ] Bug
[X] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

i3bar height is interpreted as screen pixels. This leads to different bar heights on monitors with different DPI scaling.

Expected Behavior

i3bar height should be interpreted as pre-scaling pixels, and comply with the desired screen DPI scaling.

Environment

Output of i3 --moreversion 2>&-:

Binary i3 version:  4.17.1 (2019-08-30) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.17.1 (2019-08-30) (pid 542) abort…)
Loaded i3 config: /home/mart/.config/i3/config (Last modified: lun 16 set 2019, 10:54:49, 3195 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

- Linux Distribution & Version: Arch Linux 5.2.13-arch1-1-ARCH
- Are you using a compositor (e.g., xcompmgr or compton): Yes, compton v7.3

I'm not sure how easy this change would be as I'm not familiar with the i3 codebase, but this is the only setting that I need to change between my machines, as the rest of the i3 config is shared without modifications.

I would like to implement it myself if that helps, but I would need a few pointers regarding how dpi scaling is usually handled in the codebase. How difficult would it be to implement?

Thanks!

Airblader commented 5 years ago

Totally understand your request and definitely agree with it, but I would prefer handling this by implementing https://github.com/i3/i3/issues/3721 and getting rid of the i3-gaps specific implementation. Would be good if you commented on there to mention this as well so it will be considered.

In the meantime I do not intend to change i3-gaps for this. Thanks for understanding!

Airblader commented 5 years ago

If you want to temporarily patch this locally in i3-gaps, it should be as easy as doing this:

diff --git a/src/config_directives.c b/src/config_directives.c
index c78e7ba6..65306c24 100644
--- a/src/config_directives.c
+++ b/src/config_directives.c
@@ -681,7 +681,7 @@ CFGFUN(bar_verbose, const char *verbose) {
 }

 CFGFUN(bar_height, const long height) {
-    current_bar->bar_height = (uint32_t)height;
+    current_bar->bar_height = logical_px((uint32_t)height);
 }

 CFGFUN(bar_modifier, const char *modifiers) {
MartinodF commented 5 years ago

Hi Ingo, thank you for your prompt feedback and for providing the patch! :1st_place_medal:

I understand your point, integrating this into i3 would be much better. I've commented on the i3 issue, let's hope this makes it upstream. Again, thank you and have a wonderful day!