def process(tab: apitypes.Tab, pid: int = None, action: str = 'show') -> None: """Manage processes spawned by qutebrowser. Note that processes with a successful exit get cleaned up after 1h. Args: pid: The process ID of the process to manage. action: What to do with the given process: - show: Show information about the process. - terminate: Try to gracefully terminate the process (SIGTERM). - kill: Kill the process forcefully (SIGKILL). """ if pid is None: if last_pid is None: raise cmdutils.CommandError("No process executed yet!") pid = last_pid try: proc = all_processes[pid] except KeyError: raise cmdutils.CommandError(f"No process found with pid {pid}") if proc is None: raise cmdutils.CommandError(f"Data for process {pid} got cleaned up") if action == 'show': tab.load_url(QUrl(f'qute://process/{pid}')) elif action == 'terminate': proc.terminate() elif action == 'kill': proc.terminate(kill=True) else: raise utils.Unreachable(action)
def home(tab: apitypes.Tab) -> None: """Open main startpage in current tab.""" if tab.data.pinned: message.info("Tab is pinned!") else: tab.load_url(config.val.url.start_pages[0])
def home(tab: apitypes.Tab) -> None: """Open main startpage in current tab.""" if tab.navigation_blocked(): message.info("Tab is pinned!") else: tab.load_url(config.val.url.start_pages[0])