Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Mpd2 widget fixed width #4101

Closed
1 task done
K1ngst0m opened this issue Jan 3, 2023 · 8 comments · Fixed by #4110
Closed
1 task done

Get Mpd2 widget fixed width #4101

K1ngst0m opened this issue Jan 3, 2023 · 8 comments · Fixed by #4110

Comments

@K1ngst0m
Copy link
Contributor

K1ngst0m commented Jan 3, 2023

The issue:

  • qtile version: 0.22.1

Mpd2 widget has only the width attribute to control the maximize widget width, it won't always get the same width when the different lengths of song/artist names are.

Required:

  • I have searched past issues to see if this bug has already been reported.
@elParaguayo
Copy link
Member

Sorry, I'm not entirely sure what behaviour you're after. Setting width should fix the width of the widget. Not setting it would mean the width is calculated based on the content. Is there a third option you want?

@K1ngst0m
Copy link
Contributor Author

K1ngst0m commented Jan 3, 2023

sorry to have failed to make myself clear.
e.g this's my widget setup:

                widget.Mpd2(
                    foreground='#ffffff',
                    background='#1f1f1f',
                    status_format='{play_status} {artist} - {title}',
                    idle_format='{play_status} {idle_message}',
                    idle_message='wait for playing....    ',
                    width=300,
                    padding=10,
                    scroll=True,
                    # font= 'JetBrains Mono Bold',
                ),

when the songs name is shorter than 300, the bar will shrink
image

for the song that has a long name, the bar will maximize to 300 widths.
image

looks like the width attribute only controls the maximum width of a widget. but the additional minimum width control or a permanently fixed width is always for need.

@elParaguayo
Copy link
Member

If you disable scrolling, do you get the fixed size?

@K1ngst0m
Copy link
Contributor Author

K1ngst0m commented Jan 3, 2023

Yes, but can we get the fixed size when enabling scrolling?

@elParaguayo
Copy link
Member

When scrolling is enabled, the width value is interpreted as the maximum value. Where text is shorter than this, it reverts to calculating the width of the widget based on the size of the content.

We did originally think about having a separate scroll_width parameter which was to deal with this particular issue.

The simplest fix would be to always have a fixed with when using scrolling but that would change behaviour for existing users. If we don't do that then I think we need to add a new parameter (something like scroll_fix_width=True) to do this.

@m-col you and I discussed this before so curious if you have a preference here (or a simpler fix that I may have missed).

@m-col
Copy link
Member

m-col commented Jan 10, 2023

I think you got it all, both setups seem like they would be desirable so +1 for a simple bool like scroll_fix_width as you suggest

@elParaguayo
Copy link
Member

OK. Will add this later.

elParaguayo added a commit to elParaguayo/qtile that referenced this issue Jan 10, 2023
Currently, when widgets have `scroll=True` set, the `width` parameter
acts as maximum width. Where the width of the text is less than this
value, the widget will shrink accordingly. This may be undesirable for
users wishing to have a fixed width at all times.

This PR adds a new parameter, `scroll_fixed_width`, which, when set to
`True`, forces the text widget to have a fixed width at all times.

Fixes qtile#4101
elParaguayo added a commit to elParaguayo/qtile that referenced this issue Jan 10, 2023
Currently, when widgets have `scroll=True` set, the `width` parameter
acts as maximum width. Where the width of the text is less than this
value, the widget will shrink accordingly. This may be undesirable for
users wishing to have a fixed width at all times.

This PR adds a new parameter, `scroll_fixed_width`, which, when set to
`True`, forces the text widget to have a fixed width at all times.

Fixes qtile#4101
@K1ngst0m
Copy link
Contributor Author

much appreciated!

elParaguayo added a commit that referenced this issue Jan 26, 2023
Currently, when widgets have `scroll=True` set, the `width` parameter
acts as maximum width. Where the width of the text is less than this
value, the widget will shrink accordingly. This may be undesirable for
users wishing to have a fixed width at all times.

This PR adds a new parameter, `scroll_fixed_width`, which, when set to
`True`, forces the text widget to have a fixed width at all times.

Fixes #4101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants