예제 #1
0
파일: window.py 프로젝트: ppmx/qtile
    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
파일: base.py 프로젝트: feijoas/qtile
 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
파일: window.py 프로젝트: ppmx/qtile
 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)