-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyq-commands.ini
260 lines (260 loc) · 13.3 KB
/
copyq-commands.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
[Commands]
1\Command=xdotool type %1\n
1\GlobalShortcut=meta+ctrl+alt+v
1\HideWindow=true
1\Icon=\xf15b
1\InMenu=true
1\Input=text/plain
1\IsGlobalShortcut=true
1\Name=Paste via typing
10\Command="copyq:\nvar indent = 4\n\nfunction fromData(data)\n{\n var text = str(data)\n if ( data.equals(new ByteArray(text)) ) {\n if (text.indexOf('\\n') == -1)\n return text\n return { lines: text.split('\\n') }\n }\n return { base64: toBase64(data) }\n}\n\nvar itemsData = selectedItemsData()\nfor (var i in itemsData) {\n var itemData = itemsData[i]\n for (var format in itemData)\n itemData[format] = fromData(itemData[format])\n}\n\nvar text = JSON.stringify(itemsData, null, indent)\ncopy('{ \"copyq_items\": ' + text + ' }')"
10\Display=true
10\Enable=false
10\Icon=\xf2f5
10\InMenu=true
10\Name=Copy Items as JSON
11\Command="copyq: \ncopy('Hello, World!')\nadd('Hello, World!')\npaste()"
11\Enable=false
11\GlobalShortcut=meta+ctrl+alt+v
11\Icon=\xf2f6
11\InMenu=true
11\IsGlobalShortcut=true
11\MatchCommand=copyq: str(clipboard()).match(/^{ \"copyq_items\": \\[\\n/) || fail()
11\Name=Paste Joined with Comma
12\Command="copyq:\nvar language = 'eng'\n\nvar imageData = input()\nvar result = execute('tesseract', '--list-langs')\nvar languages = str(result.stdout).split('\\n').slice(1)\n\nresult = execute('tesseract', '-l', language, 'stdin', 'stdout', null, data('image/png'))\nadd(result.stdout)\ncopy(result.stdout)"
12\Enable=false
12\GlobalShortcut=ctrl+alt+t
12\Icon=\xf1ea
12\InMenu=true
12\IsGlobalShortcut=true
12\Name=Copy Text from Image (&OCR)
13\Command=" import png:- | convert png:- -colorspace Gray -depth 8 -resample 200x200 tif:- | copyq:\nvar language = 'eng'\n\nvar imageData = input()\nvar result = execute('tesseract', '--list-langs')\nvar languages = str(result.stdout).split('\\n').slice(1)\n\nresult = execute('tesseract', '-l', language, 'stdin', 'stdout', null, imageData)\nadd(result.stdout)\ncopy(result.stdout)"
13\GlobalShortcut=alt+shift+t, ctrl+alt+t
13\Icon=\xf1ea
13\IsGlobalShortcut=true
13\Name=Copy Text from Screen Selection
14\Command="copyq: paste();"
14\Icon=\xf0ab
14\IsGlobalShortcut=true
14\Name=Paste non-plain
15\Automatic=true
15\Command="copyq: execute('kitty', '/usr/bin/mpv', clipboard())"
15\Enable=false
15\HideWindow=true
15\Icon=\xf15b
15\InMenu=true
15\Match=^https://.*.youtube.com/.*
15\Name=mpv_url
15\Tab=mpv
16\Command="copyq: execute('/usr/bin/virt-manager');"
16\Icon=\xf15b
16\IsGlobalShortcut=true
16\Name=Show virt-manager
17\Automatic=true
17\Command=copyq open %1
17\Enable=false
17\HideWindow=true
17\Icon=\xf144
17\InMenu=true
17\Match=^https?://.*\\.(mp4|avi|mkv|wmv|flv|ogv)$
17\Name=Autoplay videos
18\Command=copyq: plugins.itemtags.tag()
18\Icon=\xf02b
18\InMenu=true
18\Name=Add a Tag
18\Shortcut=f2
19\Display=true
19\Icon=\xf15b
19\InMenu=true
19\Name=Share with umlaut
19\Shortcut=alt+3
19\Tab=P3
2\Command="copyq:\nvar suffices = {\n 'image/svg': 'svg',\n 'image/png': 'png',\n 'image/jpeg': 'jpg',\n 'image/jpg': 'jpg',\n 'image/bmp': 'bmp',\n 'text/html': 'html',\n 'text/plain' : 'txt',\n}\n\nfunction hasSuffix(fileName)\n{\n return /\\.[0-9a-zA-z]+$/.test(fileName);\n}\n\nfunction addSuffix(fileName, format)\n{\n var suffix = suffices[format]\n return suffix ? fileName + \".\" + suffix : fileName\n}\n\nfunction filterFormats(format)\n{\n return /^[a-z]/.test(format) && !/^application\\/x/.test(format)\n}\n\nfunction itemFormats(row)\n{\n return str(read('?', row))\n .split('\\n')\n .filter(filterFormats)\n}\n\nfunction formatPriority(format)\n{\n var k = Object.keys(suffices);\n var i = k.indexOf(format);\n return i === -1 ? k.length : i\n}\n\nfunction reorderFormats(formats)\n{\n formats.sort(function(lhs, rhs){\n var i = formatPriority(lhs);\n var j = formatPriority(rhs);\n return i === j ? lhs.localeCompare(rhs) : i - j;\n })\n}\n\nif (selectedtab()) tab(selectedtab())\nvar row = selectedtab() ? currentitem() : -1\nvar formats = itemFormats(row)\nreorderFormats(formats)\n\ncurrentpath(Dir().homePath())\nvar defaultFileName = 'CQ/untitled'\n\nvar keyFormat = 'Format'\nvar keyFileName = 'File'\nvar defaultFormat = formats[0]\n\nvar result = dialog(\n '.title', 'Save Item As...',\n '.width', 250,\n keyFormat, [defaultFormat].concat(formats),\n keyFileName, File(defaultFileName) \n) || abort()\n\nvar fileName = result[keyFileName]\nvar format = result[keyFormat]\n\nif (!format || !fileName)\n abort()\n\nif (!hasSuffix(fileName))\n fileName = addSuffix(fileName, format)\n\nvar f = File(fileName)\nif (!f.open()) {\n popup('Failed to open \"' + f.fileName() + '\"', f.errorString())\n abort()\n}\n\nf.write(selectedtab() ? getitem(currentitem())[format] : clipboard(format))\npopup(\"Item Saved\", 'Item saved as \"' + f.fileName() + '\".')"
2\Icon=\xf0c7
2\InMenu=true
2\Name=Save As...
2\Shortcut=ctrl+s
20\Automatic=true
20\Command="copyq:\nvar time = dateString('yyyy-MM-dd hh:mm:ss')\nsetData('application/x-copyq-user-copy-time', time)\n\nvar tagsMime = 'application/x-copyq-tags'\nvar tags = str(data(tagsMime)) + ', ' + time\nsetData(tagsMime, tags)"
20\Icon=\xf017
20\Name=Store Copy Time
21\Automatic=true
21\Command="copyq:\nvar window = str(data('application/x-copyq-owner-window-title'))\nvar tagsMime = 'application/x-copyq-tags'\nvar tags = str(data(tagsMime)) + ', ' + window\nsetData(tagsMime, tags)"
21\Icon=\xf009
21\Name=Store Window Title
22\Command=copyq: menu()
22\GlobalShortcut=ctrl+alt+h
22\Icon=\xf01c
22\IsGlobalShortcut=true
22\Name=Show the tray menu
23\Automatic=true
23\Command="copyq:\nvar option = 'disable_monitoring'\nvar disabled = str(settings(option)) === 'true'\n\nif (str(data('application/x-copyq-shortcut'))) {\n disabled = !disabled\n settings(option, disabled)\n popup('', disabled ? 'Monitoring disabled' : 'Monitoring enabled')\n}\n\nif (disabled) {\n disable()\n ignore()\n} else {\n enable()\n}"
23\Icon=\xf05e
23\InMenu=true
23\Name=Toggle Monitoring
23\Shortcut=meta+ctrl+alt+u
24\Command=copyq: toggle()
24\GlobalShortcut=ctrl+alt+p
24\Icon=\xf022
24\IsGlobalShortcut=true
24\Name=Show/hide main window
25\Command=copyq: plugins.itemencrypted.encryptItems()
25\Enable=false
25\Icon=\xf023
25\InMenu=true
25\Input=!OUTPUT
25\Name=Encrypt
25\Output=application/x-copyq-encrypted
25\Shortcut=ctrl+l
26\Command=copyq: plugins.itemencrypted.decryptItems()
26\Enable=false
26\Icon=\xf09c
26\InMenu=true
26\Input=application/x-copyq-encrypted
26\Name=Decrypt
26\Output=application/x-copyq-item
27\Command=copyq: plugins.itemencrypted.copyEncryptedItems()
27\Enable=false
27\Icon=\xf13e
27\InMenu=true
27\Input=application/x-copyq-encrypted
27\Name=Decrypt and Copy
27\Shortcut=ctrl+shift+l
28\Command=copyq: plugins.itemencrypted.pasteEncryptedItems()
28\Enable=false
28\Icon=\xf13e
28\InMenu=true
28\Input=application/x-copyq-encrypted
28\Name=Decrypt and Paste
28\Shortcut=enter
29\Command=copyq open %1
29\Enable=false
29\HideWindow=true
29\Icon=\xf0ac
29\InMenu=true
29\Name=Open in &Browser
29\Shortcut=alt+b
3\Command="copyq: \nvar imageData = screenshot()\nwrite('image/png', imageData)\ncopy('image/png', imageData)\n"
3\GlobalShortcut=print
3\Icon=\xf030
3\IsGlobalShortcut=true
3\Name=Take screenshot
30\Command="copyq: \nvar text = clipboard()\ncopy(text)\ncopySelection(text)\npaste()"
30\GlobalShortcut=ctrl+alt+v
30\Icon=\xf0ea
30\IsGlobalShortcut=true
30\Name=Paste clipboard as plain text
31\Command="copyq:\nvar text = input()\ncopy(text)\ncopySelection(text)\npaste()"
31\Enable=false
31\GlobalShortcut=ctrl+l
31\HideWindow=true
31\Icon=\xf0ea
31\InMenu=true
31\Input=text/plain
31\IsGlobalShortcut=true
31\Name=Paste as Plain Text
31\OutputTab=&clipboard
32\Command=copyq: showAt()
32\Icon=\xf022
32\IsGlobalShortcut=true
32\Name=Show main window under mouse cursor
33\Command="copyq: \nvar imageData = screenshotSelect()\nwrite('image/png', imageData)\ncopy('image/png', imageData)\n"
33\GlobalShortcut=ctrl+print
33\Icon=\xf030
33\IsGlobalShortcut=true
33\Name=Take screenshot selection
34\Command=copyq: plugins.itempinned.pin()
34\Enable=false
34\Icon=\xf08d
34\InMenu=true
34\Input=!OUTPUT
34\Name=Pin
34\Output=application/x-copyq-item-pinned
35\Command=copyq: plugins.itempinned.unpin()
35\Enable=false
35\Icon=\xf08d
35\InMenu=true
35\Input=application/x-copyq-item-pinned
35\Name=Unpin
36\Command=copyq: plugins.itemtags.tag(decodeURIComponent('%5C1'))
36\Enable=false
36\Icon=\xf02b
36\InMenu=true
36\MatchCommand=copyq: plugins.itemtags.hasTag(decodeURIComponent('%5C1')) && fail()
36\Name=Tag as \x201c\\1\x201d
37\Command=copyq: plugins.itemtags.untag(decodeURIComponent('%5C1'))
37\Enable=false
37\Icon=\xf02b
37\InMenu=true
37\MatchCommand=copyq: plugins.itemtags.hasTag(decodeURIComponent('%5C1')) || fail()
37\Name=Remove tag \x201c\\1\x201d
38\Command=copyq:\npopup(\"Please!\")
38\GlobalShortcut=alt+shift+v
38\Icon=\xf15b
38\InMenu=true
38\IsGlobalShortcut=true
38\Name=Paste Previous
38\Shortcut=alt+v
39\Command=copyq: action()
39\Enable=false
39\GlobalShortcut=meta+ctrl+alt+shift+a
39\Icon=\xf013
39\InternalId=copyq_global_show_action_dialog
39\IsGlobalShortcut=true
39\Name=Show action dialog
4\Automatic=true
4\Command="copyq: \n function lz(s) { return (s.length == 1 ? \"0\"+s : s ) }\n function lzz(s) { return (s.length == 2 ? \"20\"+s : s ) }\n var text = str(clipboard())\n var dateRe = new RegExp('^([0-9]{1,2})\\.([0-9]{1,2})\\.([0-9]{2,4})$')\n var res = dateRe.exec(text)\n var result = lzz(res[3]) \n var result = lzz(res[3]) + \"-\" + lz(res[2]) + \"-\" + lz(res[1])\n copy(result)\n execute(\"notify-send\", result)\n"
4\Icon=\xf15b
4\InMenu=true
4\Match="^[0-9]{1,2}\\.[0-9]{1,2}\\.[0-9]{2,4}$"
4\Name=UnifyDate
40\Command=copyq: plugins.itemtags.untag()
40\Enable=false
40\Icon=\xf02b
40\InMenu=true
40\Input=application/x-copyq-tags
40\Name=Remove a Tag
41\Command=copyq: plugins.itemtags.clearTags()
41\Enable=false
41\Icon=\xf02b
41\InMenu=true
41\Input=application/x-copyq-tags
41\Name=Clear all tags
42\Command=copyq: edit()
42\Enable=false
42\GlobalShortcut=meta+ctrl+alt+space
42\Icon=\xf069
42\IsGlobalShortcut=true
42\Name=Create new item
5\Command="copyq:\nfromLanguage = 'auto'\ntoLanguage = 'en'\n\ntext = str(input())\nurl = 'https://translate.google.com/#view=home&op=translate'\n + '&sl=' + fromLanguage\n + '&tl=' + toLanguage\n + '&text=' + encodeURIComponent(text)\nopen(url)"
5\Icon=\xf558
5\InMenu=true
5\Input=text/plain
5\Name=Google-Translate to English
5\Shortcut=ctrl+shift+e
6\Automatic=true
6\Command="copyq:\nvar time = dateString('yyyy-MM-dd hh:mm:ss')\nsetData('application/x-copyq-user-copy-time', time)\n\nvar tagsMime = 'application/x-copyq-tags'\nvar tags = str(data(tagsMime)) + ', ' + time\nsetData(tagsMime, tags)\n"
6\Icon=\xf15b
6\Match=((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}
6\Name=Tab for IPv4 addresses
6\Tab=IPv4
7\Automatic=true
7\Icon=\xf15b
7\Match="[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*"
7\Name=Tab for email addresses
7\Tab=Email
8\Automatic=true
8\Command=copyq:
8\Icon=\xf0c1
8\Input=text/plain
8\Match=^https?://
8\Name=Tab for URLs
8\Tab=&URLs
9\Automatic=true
9\Command="copyq:\nvar tabName = '&urls'\n\nfunction lower(data) {\n return str(data).toLowerCase()\n}\n\nfunction findHeader(reply, headerName) {\n reply.data // fetches data and headers\n var headers = reply.headers\n for (var i in headers) {\n var header = headers[i]\n if (lower(header[0]) === headerName)\n return header[1]\n }\n return ''\n}\n\nfunction isHtml(reply) {\n var header = findHeader(reply, 'content-type')\n if (header)\n return lower(header).indexOf(mimeHtml) === 0\n return false\n}\n\nfunction fetchContent(url, maxRedirects) {\n if (maxRedirects === undefined)\n maxRedirects = 4\n\n var reply = networkGet(url)\n if (maxRedirects == 0)\n return reply\n var header = findHeader(reply, 'location')\n if (header)\n return fetchContent(header, maxRedirects - 1)\n\n return reply\n}\n\nfunction grep(content, re) {\n return content ? (re.exec(content) || [])[1] : ''\n}\n\nfunction getTitle(content) {\n var title = grep(content, /<title[^>]*>([^<]*)<\\/title>/i)\n return title ? title.trim() : ''\n}\n\nfunction getFavicon(content) {\n var iconLine = grep(content, /<link([^>]*rel=[\"'](?:shortcut )?icon[\"'][^>]*)/i)\n var icon = grep(iconLine, /href=[\"']([^\"']*)/i)\n\n if (!icon)\n return ''\n\n // Icon path can be complete URL.\n if (icon.indexOf('://') != -1)\n return fetchContent(icon).data\n\n // Icon path can be missing protocol.\n if (icon.substr(0, 2) === '//') {\n var i = url.search(/\\/\\//)\n var protocol = (i == -1) ? 'http:' : url.substr(0, i)\n return fetchContent(protocol + icon).data\n }\n\n // Icon path can be relative to host URL.\n if (icon[0] === '/') {\n var baseUrl = url.substr(0, url.search(/[^\\/:](\\/|$)/) + 1)\n return fetchContent(baseUrl + icon).data\n }\n\n // Icon path can be relative to current URL.\n var baseUrl = url.substr(0, url.lastIndexOf('/') + 1)\n return fetchContent(baseUrl + icon).data\n}\n\nvar url = str(input()).trim()\n\n// URL already added? (Just check the top of the list.)\nif (url === str(read(0)))\n abort()\n\n// Fetch HTML.\nvar reply = fetchContent(url)\nif (isHtml(reply)) {\n var content = str(reply.data)\n var title = getTitle(content)\n var icon = getFavicon(content)\n\n setData(mimeItemNotes, title || '')\n setData('application/x-copyq-item-icon', icon)\n}\n\nsetData(mimeOutputTab, tabName)"
9\Enable=false
9\Icon=\xf0c1
9\Input=text/plain
9\Match=^https?://
9\Name=Tab for URLs with Title and Icon - orig
size=42