1

If I have two strings "foo" and "bar" and I want them displayed in dzen2 like this:

[foo         bar]

is it possible to do this without using the -ta option at all, just positioning commands?

1 Answer 1

2

Yes, but it does require knowledge of the width of 1 char in that font, and the length of text you want to align. To float something left, you would need to use:

^pa(_LEFT)^p(-[n*k])sometext

Where n is the number of chars in "sometext" and k is the pixel width of one char.

Dzen does come with a program, textwidth for calculating the size of non-monospace fonts, in chich case [n*k] would be replaced by that value.

I would recommend using a native version of the code if you can for efficiency, I have a version for golang here, but if this is not possible you can just run the textwidth command.

SVN revision 255 of dzen apparently contains a ^ba(width, align) command, see the wiki.

3
  • So, this only applies for scenarios when a monospace font is being used? Aug 17, 2012 at 6:42
  • Or when you can calculate the width of the non-monospace font. Sep 20, 2012 at 2:22
  • I should have mentioned that dzen does come with a program for calculating the width of non-monospace fonts, I'll add it to the answer. Oct 26, 2012 at 9:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .