Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit c5f7075

Browse files
[all] Adopt iid v1.0
1 parent 7e07e37 commit c5f7075

23 files changed

Lines changed: 141 additions & 129 deletions

File tree

arch_wiki/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
import json
88
import os
99

10-
md_iid = "0.5"
11-
md_version = "1.2"
10+
md_iid = '1.0'
11+
md_version = "1.3"
1212
md_name = "ArchLinux Wiki"
1313
md_description = "Search ArchLinux Wiki articles"
1414
md_license = "BSD-3"
1515
md_url = "https://github.com/albertlauncher/python/tree/master/awiki"
1616
md_maintainers = "@manuelschneid3r"
1717

1818

19-
class Plugin(QueryHandler):
19+
class Plugin(TriggerQueryHandler):
2020

2121
icon = [os.path.dirname(__file__) + "/ArchWiki.svg"]
2222
baseurl = 'https://wiki.archlinux.org/api.php'
@@ -35,7 +35,7 @@ def description(self):
3535
def defaultTrigger(self):
3636
return "awiki "
3737

38-
def handleQuery(self, query):
38+
def handleTriggerQuery(self, query):
3939
stripped = query.string.strip()
4040
if stripped:
4141

aur/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
import json
1515
import os
1616

17-
md_iid = "0.5"
18-
md_version = "1.6"
17+
md_iid = '1.0'
18+
md_version = "1.7"
1919
md_name = "AUR"
2020
md_description = "Query and install AUR packages"
2121
md_license = "BSD-3"
2222
md_url = "https://github.com/albertlauncher/python/tree/master/aur"
2323
md_maintainers = "@manuelschneid3r"
2424

2525

26-
class Plugin(QueryHandler):
26+
class Plugin(TriggerQueryHandler):
2727

2828
aur_url = "https://aur.archlinux.org/packages/"
2929
baseurl = 'https://aur.archlinux.org/rpc/'
@@ -55,7 +55,7 @@ def initialize(self):
5555
info("No supported AUR helper found.")
5656
self.install_cmdline = None
5757

58-
def handleQuery(self, query):
58+
def handleTriggerQuery(self, query):
5959
for number in range(50):
6060
sleep(0.01)
6161
if not query.isValid:

bitwarden/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from albert import *
77

8-
md_iid = "0.5"
9-
md_version = "1.1"
8+
md_iid = '1.0'
9+
md_version = "1.2"
1010
md_name = "Bitwarden"
1111
md_description = "'rbw' wrapper extension"
1212
md_license = "BSD-3"
@@ -15,7 +15,7 @@
1515
md_credits = "Original author: @tylio"
1616
md_bin_dependencies = ["rbw"]
1717

18-
class Plugin(QueryHandler):
18+
class Plugin(TriggerQueryHandler):
1919
def id(self):
2020
return md_id
2121

@@ -51,7 +51,7 @@ def _get_passwords(self):
5151

5252
return passwords
5353

54-
def handleQuery(self, query):
54+
def handleTriggerQuery(self, query):
5555
if query.string.strip().lower() == "unlock":
5656
query.add(
5757
Item(

copyq/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from albert import *
77

8-
md_iid = "0.5"
9-
md_version = "1.2"
8+
md_iid = '1.0'
9+
md_version = "1.3"
1010
md_name = "CopyQ"
1111
md_description = "Access CopyQ clipboard"
1212
md_license = "BSD-2-Clause"
@@ -45,7 +45,7 @@
4545
"""
4646

4747

48-
class Plugin(QueryHandler):
48+
class Plugin(TriggerQueryHandler):
4949
def id(self):
5050
return md_id
5151

@@ -61,7 +61,7 @@ def synopsis(self):
6161
def defaultTrigger(self):
6262
return "cq "
6363

64-
def handleQuery(self, query):
64+
def handleTriggerQuery(self, query):
6565
items = []
6666
q_string = query.string
6767

dice_roll/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
Example: "roll 2d6 3d8 1d20"
1515
"""
1616

17-
md_iid = "0.5"
18-
md_version = "1.0"
17+
md_iid = '1.0'
18+
md_version = "1.1"
1919
md_name = "Dice Roll"
2020
md_description = "Roll any number of dice"
2121
md_license = "MIT"
@@ -128,7 +128,7 @@ def get_items(query_string: str) -> list[albert.Item]:
128128
return results
129129

130130

131-
class Plugin(albert.QueryHandler):
131+
class Plugin(albert.TriggerQueryHandler):
132132
"""A plugin to roll dice"""
133133

134134
def id(self) -> str:
@@ -146,7 +146,7 @@ def synopsis(self) -> str:
146146
def defaultTrigger(self) -> str:
147147
return "roll "
148148

149-
def handleQuery(self, query: albert.Query) -> None:
149+
def handleTriggerQuery(self, query: albert.TriggerQuery) -> None:
150150
query_string = query.string.strip()
151151
try:
152152
items = get_items(query_string)

docker/__init__.py

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import pathlib
99
import docker
1010

11-
md_iid = "0.5"
12-
md_version = "1.3"
11+
md_iid = "1.0"
12+
md_version = "1.4"
1313
md_name = "Docker"
1414
md_description = "Control your docker instance"
1515
md_license = "BSD-3"
@@ -41,43 +41,55 @@ def initialize(self):
4141
if not self.client:
4242
raise "Failed to initialize client."
4343

44+
def handleGlobalQuery(self, query):
45+
rank_items = []
4446

45-
def handleQuery(self, query):
4647
for container in self.client.containers.list(all=True):
48+
if query.string in container.name:
49+
# Create dynamic actions
50+
if container.status == 'running':
51+
actions = [
52+
Action("stop", "Stop container", lambda c=container: c.stop()),
53+
Action("restart", "Restart container", lambda c=container: c.restart())
54+
]
55+
else:
56+
actions = [
57+
Action("start", "Start container", lambda c=container: c.start())
58+
]
59+
actions.extend([
60+
Action("logs", "Logs", lambda c=container.id: runTerminal("docker logs -f %s" % c, close_on_exit=False)),
61+
Action("remove", "Remove (forced, with volumes)", lambda c=container: c.remove(v=True, force=True)),
62+
Action("copy-id", "Copy id to clipboard", lambda id=container.id: setClipboardText(id))
63+
])
4764

48-
# Create dynamic actions
49-
if container.status == 'running':
50-
actions = [
51-
Action("stop", "Stop container", lambda c=container: c.stop()),
52-
Action("restart", "Restart container", lambda c=container: c.restart())
53-
]
54-
else:
55-
actions = [
56-
Action("start", "Start container", lambda c=container: c.start())
57-
]
58-
actions.extend([
59-
Action("logs", "Logs", lambda c=container.id: runTerminal("docker logs -f %s" % c, close_on_exit=False)),
60-
Action("remove", "Remove (forced, with volumes)", lambda c=container: c.remove(v=True, force=True)),
61-
Action("copy-id", "Copy id to clipboard", lambda id=container.id: setClipboardText(id))
62-
])
63-
64-
query.add(Item(
65-
id=container.id,
66-
text="%s (%s)" % (container.name, ", ".join(container.image.tags)),
67-
subtext=container.id,
68-
icon=self.icon_running if container.status == 'running' else self.icon_stopped,
69-
actions=actions
70-
))
65+
rank_items.append(RankItem(
66+
item=Item(
67+
id=container.id,
68+
text="%s (%s)" % (container.name, ", ".join(container.image.tags)),
69+
subtext="Container: %s" % container.id,
70+
icon=self.icon_running if container.status == 'running' else self.icon_stopped,
71+
actions=actions
72+
),
73+
score=0 # len(query.string)/len(container.name)
74+
))
7175

7276
for image in reversed(self.client.images.list()):
73-
query.add(Item(
74-
id=image.short_id,
75-
text=str(image.tags),
76-
subtext=image.id,
77-
icon=self.icon_stopped,
78-
actions=[
79-
Action("run", "Run with command: %s" % query.string,
80-
lambda i=image, s=query.string: client.containers.run(i, s)),
81-
Action("rmi", "Remove image", lambda i=image: i.remove())
82-
]
83-
))
77+
if any([query.string in tag for tag in image.tags]):
78+
rank_items.append(RankItem(
79+
item=Item(
80+
id=image.short_id,
81+
text=", ".join(image.tags),
82+
subtext="Image: %s" % image.id,
83+
icon=self.icon_stopped,
84+
actions=[
85+
Action("run", "Run with command: %s" % query.string,
86+
lambda i=image, s=query.string: client.containers.run(i, s)),
87+
Action("rmi", "Remove image", lambda i=image: i.remove())
88+
]
89+
),
90+
score=0
91+
))
92+
93+
94+
return rank_items
95+

emoji/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
from albert import Action, Item, QueryHandler, cacheLocation, setClipboardText
1515

16-
md_iid = "0.5"
17-
md_version = "1.0"
16+
md_iid = '1.0'
17+
md_version = "1.1"
1818
md_name = "Emoji Picker"
1919
md_description = "Find emojis by name"
2020
md_license = "GPL-3.0"
@@ -60,7 +60,7 @@ def schedule_create_missing_icons(emojis):
6060
return executor
6161

6262

63-
class Plugin(QueryHandler):
63+
class Plugin(TriggerQueryHandler):
6464
def id(self):
6565
return __name__
6666

@@ -126,7 +126,7 @@ def matched_emojis(self, query_tokens):
126126

127127
yield emoji
128128

129-
def handleQuery(self, query):
129+
def handleTriggerQuery(self, query):
130130
query_tokens = query.string.strip().lower().split()
131131
if not query_tokens:
132132
return

goldendict/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from albert import Action, Item, Query, QueryHandler, runDetachedProcess # pylint: disable=import-error
1+
from albert import Action, Item, TriggerQuery, TriggerQueryHandler, runDetachedProcess # pylint: disable=import-error
22

3-
md_iid = '0.5'
4-
md_version = '1.1'
3+
md_iid = '1.0'
4+
md_version = '1.2'
55
md_name = 'GoldenDict'
66
md_description = 'Searches in GoldenDict'
77
md_url = 'https://github.com/albertlauncher/python/'
@@ -12,7 +12,7 @@
1212
ICON_PATH = '/usr/share/pixmaps/goldendict.png'
1313

1414

15-
class Plugin(QueryHandler):
15+
class Plugin(TriggerQueryHandler):
1616
def id(self) -> str:
1717
return __name__
1818

@@ -28,7 +28,7 @@ def defaultTrigger(self) -> str:
2828
def synopsis(self) -> str:
2929
return 'query'
3030

31-
def handleQuery(self, query: Query) -> None:
31+
def handleTriggerQuery(self, query: TriggerQuery) -> None:
3232
query_str = query.string.strip()
3333
if not query_str:
3434
return

googletrans/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
from time import sleep
1111
import os
1212

13-
md_iid = "0.5"
14-
md_version = "1.0"
13+
md_iid = '1.0'
14+
md_version = "1.1"
1515
md_name = "Google Translate"
1616
md_description = "Translate sentences using googletrans"
1717
md_license = "BSD-3"
1818
md_url = "https://github.com/albertlauncher/python/"
1919
md_lib_dependencies = "googletrans==3.1.0a0"
2020
md_maintainers = "@manuelschneid3r"
2121

22-
class Plugin(QueryHandler):
22+
class Plugin(TriggerQueryHandler):
2323

2424
def id(self):
2525
return md_id
@@ -41,7 +41,7 @@ def initialize(self):
4141
self.translator = Translator()
4242
self.lang = getdefaultlocale()[0][0:2]
4343

44-
def handleQuery(self, query):
44+
def handleTriggerQuery(self, query):
4545
stripped = query.string.strip()
4646
if stripped:
4747
for number in range(50):

jetbrains_projects/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from xml.etree import ElementTree
1616
from albert import *
1717

18-
md_iid = "0.5"
19-
md_version = "1.2"
18+
md_iid = '1.0'
19+
md_version = "1.3"
2020
md_name = "Jetbrains projects"
2121
md_description = "Open your JetBrains projects"
2222
md_license = "GPL-3"
@@ -82,7 +82,7 @@ def _parse_recent_projects(self, recent_projects_file: Path) -> list[Project]:
8282
return []
8383

8484

85-
class Plugin(QueryHandler):
85+
class Plugin(TriggerQueryHandler):
8686
executables = []
8787

8888
def id(self):
@@ -161,7 +161,7 @@ def initialize(self):
161161
]
162162
self.editors = [e for e in editors if e.binary is not None]
163163

164-
def handleQuery(self, query: Query):
164+
def handleTriggerQuery(self, query: TriggerQuery):
165165
editor_project_pairs = []
166166
for editor in self.editors:
167167
projects = editor.list_projects()
@@ -174,7 +174,7 @@ def handleQuery(self, query: Query):
174174

175175
query.add([self._make_item(editor, project, query) for editor, project in editor_project_pairs])
176176

177-
def _make_item(self, editor: Editor, project: Project, query: Query) -> Item:
177+
def _make_item(self, editor: Editor, project: Project, query: TriggerQuery) -> Item:
178178
return Item(
179179
id="%s-%s-%s" % (editor.binary, project.path, project.last_opened),
180180
text=project.name,

0 commit comments

Comments
 (0)