summaryrefslogtreecommitdiff
path: root/qutebrowser/completion
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-03-21 21:37:41 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-03-23 12:53:16 +0100
commita3adba81c7be418548cabe845a5c8a88c494aa62 (patch)
treea825123160d04d9c0f41e72e6cf70012757deb3d /qutebrowser/completion
parent7f693f75a0e0812b7c788ec257608ed324cb3cc2 (diff)
downloadqutebrowser-a3adba81c7be418548cabe845a5c8a88c494aa62.tar.gz
qutebrowser-a3adba81c7be418548cabe845a5c8a88c494aa62.zip
Add :process
See #5673
Diffstat (limited to 'qutebrowser/completion')
-rw-r--r--qutebrowser/completion/models/miscmodels.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py
index b45127651..046531973 100644
--- a/qutebrowser/completion/models/miscmodels.py
+++ b/qutebrowser/completion/models/miscmodels.py
@@ -20,6 +20,7 @@
"""Functions that return miscellaneous completion models."""
import datetime
+import itertools
from typing import List, Sequence, Tuple
from qutebrowser.config import config, configdata
@@ -302,3 +303,22 @@ def undo(*, info):
cat = listcategory.ListCategory("Closed tabs", entries, sort=False)
model.add_category(cat)
return model
+
+
+def process(*, info):
+ """A CompletionModel filled with processes."""
+ from qutebrowser.misc import guiprocess
+ model = completionmodel.CompletionModel(column_widths=(10, 10, 80))
+ for what, processes in itertools.groupby(
+ guiprocess.all_processes.values(), lambda proc: proc.what):
+ entries = [
+ (
+ str(proc.pid),
+ 'running' if proc.running else 'finished',
+ ' '.join([proc.cmd] + proc.args)
+ )
+ for proc in processes
+ ]
+ cat = listcategory.ListCategory(what.capitalize(), entries)
+ model.add_category(cat)
+ return model