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(toggle=False)
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
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)
def cmd_simulate_keypress(self, modifiers, key): """Simulates a keypress on the focused window. Parameters ========== modifiers : A list of modifier specification strings. Modifiers can be one of "shift", "lock", "control" and "mod1" - "mod5". key : Key specification. Examples ======== simulate_keypress(["control", "mod2"], "k") """ if hasattr(self.core, 'simulate_keypress'): try: self.core.simulate_keypress(modifiers, key) except utils.QtileError as e: raise CommandError(str(e)) else: raise CommandError("Backend does not support simulating keypresses")
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)
def cmd_toscreen(self, index: Optional[int] = None) -> None: """Move window to a specified screen. If index is not specified, we assume the current screen Examples ======== Move window to current screen:: toscreen() Move window to screen 0:: toscreen(0) """ 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)
def cmd_change_vt(self, vt: int) -> bool: """Run extensions""" if hasattr(self.core, "change_vt"): return self.core.change_vt(vt) raise CommandError("Backend does not support changing VT.")