Пример #1
0
    def togroup(self, group_name=None, *, switch_group=False):
        """Move window to a specified group

        Also switch to that group if switch_group is True.
        """
        if group_name is None:
            group = self.qtile.current_group
        else:
            group = self.qtile.groups_map.get(group_name)
            if group is None:
                raise CommandError("No such group: %s" % group_name)

        if self.group is not group:
            self.hide()
            if self.group:
                if self.group.screen:
                    # for floats remove window offset
                    self.x -= self.group.screen.x
                self.group.remove(self)

            if group.screen and self.x < group.screen.x:
                self.x += group.screen.x
            group.add(self)
            if switch_group:
                group.cmd_toscreen()
Пример #2
0
 def get(self, q, name):
     """
         Utility function for quick retrieval of a widget by name.
     """
     w = q.widgets_map.get(name)
     if not w:
         raise CommandError("No such widget: %s" % name)
     return w
Пример #3
0
 def toscreen(self, index=None):
     """Move window to a specified screen, or the current screen."""
     if index is None:
         screen = self.qtile.current_screen
     else:
         try:
             screen = self.qtile.screens[index]
         except IndexError:
             raise CommandError('No such screen: %d' % index)
     self.togroup(screen.group.name)
Пример #4
0
    def execute(self, call: CommandGraphCall, args: Tuple, kwargs: Dict) -> Any:
        """Execute the given call, returning the result of the execution

        Executes the given command over the given IPC client.  Returns the
        result of the execution.

        Parameters
        ----------
        call: CommandGraphCall
            The call on the command graph that is to be performed.
        args:
            The arguments to pass into the command graph call.
        kwargs:
            The keyword arguments to pass into the command graph call.
        """
        status, result = self._client.send((
            call.parent.selectors, call.name, args, kwargs
        ))
        if status == SUCCESS:
            return result
        if status == ERROR:
            raise CommandError(result)
        raise CommandException(result)