elParaguayo / qtile-extras

Somewhere to store things I create for qtile that probably won't end up in the official repo
MIT License
163 stars 19 forks source link

ALSA widget: No effect of padding_x, margin_x and margin_y arguments #153

Closed Crystal4276 closed 1 year ago

Crystal4276 commented 1 year ago

I'm trying to adjust the position of the icon inside the ALSA widget using the available options from the documentation. The speaker icon is a bit too much on the left: image

Unfortunately i could not observe any effect of the padding_x, margin_x and margin_y arguments.

elParaguayo commented 1 year ago

None of those settings would do anything yet.

This is related to your vertical adjustment question too.

I'd be inclined to use padding_x as a horizontal offset.

Crystal4276 commented 1 year ago

I'd be inclined to use padding_x as a horizontal offset.

Cool !

elParaguayo commented 1 year ago

OK - easy fix. Will add tonight.

Crystal4276 commented 1 year ago

On a second though, if it is a pure x offset yes it will be ok. But if it adds some space on both left and right, i will have an issue with the further grouping of status.notifier.

elParaguayo commented 1 year ago

The plan would be for it to just be an initial offset.

Crystal4276 commented 1 year ago

Padding_x working !

Crystal4276 commented 1 year ago

Oups no, i found an issue. The padding_x seems only applied to the icon and not the bar (in "both" configuration). So that the icon overlap with the bar if padding_x is too large.

elParaguayo commented 1 year ago

Have pushed a fix. Please try again and, if there's still an issue, take a screenshot.

Crystal4276 commented 1 year ago

Icon cut when the bar is not active (it's ok when the bar is active) image I'm not 100% sure, but it looks there is an issue with the text inside the bar. It's not centered ? Or it's the same cause of cut affecting the icon ? Screenshot from 2022-11-02 23-01-13

elParaguayo commented 1 year ago

That cutting off should be fixed now.

Crystal4276 commented 1 year ago

The cutting off is removed in "both" mode I did some bonus testing in 'bar' and 'icon' mode. The bar mode has still the same cutoff issue.

I see a little space remaining between alsa widget and status.notifier. But that's just me being picky.... image Playing with background color, it looks due to RectDecoration rather than the widgets themselves.

elParaguayo commented 1 year ago

Padding on the decoration is applied to both ends.

If you're on the git version, you could try setting the extrawidth parameter of that decoration to a negative number to see if shortens it. No idea if that would work!

elParaguayo commented 1 year ago

Can you show a picture of the bar cutoff issue?

Crystal4276 commented 1 year ago

The bar cut: Screenshot from 2022-11-03 10-32-36

If you're on the git version, you could try setting the extrawidth parameter of that decoration to a negative number to see if shortens it. No idea if that would work!

I tried that one but it doesn't work. Although the padding_x of decoration was set to 0, there is a space at the beginning of each group that i can't remove. I found a "trick" using:

    widget.TextBox(
                       text=" ", 
                       fontsize=1, 
                       foreground=colors[15],
                       background=colors[1],
                       padding=-10,
                       **decor_exit, 

It works upon reloading qtile config but crash when restarting qtile ! But i guess this is for a separate issue.

elParaguayo commented 1 year ago

Is the cut issue the end of the text being cut off or the gap at the beginning?

Crystal4276 commented 1 year ago

The end of the text being cut off. I could see the same issue in "both" mode before you fixed it.

elParaguayo commented 1 year ago

Ok. I'll take a look later.

It's weird as it shouldn't happen. The minimum size of the bar should always be enough to show "100%".

I've obviously made a mistake somewhere.

elParaguayo commented 1 year ago

I can't recreate the bar cutoff issue. It's always drawn correctly for me.

Crystal4276 commented 1 year ago

Then I assume it's a quirk due to my configuration of qtile bar. I have grouping enabled with the status.notifier next to it.

What is weird is that i don't see this issue in "both" mode. Only in "bar" mode

elParaguayo commented 1 year ago

You could always adjust the bar_width parameter and just make it a bit bigger.

elParaguayo commented 1 year ago

Can you share your config for that widget (including the decoration) and I'll try using your settings.

Crystal4276 commented 1 year ago

I only used this for testing. After qtile startup, you will have a split second to catch the volume bar before it fades. (getting the screenshot was an experience)

Decoration

decor_exit = {
    "decorations": [
        RectDecoration(
            #colour="#45475a",
            use_widget_background=True,
            line_width= 0,
            radius=[15, 15, 15, 15],
            filled=True,
            padding_y=10,
            padding_x=0,
            group=True,
            clip=True,
            #extrawidth=-10,
        )
    ],
}

Four widgets grouped:

                widget.ALSAWidget(
                       mouse_callbacks={"Button1": lazy.spawn("pavucontrol")},
                       mode='bar',
                       theme_path="/usr/share/icons/Papirus-Dark",
                       icon_size=32,
                       fontsize=20,
                       padding_y=0,
                       padding_x=8,
                       bar_width=60,
                       bar_colour_high=colors[10],
                       bar_colour_loud=colors[15],
                       bar_colour_normal=colors[13],
                       foreground=colors[5],
                       background=colors[1],
                       update_interval=5,
                       hide_interval=2,
                       **decor_exit,
                       ),
                widget.StatusNotifier(
                       icon_size=32,
                       icon_theme="/usr/share/icons/kora",
                       padding = 10,
                       hide_after=0.1,
                       menu_width=385,
                       show_menu_icons=True, 
                       background=colors[1],
                       highlight_colour=colors[6],
                       menu_background=colors[1],
                       menu_foreground=colors[0],
                       separator_colour=colors[15],
                       menu_fontsize = 16,
                       **decor_exit,
                ),
                widget.TextBox(
                       text="", 
                       fontsize=22, 
                       foreground=colors[15],
                       background=colors[1],
                       padding=-5,
                       **decor_exit, 
                ),   
                widget.TextBox(
                       mouse_callbacks={"Button1": lazy.spawn("archlinux-logout")},
                       #exit_script='archlinux-logout',
                       font = "FontAwesome", 
                       text="", 
                       fontsize=27, 
                       foreground=colors[5],
                       background=colors[1],
                       padding=12,
                       **decor_exit, 
                ),
Crystal4276 commented 1 year ago

I forgot the block of color you may need:

def init_colors():
    return [["#cdd6f4", "#cdd6f4"], # color 0 Text (Blue) 
            ["#1e1e2e", "#1e1e2e"], # color 1 Base 
            ["#9399b2", "#9399b2"], # color 2 Overlay 2 
            ["#f5c2e7", "#f5c2e7"], # color 3 Pink 
            ["00000000", "00000000"], # color 4 Transparent
            ["#f3f4f5", "#f3f4f5"], # color 5 White
            ["#45475a", "#45475a"], # color 6 Surface 0 Catppuccin Mocha
            ["#1e1e2ea9", "#1e1e2ea9"], # color 7 Base with 66% transparency
            ["#f3f4f500", "#f3f4f500"], # color 8 White 66 % Tranparency
            ["#11111b", "#11111b"], # color 9 Crust
            ["#fab387", "#fab387"], # color 10 Peach
            ["#f9e2af", "#f9e2af"], # color 11 Yellow
            ["#a6e3a1", "#a6e3a1"], # color 12 Green
            ["#94e2d5", "#94e2d5"], # color 13 Teal (Blue/Green)
            ["#eba0ac", "#eba0ac"], # color 14 Maroon (Reddish/pink)
            ["#f38ba8", "#f38ba8"], # color 15 Red
            ["#89dceb", "#89dceb"], # color 16 Sky (Blue)
           ] 
colors = init_colors()