def when(
        self,
        focused: _Match | None = None,
        if_no_focused: bool = False,
        layout: Iterable[str] | str | None = None,
        when_floating: bool | None = None,
        func: Callable | None = None,
        condition: bool | None = None,
    ) -> LazyCall:
        """Enable call only for matching criteria.

        Keyword parameters
        ----------
        focused: Match or None
            Match criteria to enable call for the current window.
        if_no_focused: bool
            Whether or not the `focused` attribute should also
            match when there is no focused window.
            This is useful when the `focused` attribute is e.g. set
            to a regex that should also match when there is
            no focused window.
            By default this is set to `False` so that the focused
            attribute only matches when there is actually a focused window.
        layout: str, Iterable[str], or None
            Restrict call to one or more layouts.
            If None, enable the call for all layouts.
        when_floating: bool
            Enable call when the current window is floating.
        func: callable
            Enable call when the result of the callable evaluates to True
        condition: a boolean value to determine whether the lazy object should
            be run. Unlike 'func', the condition is evaluated once when the config
            file is first loaded.

        """
        self._focused = focused

        self._if_no_focused = if_no_focused

        self._condition = condition

        if func is not None:
            self._func = func

        if layout is not None:
            self._layouts = {layout} if isinstance(layout, str) else set(layout)

        self._when_floating = when_floating
        return self
Enable call only for matching criteria.

        Keyword parameters
        ----------
        focused: Match or None
            Match criteria to enable call for the current window.
        if_no_focused: bool
            Whether or not the `focused` attribute should also
            match when there is no focused window.
            This is useful when the `focused` attribute is e.g. set
            to a regex that should also match when there is
            no focused window.
            By default this is set to `False` so that the focused
            attribute only matches when there is actually a focused window.
        layout: str, Iterable[str], or None
            Restrict call to one or more layouts.
            If None, enable the call for all layouts.
        when_floating: bool
            Enable call when the current window is floating.
        func: callable
            Enable call when the result of the callable evaluates to True
        condition: a boolean value to determine whether the lazy object should
            be run. Unlike 'func', the condition is evaluated once when the config
            file is first loaded.

        
libqtile/lazy.py