Skip to content

Commit

Permalink
Fixes #17
Browse files Browse the repository at this point in the history
Sort process list foreground first, then alphabetically
  • Loading branch information
ueffel committed Mar 8, 2021
1 parent 985ab79 commit ff92f6f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kill.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,12 @@ def on_suggest(self, user_input, items_chain):
if not self._processes:
self._get_processes()

self.set_suggestions(self._processes, kp.Match.FUZZY, kp.Sort.SCORE_DESC)
if user_input:
self.set_suggestions(self._processes, kp.Match.FUZZY, kp.Sort.SCORE_DESC)
else:
self.set_suggestions(sorted(self._processes, key=lambda p: (p.label().endswith("(background)"), p.label().lower())),
kp.Match.ANY,
kp.Sort.NONE)

def on_execute(self, item, action):
"""Executes the selected (or default) kill action on the selected item
Expand Down

0 comments on commit ff92f6f

Please sign in to comment.