Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Centering Text in the Title Bar (Read 531 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Centering Text in the Title Bar

Hello,

I'm using the Columns UI theme and want to align the currently playing song into to the middle. In Preferences > Display > Columns UI I have the following in the main window textbox:
Code: [Select]
[%artist% %album% - %title% - ]foobar2000
But what I'm having trouble with is finding the correct syntax, and there doesn't appear to be a component that lets me adjust it automatically. I've holding down the space bar, but the text cuts off around the halfway point.

Any help would be appreciated.

Re: Centering Text in the Title Bar

Reply #1
I don't think that's possible. I used to have a sort of workaround, though, but it requires a fixed window width. I always use foobar2000 with a maximized window, so I could get close to centering the window title with this code:
Code: [Select]
$puts(header,[your window title])$repeat(  ,$sub(110,$div($len2($get(header)),2)))$get(header)

110 is a value which I found empirically and it depends on your screen size. You can test it with something like:
Code: [Select]
$repeat(  ,110)|
and adjust the value until the | character is right in the middle of the window. I chose to repeat a double space because it is the closest to the average width of other characters, but it is an approximation, so don't expect the title to be perfectly centered. Another limitation is that the window title area does not expand all the way to the right border, because of the title bar buttons, therefore if your header exceeds the window title area, it will be cropped on the right.

I'm late

Re: Centering Text in the Title Bar

Reply #2
Yeah, no matter what the text always gets cropped around the midpoint so it's impossible to make it perfectly centered (which is fine). I'm using version 1.3.17 and I think the default alignment used to be in the center. Anyways, I made the size 75 and it works well enough. Thank you.