On Tue, Sep 15, 2015 at 09:02:49AM -0700, Andy Skalet wrote:
>  I needed to add the window argument to automatically focus a group
> when a window was added to it, have been meaning to submit a patch but
> wondered if there was a broader context that should also be handled:

The only problem here is that it might break hooks that people already
have written that don't take the right number of arguments. It might
be ok to break them if we tell everyone that they should start writing
their hooks as

def foo(*args, **kwargs).

Another option would be to do some magic to figure out how many
arguments the hook took, but I like that less.

[Or maybe we don't care at all, and we'll just tell everyone they need
to change; we've broken people's configs before, we could do it
again, but it would be nice to have a plan for people to future proof
them.]

Tycho

> diff --git a/libqtile/group.py b/libqtile/group.py
> index e99b38b..aebc4d9 100644
> --- a/libqtile/group.py
> +++ b/libqtile/group.py
> @@ -247,7 +247,7 @@ class _Group(command.CommandObject):
>          )
> 
>      def add(self, win, focus=True):
> -        hook.fire("group_window_add")
> +        hook.fire("group_window_add", self, win)
>          self.windows.add(win)
>          win.group = self
> 
> ...
> 
> On Tue, Sep 15, 2015 at 8:51 AM, Roger Duran <[email protected]> wrote:
> > On Tue, Sep 15, 2015 at 7:58 AM, Alexander Koptelov
> > <[email protected]> wrote:
> >> Hi,
> >>
> >> As I see the subj hooks are mainly used for widgets so far and no-arg
> >> version works perfectly there.
> >>
> >> I'm trying to move a window to a particular group as its title gets changed
> >> instead of when it is created. And in this case I need a window object
> >> passed to hook function for window_name_change event.
> >>
> >> What if we add the window argument to firing this event? And maybe other
> >> window-related events?
> >>
> >> Also I was thinking about some additional hooking for Group configs, e.g.
> >>
> >> Group('name', matches=[Match(title='my title')],
> >> hooks=['window_name_change'], ...)
> >
> > mm.. what about something like: match_on=['created', 'updated'] or
> > match_on=When(created=True, updated=True) ?
> >
> >>
> >> so when a title is changed to some specific value, the window will be
> >> assigned to this group?
> >>
> >> Regards,
> >> Alex
> >>
> >> --
> >> 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].
> >> For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > 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].
> > For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> 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].
> For more options, visit https://groups.google.com/d/optout.

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to