philer / polycore

A conky config and library of Lua widgets
https://philer.github.io/polycore
MIT License
78 stars 5 forks source link

Unexpected right margin not filled in by frame #6

Closed the-allanc closed 1 year ago

the-allanc commented 1 year ago

I've been trying to use Polycore to replicate an existing setup I have that makes use of a Lua script to draw boxes (it's quite old, but I think I initially took the code from here.

My initial experimentation seems to be stuck because I'm trying to draw a text widget in a frame to fill the entire width - but it seems to leave 12 pixels on the right. While the settings for Conky specify a maximum width of 200, if I I print out the value of _conkywindow.width in _cairo_helpers.createcr, it prints out a value of 212. _textwidth is 200.

I don't know where the extra 12 pixels are coming from - I don't mind necessarily that it's bigger than I expected (I'm sure that's a Conky decision rather than a Polycore one), it would be good if Polycore could fill in the entire size of the Conky window. I know it must be doable (I don't have the same problem with the existing Lua script I use), but I can't figure out how to get Polycore to do it.

I've included a screenshot of what I'm getting, and a stripped down version of the text.lua example that produces it. Any idea how I could achieve what I'm after (either by stripping out those 12 pixels, or getting Polycore to fill it)?

Screenshot from 2023-02-09 13-54-39 baretext.lua.txt

philer commented 1 year ago

Hey, I ran into a similar issue today after updating my setup. Turns out that conky nowadays attempts to use DPI scaling which kind of makes the values you set for min/max width/height meaningless. See https://github.com/brndnmtthws/conky/pull/1083

I fixed it for myself by settings Xft.dpi to 96 (actually, I just deleted it from my ~/.Xresources).

That's not really a solution for screens with a high DPI, though. I that case you'd probably have to use something like what was suggested in this comment (the relevant bindings were added in this PR). I'm not sure if there's a way to fix the DPI in conky besides compiling without XFT – maybe they could add a setting for it.

the-allanc commented 1 year ago

Not sure I would have realised it was that kind of issue - so thanks for sharing those links. I ended up using a negative offset for gap_x to hide those pixels, so that'll work for me for now - but at least I know where to look if I want to fix it properly in future. :smile: