Debian Codegraph @

docs/faq.rst

raw
1 FAQ - Frequently Asked Questions
2 ================================
3
4 .. _faq-show-app:
5
6 How to open CopyQ window or tray menu using shortcut?
7 -----------------------------------------------------
8
9 Add new command to open the CopyQ window or menu with a global shortcut:
10
11 1. Open "Command" dialog (``F6`` shortcut).
12 2. Click "Add" button in the dialog.
13 3. Select "Show/hide main window" or "Show the tray menu" from the list
14 and click "OK" button.
15 4. Click the button next to "Global Shortcut" label and set the
16 shortcut.
17 5. Click "OK" button to save the changes.
18
19 For more information about commands see :ref:`writing-commands`.
20
21 .. _faq-paste-from-window:
22
23 How to paste double-clicked item from CopyQ window?
24 ---------------------------------------------------
25
26 1. Open "Preferences" (``Ctrl+P`` shortcut).
27 2. Go to "History" tab.
28 3. Enable "Paste to current window" option.
29
30 Next time you open the CopyQ main window and activate an item,
31 it should be pasted.
32
33 .. _faq-paste-text:
34
35 How to paste as plain text?
36 ---------------------------
37
38 To **paste clipboard as plain text**:
39
40 1. Open "Command" dialog (``F6`` shortcut).
41 2. Click "Add" button in the dialog.
42 3. Select "Paste clipboard as plain text" from the list and click "OK" button.
43 4. Click the button next to "Global Shortcut" label and set the shortcut.
44 5. Click "OK" button to save the changes.
45
46 To **paste selected items as plain text** (from CopyQ window) follow the steps above
47 but add "Paste as Plain Text" command instead and change "Shortcut".
48
49 .. _faq-store-text:
50
51 How to store only plain text?
52 -----------------------------
53
54 To **disallow storing HTML and rich text**:
55
56 1. Open "Preferences" (``Ctrl+P`` shortcut).
57 2. Go to "Items" tab.
58 3. Disable "Web" item in the list.
59 4. Select "Text" item.
60 5. Disable "Save and display HTML and rich text".
61
62 Similarly, you can also disable "Images" in the list to avoid storing and
63 rendering images.
64
65 Existing items won't be affected but **any data formats can be removed**:
66
67 1. Select an item.
68 2. Press ``F4`` shortcut ("Item - Show Content..." in menu).
69 3. Select format from list.
70 4. Press ``Delete`` key.
71
72 .. _faq-disable-clipboard-storing:
73
74 How to disable storing clipboard?
75 ---------------------------------
76
77 To temporarily disable storing the clipboard in the CopyQ item list,
78 select menu item "File - Disable Clipboard Storing" (``Ctrl+Shift+X`` shortcut).
79 To re-enable the functionality select "File - Enable Clipboard Storing" (same shortcut).
80
81 To permanently disable storing the clipboard in CopyQ:
82
83 1. Open "Preferences" (``Ctrl+P`` shortcut).
84 2. Go to "History" tab.
85 3. Clear "Tab for storing clipboard" field.
86
87 How to back up tabs, configuration and commands?
88 ------------------------------------------------
89
90 From menu select "File - Export" and choose which tabs to export and whether to export
91 configuration and commands.
92
93 To restore the backup, select menu item "File - Import", select the exported file, and
94 then choose what to import back.
95
96 .. note::
97
98 Importing tabs and commands won't override existing tabs, and will create new ones.
99
100 See also: :ref:`backup`
101
102 .. _faq-disable-notifications:
103
104 How to enable or disable displaying notification when clipboard changes?
105 ------------------------------------------------------------------------
106
107 To enable displaying the notifications:
108
109 1. Open "Preferences" (``Ctrl+P`` shortcut).
110 2. Go to "Notifications" tab.
111 3. Set non-zero value for "Interval in seconds to display notifications".
112 4. Set non-zero value for "Number of lines for clipboard notification".
113 5. Click "OK" button.
114
115 To enable displaying the notifications, set either of the options
116 mentioned above to zero.
117
118 .. _faq-share-commands:
119
120 How to load shared commands and share them?
121 -------------------------------------------
122
123 You can stumble upon code that looks like this.
124
125 .. code-block:: ini
126
127 [Command]
128 Name=Show/hide main window
129 Command=copyq: toggle()
130 Icon=\xf022
131 GlobalShortcut=ctrl+shift+1
132
133 This code represents a command that can used in CopyQ (specifically it
134 opens main window on Ctrl+Shift+1). To use the command in CopyQ:
135
136 1. Copy the code above.
137 2. Open "Command" dialog (``F6`` shortcut).
138 3. Click "Paste Commands" button at the bottom of the dialog.
139 4. Click OK button.
140
141 (Now you should be able to open main window with Ctrl+Shift+1.)
142
143 To share your commands, you can select the commands from command list in
144 "Command" dialog and press "Copy Selected" button (or just hit Ctrl+C).
145
146 .. _faq-ignore-password-manager:
147
148 How to omit storing text copied from specific windows like a password manager?
149 ------------------------------------------------------------------------------
150
151 Add and modify automatic command to ignore text copied from the window:
152
153 1. Open "Command" dialog (``F6`` shortcut).
154 2. Click "Add" button in the dialog.
155 3. Select "Ignore *Password* window" from the list and click "OK"
156 Button.
157 4. Select "Show Advanced"
158 5. Change "Window" text box to match the title (or part of it) of the
159 Window to ignore (e.g. ``KeePass``). But for **KeePassXC** (and possibly
160 other apps), it is better to set "Format" to ``x-kde-passwordManagerHint``
161 instead (also remember to remove the default that is set in the "Window"
162 setting, since both "Window" and "Format" need to match if they're set).
163 6. Click "OK" button to save the changes.
164
165 .. note::
166
167 This new command should be at the top of the command list because
168 automatic commands are executed in the order they appear in the list,
169 and we don't want to process sensitive data in any way.
170
171 In some cases, e.g. the password manager is an extension of a web browser or a
172 password is copied from a menu instead of a window, the command above won't
173 work. You can try setting the "Window" text box to ``^$``, which usually matches
174 popup menus.
175
176 For a more reliable way, use `a command to blacklist texts
177 <https://github.com/hluk/copyq-commands/tree/master/Scripts#blacklisted-texts>`__
178 (it stores just a salted hash, the text itself is not stored anywhere).
179
180 .. _faq-logging:
181
182 How to enable logging?
183 ----------------------
184
185 Set environment variable ``COPYQ_LOG_LEVEL`` to ``DEBUG`` for verbose logging
186 and set ``COPYQ_LOG_FILE`` to a file path for the log.
187
188 You can copy current log file path to clipboard from Action dialog (F5 shortcut)
189 by entering command ``copyq 'copy(info("log"))'``. Alternatively, press ``F12``
190 to directly access the log.
191
192 If you **cannot access GUI**, you can **restart CopyQ from terminal** and **log
193 to a separate file**. On Linux and macOS:
194
195 .. code-block:: zsh
196
197 copyq exit
198 export COPYQ_LOG_LEVEL='DEBUG'
199 export COPYQ_LOG_FILE="$HOME/copyq.log"
200 echo "Logs will be written to $COPYQ_LOG_FILE"
201 copyq
202
203 On Windows (in PowerShell):
204
205 .. code-block:: powershell
206
207 & 'C:\Program Files\CopyQ\copyq.exe' exit
208 $env:COPYQ_LOG_LEVEL = 'DEBUG'
209 $env:COPYQ_LOG_FILE = [Environment]::GetFolderPath("MyDocuments") + '\copyq.log'
210 echo "Logs will be written to $env:COPYQ_LOG_FILE"
211 & 'C:\Program Files\CopyQ\copyq.exe'
212
213 .. _faq-clipboard-size-limits:
214
215 How to limit clipboard data size?
216 ---------------------------------
217
218 Set the ``COPYQ_CLIPBOARD_MIME_SIZE_LIMIT`` environment variable to control the
219 maximum size of clipboard data that CopyQ will store. The value is a
220 semicolon-delimited list of ``pattern:bytes`` entries, where each pattern is a
221 regular expression matched against the MIME type. The byte value supports
222 ``K``, ``M``, and ``G`` suffixes (case-insensitive, binary units: 1K = 1024).
223 The first matching rule wins.
224
225 For example::
226
227 COPYQ_CLIPBOARD_MIME_SIZE_LIMIT="text/html.*:0;.*:100M"
228
229 This skips HTML data entirely and limits everything else to 100 MiB.
230
231 To skip storing images from the clipboard::
232
233 COPYQ_CLIPBOARD_MIME_SIZE_LIMIT="image/.*:0;.*:100M"
234
235 The built-in default limits all MIME types to 100 MiB. Custom rules replace
236 the default only when at least one valid rule is parsed; otherwise the default
237 applies. Set ``.*:-1`` to disable all limits. An empty size (e.g. ``text/plain:``)
238 also means no limit.
239
240 The same format can also be set from the CopyQ scripting API::
241
242 copyq config clipboard_mime_size_limit "text/html.*:0;.*:100M"
243
244 The environment variable takes precedence over the ``config`` option. If both
245 are set, the environment variable value is used.
246
247 How to preserve the order of copied items when copying or pasting multiple items?
248 ---------------------------------------------------------------------------------
249
250 a. Reverse order of selected items with ``Ctrl+Shift+R`` and copy them.
251 b. Alternatively, select items in reverse order and then copy.
252
253 See `#165 <https://github.com/hluk/CopyQ/issues/165#issuecomment-34745058>`__.
254
255 How does pasting single/multiple items work internally?
256 -------------------------------------------------------
257
258 ``Return`` key copies the whole item (with all formats) to the clipboard
259 and -- if the "Paste to current window" option is enabled -- it sends
260 ``Shift+Insert`` to previous window. So the target application decides
261 what format to paste on ``Shift+Insert``.
262
263 If you select more items and press ``Return``, just the concatenated
264 text of selected items is put into the clipboard. Though it could do more
265 in future, like join HTML, images or other formats.
266
267 See `#165 <https://github.com/hluk/CopyQ/issues/165#issuecomment-34957089>`__.
268
269 Why does pasting from CopyQ not work?
270 -------------------------------------
271
272 Pasting from CopyQ works only on Windows, macOS and X11 on Linux.
273
274 Specifically, this feature is not supported on Wayland, but you can use
275 the workaround: :ref:`known-issue-wayland`
276
277 First, check if you have the appropriate options enabled:
278
279 a. For pasting from main window, enable "Paste to current window" in "History"
280 configuration tab.
281 b. For pasting from tray menu, enable "Paste activated item to current window"
282 in "Tray" configuration tab.
283
284 If the pasting still doesn't work, check if ``Shift+Insert`` shortcut pastes to
285 the target window. That's the shortcut CopyQ uses by default. To change this to
286 ``Ctrl+V`` see `#633
287 <https://github.com/hluk/CopyQ/issues/633#issuecomment-278326916>`__.
288
289 If pasting still doesn't work, it could be caused by either of these problems:
290
291 - CopyQ fails to focus the target window correctly.
292 - The format copied to the clipboard is not supported by the target application.
293
294 How to open the context menu for selected items with only the keyboard?
295 -----------------------------------------------------------------------
296
297 In the main CopyQ window, press the ``Menu`` key (or ``Shift+F10``) to open
298 the context menu for selected items.
299
300 .. _faq-hide-menu-bar:
301
302 How to hide the menu bar in the main CopyQ window?
303 --------------------------------------------------
304
305 The menu bar can be hidden by modifying the style sheet of the current theme.
306
307 1. Open "Preferences" (``Ctrl+P`` shortcut).
308 2. Go to "Appearance" tab.
309 3. Enable checkbox "Set colors for tabs, tool bar and menus".
310 4. Click "Edit Theme" button.
311 5. Find ``menu_bar_css`` option and add ``height: 0``:
312
313 .. code-block:: ini
314
315 menu_bar_css="
316 ;height: 0
317 ;background: ${bg}
318 ;color: ${fg}"
319
320 How to reuse file paths copied from a file manager?
321 ---------------------------------------------------
322
323 By default, only the text is stored in item list when you copy or cut
324 files from a file manager. Other data is usually needed to be able to
325 copy/paste files from CopyQ.
326
327 You have to add additional data formats (MIME) using an automatic command
328 (similar to one below). The commonly used format in many file managers is
329 ``text/uri-list``. Other special formats include
330 ``x-special/gnome-copied-files`` for Nautilus and
331 ``application/x-kde-cutselection`` for Dolphin. These formats are used to
332 specify type of action (copy or cut).
333
334 .. code-block:: ini
335
336 [Command]
337 Command="
338 var originalFunction = global.clipboardFormatsToSave
339 global.clipboardFormatsToSave = function() {
340 return originalFunction().concat([
341 mimeUriList,
342 'x-special/gnome-copied-files',
343 'application/x-kde-cutselection',
344 ])
345 }"
346 Icon=\xf0c1
347 IsScript=true
348 Name=Store File Manager Metadata
349
350 How to trigger a command based on primary selection only?
351 ---------------------------------------------------------
352
353 You can check ``application/x-copyq-clipboard-mode`` format in automatic commands.
354
355 E.g. if you set input format of a command it will be only executed on Linux
356 mouse selection change:
357
358 .. code-block:: ini
359
360 [Command]
361 Automatic=true
362 Command="
363 copyq:
364 popup(input())"
365 Input=application/x-copyq-clipboard-mode
366 Name=Executed only on X11 selection change
367
368 Otherwise you can check it in command:
369
370 .. code-block:: ini
371
372 [Command]
373 Automatic=true
374 Command="
375 copyq:
376 if (str(data(mimeClipboardMode)) == 'selection')
377 popup('selection changed')
378 else
379 popup('clipboard changed')"
380 Name=Show clipboard/selection change
381
382 Why can I no longer paste from the application on macOS?
383 --------------------------------------------------------
384
385 See: :ref:`known-issue-macos-paste-after-install`
386
387 Why does my external editor fail to edit items?
388 -----------------------------------------------
389
390 CopyQ creates a temporary file with content of the edited item and passes it as
391 argument to the custom editor command. If the file changes, the item is also
392 modified.
393
394 Usual issues are:
395
396 - External editor opens an empty file.
397 - External editor warns that the file is missing.
398 - Saving the file doesn't have any effect on the origin item.
399
400 This happens if **the command to launch the editor exits, but the editor
401 application itself is still running**. Since the command exited, CopyQ assumes
402 that the editor itself is no longer running, and stops monitoring the changes
403 in the temporary file (and removes the file).
404
405 Here is the correct command to use for some editors::
406
407 emacsclientw.exe --alternate-editor="" %1
408 gvim --nofork %1
409 sublime_text --wait %1
410 code --wait %1
411 open -t -W -n %1
412
413 .. _faq-config-path:
414
415 Where to find saved items and configuration?
416 --------------------------------------------
417
418 You can find configuration and saved items in:
419
420 a. Windows folder ``%APPDATA%\copyq`` for installed version of CopyQ.
421 b. Windows sub-folder ``config`` in unzipped portable version of CopyQ.
422 c. Linux directory ``~/.config/copyq``.
423 d. In a directory specific to a given CopyQ instance - see :ref:`sessions`.
424
425 Run ``copyq info config`` to get absolute path to the configuration file
426 (parent directory contains saved items).
427
428 Why are items and configuration not saved?
429 ------------------------------------------
430
431 Check access rights to configuration directory and files.
432
433 Why do global shortcuts not work?
434 ---------------------------------
435
436 Global/system shortcuts (or specific key combinations) don't work in some
437 desktop environments (e.g. Wayland on Linux).
438
439 As a workaround, you can try to assign the shortcuts in your system settings.
440
441 To get the command to launch for a shortcut:
442
443 1. Open Command dialog (F6 from main window).
444 2. Click on the command with the global shortcut in the left panel.
445 3. Enable "Show Advanced" checkbox.
446 4. Copy the content of "Command" text field.
447
448 .. note::
449
450 If the command looks like this:
451
452 ::
453
454 copyq: toggle()
455
456 the actual command to use is:
457
458 ::
459
460 copyq -e "toggle()"
461
462 .. _faq-force-hide-main-window:
463
464 Why doesn't the main window close on tiling window managers?
465 ------------------------------------------------------------
466
467 The main window remains open if it cannot minimize to task bar and tray icon is
468 not available. This is a safety feature to allow users to see that the
469 application is running and make any initial setup when the app is started for
470 the first time.
471
472 To force hiding main window:
473
474 1. Open "Preferences" (``Ctrl+P`` shortcut).
475 2. Go to "Layout" tab.
476 3. Enable "Hide main window" option.
477
478 Alternatively, run the following command::
479
480 copyq config hide_main_window true
481
482 Why does encryption ask for password so often?
483 ----------------------------------------------
484
485 With built-in encryption (the recommended approach), CopyQ asks for the
486 password at startup and when changing the encryption password. If **Require
487 password after an interval** is enabled (in the "History" configuration tab),
488 the password is also requested periodically. The startup prompt can be avoided
489 by enabling the **Use external key store** option, which stores the password in
490 the platform key store (Windows Credential Store, macOS Keychain, GNOME Keyring,
491 or KWallet) — but the periodic prompt, if enabled, still applies.
492
493 If you are using the legacy **Encryption plugin** (which relies on ``gpg2``),
494 the password usually needs to be re-entered once every few minutes. To reduce
495 prompts, either increase the tab unloading interval ("Unload tab after an
496 interval" option in "History" tab in Preferences) or change ``gpg``
497 configuration (see `#946
498 <https://github.com/hluk/CopyQ/issues/946#issuecomment-389538964>`__).
499
500 How to fix "copyq: command not found" errors?
501 ---------------------------------------------
502
503 If you're getting ``copyq: command not found`` or similar error, it means that
504 the ``copyq`` executable cannot be found by the shell or a language interpreter.
505
506 This usually happens if the executable's directory is not in the ``PATH``
507 environmental variable.
508
509 If this happens when running from within the command, e.g.
510
511 .. code-block:: bash
512
513 bash:
514 text="SOME TEXT"
515 copyq copy "$text"
516
517 you can **fix it by using** ``COPYQ`` environment variable instead.
518
519 .. code-block:: bash
520
521 bash:
522 text="SOME TEXT"
523 "$COPYQ" copy "$text"
524
525 .. _faq-memory-usage:
526
527 How can I reduce CopyQ memory usage?
528 ------------------------------------
529
530 When a tab is loaded, its item data are kept in memory. This includes smaller
531 items (stored in the tab data file) and visible larger items (stored in
532 separate files in data directory). A tab data loads when it is first accessed
533 and stays resident until explicitly unloaded, the unload interval expires,
534 configuration changes, or the application restarts.
535
536 Each item can include multiple data formats. By default new items are
537 automatically added when the clipboard changes. The stored formats depend on
538 which plugins are loaded and any custom commands that modify clipboard
539 processing.
540
541 In version 14.0.0 and later, you can copy memory statistics to the clipboard
542 by running the following command in the Action dialog (``F5``) or a terminal::
543
544 copyq stats | copyq copy -
545
546 Key lines to look at:
547
548 - ``MODEL`` lines — in-memory data size for loaded tabs and other data models.
549 - ``DATA_DIR`` — item data directory size. Larger item data (above the
550 ``item_data_threshold`` option, default 1024 bytes) are stored as separate
551 files here and loaded into memory only when the item is displayed or read.
552 Smaller data are stored directly in tab data files and loaded with the tab.
553 - ``TABS: total=N, loaded=N`` — how many tabs are loaded vs total.
554 - ``MEMORY: rss=...`` — process resident memory.
555
556 See :js:func:`stats` API documentation for details.
557
558 Options to reduce memory usage:
559
560 - Reduce maximum items per tab — the default is 200. Lower it in
561 Preferences in the History section.
562 - Enable "Unload tab after an interval" in the History section in Preferences.
563 Tabs that have not been accessed recently will be unloaded automatically.
564 You can also unload all tabs on demand with :js:func:`unload` or
565 :js:func:`forceUnload`.
566 - Disable unused item plugins in Preferences in the Items section. Plugins for
567 images, rich text and other non-text formats keep extra data per item.
568 - Lower ``item_data_threshold`` so that more item data are stored as separate
569 files instead of inline in the tab data file. Data in separate files are
570 loaded only on demand, while inline data are loaded with the entire tab.
571 For example, to store all item data as separate files::
572
573 copyq config item_data_threshold 0
574
575 Conversely, ``-1`` disables the data directory and stores everything inline,
576 which can speed up item lookups but increases memory usage.
577
578 Changing this options has effect only when tab is saved again (items change).
579
580 See also :ref:`faq-config-path` for finding data files.
581
582 What to do when CopyQ crashes or misbehaves?
583 --------------------------------------------
584
585 When CopyQ crashes or doesn't behave as expected, try to look up
586 a similar `issue <https://github.com/hluk/CopyQ/issues>`__ first
587 and provide details in a comment for that issue.
588
589 If you cannot find any such an issue, `report a new bug
590 <https://github.com/hluk/CopyQ/issues/new>`__.
591
592 Try to provide the following details:
593
594 - CopyQ version
595 - operating system (desktop environment, window manager, etc.)
596 - steps to reproduce the issue
597 - application log (see :ref:`faq-share-commands`)
598 - stacktrace if available (e.g. on Linux ``coredumpctl dump --reverse copyq``)