1FAQ - Frequently Asked Questions
2================================
3
4.. _faq-show-app:
5
6How to open CopyQ window or tray menu using shortcut?
7-----------------------------------------------------
8
9Add new command to open the CopyQ window or menu with a global shortcut:
10
111. Open "Command" dialog (``F6`` shortcut).
122. Click "Add" button in the dialog.
133. Select "Show/hide main window" or "Show the tray menu" from the list
14   and click "OK" button.
154. Click the button next to "Global Shortcut" label and set the
16   shortcut.
175. Click "OK" button to save the changes.
18
19For more information about commands see :ref:`writing-commands`.
20
21.. _faq-paste-from-window:
22
23How to paste double-clicked item from CopyQ window?
24---------------------------------------------------
25
261. Open "Preferences" (``Ctrl+P`` shortcut).
272. Go to "History" tab.
283. Enable "Paste to current window" option.
29
30Next time you open the CopyQ main window and activate an item,
31it should be pasted.
32
33.. _faq-paste-text:
34
35How to paste as plain text?
36---------------------------
37
38To **paste clipboard as plain text**:
39
401. Open "Command" dialog (``F6`` shortcut).
412. Click "Add" button in the dialog.
423. Select "Paste clipboard as plain text" from the list and click "OK" button.
434. Click the button next to "Global Shortcut" label and set the shortcut.
445. Click "OK" button to save the changes.
45
46To **paste selected items as plain text** (from CopyQ window) follow the steps above
47but add "Paste as Plain Text" command instead and change "Shortcut".
48
49.. _faq-store-text:
50
51How to store only plain text?
52-----------------------------
53
54To **disallow storing HTML and rich text**:
55
561. Open "Preferences" (``Ctrl+P`` shortcut).
572. Go to "Items" tab.
583. Disable "Web" item in the list.
594. Select "Text" item.
605. Disable "Save and display HTML and rich text".
61
62Similarly, you can also disable "Images" in the list to avoid storing and
63rendering images.
64
65Existing items won't be affected but **any data formats can be removed**:
66
671. Select an item.
682. Press ``F4`` shortcut ("Item - Show Content..." in menu).
693. Select format from list.
704. Press ``Delete`` key.
71
72.. _faq-disable-clipboard-storing:
73
74How to disable storing clipboard?
75---------------------------------
76
77To temporarily disable storing the clipboard in the CopyQ item list,
78select menu item "File - Disable Clipboard Storing" (``Ctrl+Shift+X`` shortcut).
79To re-enable the functionality select "File - Enable Clipboard Storing" (same shortcut).
80
81To permanently disable storing the clipboard in CopyQ:
82
831. Open "Preferences" (``Ctrl+P`` shortcut).
842. Go to "History" tab.
853. Clear "Tab for storing clipboard" field.
86
87How to back up tabs, configuration and commands?
88------------------------------------------------
89
90From menu select "File - Export" and choose which tabs to export and whether to export
91configuration and commands.
92
93To restore the backup, select menu item "File - Import", select the exported file, and
94then 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.. _faq-disable-notifications:
101
102How to enable or disable displaying notification when clipboard changes?
103------------------------------------------------------------------------
104
105To enable displaying the notifications:
106
1071. Open "Preferences" (``Ctrl+P`` shortcut).
1082. Go to "Notifications" tab.
1093. Set non-zero value for "Interval in seconds to display notifications".
1104. Set non-zero value for "Number of lines for clipboard notification".
1115. Click "OK" button.
112
113To enable displaying the notifications, set either of the options
114mentioned above to zero.
115
116.. _faq-share-commands:
117
118How to load shared commands and share them?
119-------------------------------------------
120
121You can stumble upon code that looks like this.
122
123.. code-block:: ini
124
125    [Command]
126    Name=Show/hide main window
127    Command=copyq: toggle()
128    Icon=\xf022
129    GlobalShortcut=ctrl+shift+1
130
131This code represents a command that can used in CopyQ (specifically it
132opens main window on Ctrl+Shift+1). To use the command in CopyQ:
133
1341. Copy the code above.
1352. Open "Command" dialog (``F6`` shortcut).
1363. Click "Paste Commands" button at the bottom of the dialog.
1374. Click OK button.
138
139(Now you should be able to open main window with Ctrl+Shift+1.)
140
141To share your commands, you can select the commands from command list in
142"Command" dialog and press "Copy Selected" button (or just hit Ctrl+C).
143
144.. _faq-ignore-password-manager:
145
146How to omit storing text copied from specific windows like a password manager?
147------------------------------------------------------------------------------
148
149Add and modify automatic command to ignore text copied from the window:
150
1511. Open "Command" dialog (``F6`` shortcut).
1522. Click "Add" button in the dialog.
1533. Select "Ignore *Password* window" from the list and click "OK"
154   Button.
1554. Select "Show Advanced"
1565. Change "Window" text box to match the title (or part of it) of the
157   Window to ignore (e.g. ``KeePass``).
1586. Click "OK" button to save the changes.
159
160.. note::
161
162    This new command should be at the top of the command list because
163    automatic commands are executed in the order they appear in the list,
164    and we don't want to process sensitive data in any way.
165
166In some cases, e.g. the password manager is an extension of a web browser or a
167password is copied from a menu instead of a window, the command above won't
168work. You can try setting the "Window" text box to ``^$``, which usually matches
169popup menus.
170
171For a more reliable way, use `a command to blacklist texts
172<https://github.com/hluk/copyq-commands/tree/master/Scripts#blacklisted-texts>`__
173(it stores just a salted hash, the text itself is not stored anywhere).
174
175.. _faq-logging:
176
177How to enable logging?
178----------------------
179
180Set environment variable ``COPYQ_LOG_LEVEL`` to ``DEBUG`` for verbose logging
181and set ``COPYQ_LOG_FILE`` to a file path for the log.
182
183You can copy current log file path to clipboard from Action dialog (F5 shortcut)
184by entering command ``copyq 'copy(info("log"))'``. Alternatively, press ``F12``
185to directly access the log.
186
187If you **cannot access GUI**, you can **restart CopyQ from terminal** and **log
188to a separate file**. On Linux and macOS:
189
190.. code-block:: zsh
191
192    copyq exit
193    export COPYQ_LOG_LEVEL='DEBUG'
194    export COPYQ_LOG_FILE="$HOME\copyq.log"
195    echo "Logs will be written to $COPYQ_LOG_FILE"
196    copyq
197
198On Windows (in PowerShell):
199
200.. code-block:: powershell
201
202    & 'C:\Program Files (X86)\CopyQ\copyq.exe' exit
203    $env:COPYQ_LOG_LEVEL = 'DEBUG'
204    $env:COPYQ_LOG_FILE = [Environment]::GetFolderPath("MyDocuments") + '\copyq.log'
205    echo "Logs will be written to $env:COPYQ_LOG_FILE"
206    & 'C:\Program Files (X86)\CopyQ\copyq.exe'
207
208How to preserve the order of copied items when copying or pasting multiple items?
209---------------------------------------------------------------------------------
210
211a. Reverse order of selected items with ``Ctrl+Shift+R`` and copy them.
212b. Alternatively, select items in reverse order and then copy.
213
214See `#165 <https://github.com/hluk/CopyQ/issues/165#issuecomment-34745058>`__.
215
216How does pasting single/multiple items work internally?
217-------------------------------------------------------
218
219``Return`` key copies the whole item (with all formats) to the clipboard
220and -- if the "Paste to current window" option is enabled -- it sends
221``Shift+Insert`` to previous window. So the target application decides
222what format to paste on ``Shift+Insert``.
223
224If you select more items and press ``Return``, just the concatenated
225text of selected items is put into the clipboard. Though it could do more
226in future, like join HTML, images or other formats.
227
228See `#165 <https://github.com/hluk/CopyQ/issues/165#issuecomment-34957089>`__.
229
230Why does pasting from CopyQ not work?
231-------------------------------------
232
233Pasting from CopyQ works only on Windows, macOS and X11 on Linux.
234
235Specifically, this feature is not supported on Wayland, but you can use
236the workaround: :ref:`known-issue-wayland`
237
238First, check if you have the appropriate options enabled:
239
240a. For pasting from main window, enable "Paste to current window" in "History"
241   configuration tab.
242b. For pasting from tray menu, enable "Paste activated item to current window"
243   in "Tray" configuration tab.
244
245If the pasting still doesn't work, check if ``Shift+Insert`` shortcut pastes to
246the target window. That's the shortcut CopyQ uses by default. To change this to
247``Ctrl+V`` see `#633
248<https://github.com/hluk/CopyQ/issues/633#issuecomment-278326916>`__.
249
250If pasting still doesn't work, it could be caused by either of these problems:
251
252- CopyQ fails to focus the target window correctly.
253- The format copied to the clipboard is not supported by the target application.
254
255How to open the menu or context menu with only the keyboard?
256------------------------------------------------------------
257
258Use ``Alt+I`` to open the item menu or use the ``Menu`` key on your keyboard
259to open the context menu for selected items.
260
261.. _faq-hide-menu-bar:
262
263How to hide the menu bar in the main CopyQ window?
264--------------------------------------------------
265
266The menu bar can be hidden by modifying the style sheet of the current theme.
267
2681. Open "Preferences" (``Ctrl+P`` shortcut).
2692. Go to "Appearance" tab.
2703. Enable checkbox "Set colors for tabs, tool bar and menus".
2714. Click "Edit Theme" button.
2725. Find ``menu_bar_css`` option and add ``height: 0``:
273
274.. code-block:: ini
275
276    menu_bar_css="
277        ;height: 0
278        ;background: ${bg}
279        ;color: ${fg}"
280
281How to reuse file paths copied from a file manager?
282---------------------------------------------------
283
284By default, only the text is stored in item list when you copy or cut
285files from a file manager. Other data is usually needed to be able to
286copy/paste files from CopyQ.
287
288You have to add additional data formats (MIME) using an automatic command
289(similar to one below). The commonly used format in many file managers is
290``text/uri-list``. Other special formats include
291``x-special/gnome-copied-files`` for Nautilus and
292``application/x-kde-cutselection`` for Dolphin. These formats are used to
293specify type of action (copy or cut).
294
295.. code-block:: ini
296
297    [Command]
298    Command="
299        var originalFunction = global.clipboardFormatsToSave
300        global.clipboardFormatsToSave = function() {
301            return originalFunction().concat([
302                mimeUriList,
303                'x-special/gnome-copied-files',
304                'application/x-kde-cutselection',
305            ])
306        }"
307    Icon=\xf0c1
308    IsScript=true
309    Name=Store File Manager Metadata
310
311How to trigger a command based on primary selection only?
312---------------------------------------------------------
313
314You can check ``application/x-copyq-clipboard-mode`` format in automatic commands.
315
316E.g. if you set input format of a command it will be only executed on Linux
317mouse selection change:
318
319.. code-block:: ini
320
321    [Command]
322    Automatic=true
323    Command="
324        copyq:
325        popup(input())"
326    Input=application/x-copyq-clipboard-mode
327    Name=Executed only on X11 selection change
328
329Otherwise you can check it in command:
330
331.. code-block:: ini
332
333    [Command]
334    Automatic=true
335    Command="
336        copyq:
337        if (str(data(mimeClipboardMode)) == 'selection')
338          popup('selection changed')
339        else
340          popup('clipboard changed')"
341    Name=Show clipboard/selection change
342
343Why can I no longer paste from the application on macOS?
344--------------------------------------------------------
345
346See: :ref:`known-issue-macos-paste-after-install`
347
348Why does my external editor fail to edit items?
349-----------------------------------------------
350
351CopyQ creates a temporary file with content of the edited item and passes it as
352argument to the custom editor command. If the file changes, the item is also
353modified.
354
355Usual issues are:
356
357- External editor opens an empty file.
358- External editor warns that the file is missing.
359- Saving the file doesn't have any effect on the origin item.
360
361This happens if **the command to launch the editor exits, but the editor
362application itself is still running**. Since the command exited, CopyQ assumes
363that the editor itself is no longer running, and stops monitoring the changes
364in the temporary file (and removes the file).
365
366Here is the correct command to use for some editors::
367
368    emacsclientw.exe --alternate-editor="" %1
369    gvim --nofork %1
370    sublime_text --wait %1
371    code --wait %1
372    open -t -W -n %1
373
374.. _faq-config-path:
375
376Where to find saved items and configuration?
377--------------------------------------------
378
379You can find configuration and saved items in:
380
381a. Windows folder ``%APPDATA%\copyq`` for installed version of CopyQ.
382b. Windows sub-folder ``config`` in unzipped portable version of CopyQ.
383c. Linux directory ``~/.config/copyq``.
384d. In a directory specific to a given CopyQ instance - see :ref:`sessions`.
385
386Run ``copyq info config`` to get absolute path to the configuration file
387(parent directory contains saved items).
388
389Why are items and configuration not saved?
390------------------------------------------
391
392Check access rights to configuration directory and files.
393
394Why do global shortcuts not work?
395---------------------------------
396
397Global/system shortcuts (or specific key combinations) don't work in some
398desktop environments (e.g. Wayland on Linux).
399
400As a workaround, you can try to assign the shortcuts in your system settings.
401
402To get the command to launch for a shortcut:
403
4041. Open Command dialog (F6 from main window).
4052. Click on the command with the global shortcut in the left panel.
4063. Enable "Show Advanced" checkbox.
4074. Copy the content of "Command" text field.
408
409.. note::
410
411   If the command looks like this:
412
413   ::
414
415      copyq: toggle()
416
417   the actual command to use is:
418
419   ::
420
421      copyq -e "toggle()"
422
423Why does encryption ask for password so often?
424----------------------------------------------
425
426Encryption plugin uses ``gpg2`` to decrypt tabs and items. The password usually
427needs to be entered only once every few minutes.
428
429If the password prompt is showing up too often, either increase tab unloading
430interval ("Unload tab after an interval" option in "History" tab in
431Preferences), or change ``gpg`` configuration (see `#946
432<https://github.com/hluk/CopyQ/issues/946#issuecomment-389538964>`__).
433
434How to fix "copyq: command not found" errors?
435---------------------------------------------
436
437If you're getting ``copyq: command not found`` or similar error, it means that
438the ``copyq`` executable cannot be found by the shell or a language interpreter.
439
440This usually happens if the executable's directory is not in the ``PATH``
441environmental variable.
442
443If this happens when running from within the command, e.g.
444
445.. code-block:: bash
446
447    bash:
448    text="SOME TEXT"
449    copyq copy "$text"
450
451you can **fix it by using** ``COPYQ`` environment variable instead.
452
453.. code-block:: bash
454
455    bash:
456    text="SOME TEXT"
457    "$COPYQ" copy "$text"
458
459What to do when CopyQ crashes or misbehaves?
460--------------------------------------------
461
462When CopyQ crashes or doesn't behave as expected, try to look up
463a similar `issue <https://github.com/hluk/CopyQ/issues>`__ first
464and provide details in a comment for that issue.
465
466If you cannot find any such an issue, `report a new bug
467<https://github.com/hluk/CopyQ/issues/new>`__.
468
469Try to provide the following details:
470
471- CopyQ version
472- operating system (desktop environment, window manager, etc.)
473- steps to reproduce the issue
474- application log (see :ref:`faq-share-commands`)
475- stacktrace if available (e.g. on Linux ``coredumpctl dump --reverse copyq``)
476