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

Commit eb52b10

Browse files
[copyq] v3
1 parent 220b112 commit eb52b10

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

copyq/__init__.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
from albert import *
99

10-
md_iid = '2.3'
11-
md_version = "1.6"
10+
md_iid = "3.0"
11+
md_version = "2.0"
1212
md_name = "CopyQ"
1313
md_description = "Access CopyQ clipboard"
1414
md_license = "BSD-2-Clause"
@@ -51,16 +51,14 @@ class Plugin(PluginInstance, TriggerQueryHandler):
5151

5252
def __init__(self):
5353
PluginInstance.__init__(self)
54-
TriggerQueryHandler.__init__(
55-
self, self.id, self.name, self.description,
56-
defaultTrigger='cp '
57-
)
54+
TriggerQueryHandler.__init__(self)
55+
56+
def defaultTrigger(self):
57+
return "cp "
5858

5959
def handleTriggerQuery(self, query):
6060
items = []
61-
q_string = query.string
62-
63-
script = copyq_script_getMatches % q_string if q_string else copyq_script_getAll
61+
script = copyq_script_getMatches % query.string if query.string else copyq_script_getAll
6462
proc = subprocess.run(["copyq", "-"], input=script.encode(), stdout=subprocess.PIPE)
6563
json_arr = json.loads(proc.stdout.decode())
6664

@@ -72,12 +70,12 @@ def handleTriggerQuery(self, query):
7270
else:
7371
text = " ".join(filter(None, text.replace("\n", " ").split(" ")))
7472

75-
act = lambda script, row=row: (
76-
lambda: runDetachedProcess(["copyq", script % row])
73+
act = lambda s=script, r=row: (
74+
lambda: runDetachedProcess(["copyq", s % r])
7775
)
7876
items.append(
7977
StandardItem(
80-
id=self.id,
78+
id=self.id(),
8179
iconUrls=["xdg:copyq"],
8280
text=text,
8381
subtext="%s: %s" % (row, ", ".join(json_obj["mimetypes"])),

0 commit comments

Comments
 (0)