You could probably do this with a hook.

This is untested, but something like this may work:

from libqtile import hook, qtile

@hook.subscribe.layout_change
def layout_changed(layout, group):
    if layout.name == "max":
        # For illustrative purposes, I'm assuming the bar is on the top
        qtile.current_screen.top.margin = 0
        # To get the new margin, we have to reconfigure the bar
        qtile.current_screen.top._configure(qtile, qtile.current_screen)
        # Now redraw the layout
        group.layout_all()

    elif layout.name != "max" and qtile.current_screen.top.margin == 0:
        ...

NB - this removes the margin, you'd need to add code to reset it for other 
layouts.

On Thursday, 29 July 2021 at 09:33:41 UTC+1 [email protected] wrote:

> > You can put space around your bar using the margin command in the screens
> > section of your config file. I think that is what you are looking for ?
>
> I've done this already to my bar, however, I would like to change it 
> without
> restarting qtile.
>
> When the layout_change hook I mentioned before runs, if the layout is 
> "max", I
> would like to update the bar's margin to be 0px. Because I have no margins 
> on
> the max layout, and having them in the bar makes it look weird.
>
> -- 
> Ariel Costas (https://costas.dev)
> Encrypt your email with https://emailselfdefense.org/
> GnuPG -- https://costas.dev/pgp
>

-- 
You received this message because you are subscribed to the Google Groups 
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qtile-dev/dca5f90b-57a1-4efc-8dc6-d4235ff1cb5an%40googlegroups.com.

Reply via email to