You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not so much of an issue as some advice. Currently using this code in i3blocks config:
# Display focused window title in bar... [window title in bar] command=xdotool getactivewindow getwindowname 2> /dev/null || echo "" align=center min_width=1820 interval=1
Which works fine once I set min_width 100 lower that my normal screen width. Is there a way to calculate min_width automatically? Or is there a better way to do this in i3blocks?
The text was updated successfully, but these errors were encountered:
Hello, I used to use unbuffer xtitle -s -t 50 where 50 is the length of the window.
This works well but sometimes de-syncs requiring a quick i3 reload. I now run polybar in the background to stdout as the window command in i3blocks polybar -q --stdout | grep -o -P '(?<=%{l}).*(?=%{PR})' however still the face issue just left often. Let me know how you get on!
#!/bin/bash
# A simple blocket that prints window title in center of panel.
# Very much dependant on guessing the total length?
window_title=$(xdotool getactivewindow getwindowname)
# Estimation of characters in the block (modify this as per your estimate)
total_length=200
length=${#window_title}
padding_length=$(( total_length - length ))
# Generate the padding string with underscores
padding=$(printf ' %.0s' $(seq 1 $padding_length))
# Print the window title followed by the padding string
echo "$window_title $padding"
This is a bit of trial and error as finding the 'center' of screen depends on quite a few variables and calculations.
Not so much of an issue as some advice. Currently using this code in i3blocks config:
# Display focused window title in bar... [window title in bar] command=xdotool getactivewindow getwindowname 2> /dev/null || echo "" align=center min_width=1820 interval=1
Which works fine once I set min_width 100 lower that my normal screen width. Is there a way to calculate min_width automatically? Or is there a better way to do this in i3blocks?
The text was updated successfully, but these errors were encountered: