Skip to content

Popup width #357

Answered by FelixKratz
khaneliman asked this question in Q&A
Discussion options

You must be logged in to vote

The width of a popup is controlled by the widest item in the popup. Items have no way to set a maximum "content-length". The width property only controls the width of the "reserved space" for that item and the content can outgrow this reserved space.

So, currently, the width of the popup can be controlled by truncating the content of the widest item only, e.g.

TRUNCATED="$(echo "$CONTENT" | sed 's/\(.\{20\}\).*/\1.../')"

truncates the $CONTENT at 20 characters with three dots. Thats the way I did it for my spotify popup widget:
https://github.com/FelixKratz/dotfiles/blob/13b61b202972fe0e97f0afc8b2eeca38cd9c09dd/.config/sketchybar/plugins/spotify.sh#L47

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by FelixKratz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #355 on April 12, 2023 11:00.