You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Closing and re-opening CopyQ with "Disable Tray" enabled. #2965
I saw a thread with a similar issue and it was stated that this was intended behavior. I have a workaround, so I'm not too concerned about it.
Description:
I'm used to Clipboard Fusion. I would start it and then have to right-click the systray and select "Show Clipboard Manager". CopyQ works similarly.
I saw the menu option under Tray to "Disable Tray" and when I did that, the main window opens automatically.
The issue is that when I close the main window with the red X, CopyQ keeps running in the background, but there is no tray icon to re-open the main window. If I click the program icon again, nothing happens since it is already running. If I close CopyQ from the Task Manager and then double-click the .exe, it says it didn't shut down properly and then I have to click it again to open it.
Expected Behavior:
If "Disable Tray" is selected, closing the main window should close the program - not leave it running in the background.
Version:
CopyQ 9.0.0 Portable, Windows 11.
Workaround:
I deselected "Disable Tray" and made a shortcut that launches the program, waits 250 ms, and then opens the program with the show parameter. Works fine, except I still have to close the program from the systray in order to fully exit.
There was a similar issue on Linux, and it is solved by changing the command triggered by clicking on the icon of the installed app. The command has additional arguments: copyq --start-server show
@hluk - Thank you - it does NOT seem to be working for me in 9.1.0.56 - at least in the portable version.
It works slightly better but not ideally.
With 9.1.0.56, if I open it, check "Disable Tray Icon", exit via the tray icon, and re-open it, it works (and shows the main window). However, if I close the main window, it disappears, but it is still running in the task manager. The only thing that I see that is different is that with 9.1.0.56, once I shut it down in Task Manager, I don't get the "Copy Q did not shut down properly" error when I re-start it.
Also - we are approaching the solution a bit differently:
Your idea (I think) is that when you close the main window, CopyQ keeps running in the background. If you try to open it again, it sees that it is running in the background and opens the main window. This will work well for users that want CopyQ running basically all the time, and just hate seeing the tray icon.
My idea was to have CopyQ work where if the tray icon was disabled, closing the CopyQ window would completely exit CopyQ until you clicked the shortcut or double-clicked the .exe again.
Personally - I only want to use CopyQ when I know that I will want to copy multiple items to multiple locations.
BLUF - with your solution, I would still be better using my workaround above, although I agree that some solution needs to be done that users shouldn't have to use Task Manager to close the program (if the tray icon is disabled).
However, if I close the main window, it disappears, but it is still running in the task manager.
Oh, I understand now. But that's the expected behavior, not a bug. Closing the main window does not exit the application. Normally, you need to use Ctrl+Q or File - Quit from menu bar to exit the app.
Oh, I understand now. But that's the expected behavior, not a bug. Closing the main window does not exit the application. Normally, you need to use Ctrl+Q or File - Quit from menu bar to exit the app.
Not going to argue the point any more, but IMHO, if you disable the tray icon and you have no way to exit the app other than task manager once you close the main window, it's a bug (or at least it is unintuitive - i.e. it's not a feature.)
You can use the following command ...
Simply amazing! THANK YOU!!! (But I have two minor issues):
If I close the window (and exit that app) and then re-open it, it shows a new pasted item of "Terminating Server". If I close it again and re-open it, it shows another pasted item of "Terminating Server". Is there a way to avoid this? (At least is there a way to ignore duplicates so that I only see it once?)
This one is really weird. If I disable the tray icon and open CopyQ, it opens with a blank main window - totally blank. If I click in the window or click CopyQ on the taskbar, after a few seconds it fills in the window and adds the menu bar back into the window. (I would prefer to NOT have the tray icon, but it doesn't really bother me, and I'd rather have it than have to deal with the pause for it start working.
From what I'm reading, CopyQ is not supposed to create duplicates. It seems to be creating them for me. Not sure why.
There are several threads with example scripts for how to enable duplicates. It seems to me that enough people want or don't want this, that it would be helpful to have this as a default item.
Also - I thought my menu had the option to enable or disable clipboard storing, but it does not any more ...
How can I get the red circled commands to show up in the blue circled sidebar (and how can I remove sidebar items like Action that aren't listed under commands?
Not going to argue the point any more, but IMHO, if you disable the tray icon and you have no way to exit the app other than task manager once you close the main window, it's a bug (or at least it is unintuitive - i.e. it's not a feature.)
If you disable tray, the main window will be minimized when closed, so you still have access to it and can exit the app with Ctrl+Q. You can also enable hiding the main window completely, but that was request for people who want to run the app in background and know how to reopen the window (copyq show).
If I close the window (and exit that app) and then re-open it, it shows a new pasted item of "Terminating Server". If I close it again and re-open it, it shows another pasted item of "Terminating Server".
Oh, looks like it is related a bug: exit() should not print anything on standard output. Fixing.
This one is really weird. If I disable the tray icon and open CopyQ, it opens with a blank main window - totally blank. If I click in the window or click CopyQ on the taskbar, after a few seconds it fills in the window and adds the menu bar back into the window.
Unfortunately, that looks like some rendering issues in Qt. Possibly related to #2511.
From what I'm reading, CopyQ is not supposed to create duplicates. It seems to be creating them for me. Not sure why.
It does not create duplicate items if new item data matches completely.
How can I get the red circled commands to show up in the blue circled sidebar (and how can I remove sidebar items like Action that aren't listed under commands?
The command handling for the internal and predefined actions is not good. I need to think about how to change that.
If command Type is "In Menu" it would show up in the menu and toolbar. But for the predefined commands it does not seem to be possible to change Type. Workaround is to copy the commands, edit the copied code - remove InternalId - and copy them back and set the Type. Here are the fixed commands:
If I close the window (and exit that app) and then re-open it, it shows a new pasted item of "Terminating Server". If I close it again and re-open it, it shows another pasted item of "Terminating Server".
Oh, looks like it is related a bug: exit() should not print anything on standard output. Fixing.
@hluk - Appreciate the help, but have a lot of issues/questions:
If you disable tray, the main window will be minimized when closed, so you still have access to it and can exit the app with Ctrl+Q. You can also enable hiding the main window completely, but that was request for people who want to run the app in background and know how to reopen the window (copyq show).
I think that must have been what was happening. I don't see the option now, but I probably did select the option for hiding the main window completely as I thought that was what I wanted to do.
Not sure the best solution, but maybe it would be good to pop-up a warning when you clicked "Disable Tray Icon" if "Hide Main WIndow on Exit (???). Was also selected, and vice-versa with "Setting both these options will leave CopyQ running in the background with no way to access it unless you run "Copyq Show". Please confirm you want to proceed."
Oh, looks like it is related a bug: exit() should not print anything on standard output. Fixing.
Confirmed fixed in 9.1.0.57. Question: Can I just copy the .exe from this over to my previous folder, or do I need to re-enter all my settings in a new folder? Also, my current folder has the .exe named as CopyQPortable.exe. Can I just shorten this to CopyQ.exe and still have it run as a portable application?
Unfortunately, that looks like some rendering issues in Qt. Possibly related to #2511.
Agreed, it is a rendering issue. I don't think it is related to 2511, for one thing, even the menu bar is not hidden. For another, I've I click in the CopyQ main window, it eventually (after a few seconds) comes back normally. Would prefer not to create a new bug report, as I would have to say "If you enable the Show on startup and exit on close per 2965 and hide tray icon, Copy Q doesn't open correctly, initially", but I can if you want. Personally, I'm okay with leaving the tray icon running to avoid the issue.
It does not create duplicate items if new item data matches completely.
Odd - I definitely thought it was doing so yesterday, but today it does not seem to be. Please disregard.
The command handling for the internal and predefined actions is not good. I need to think about how to change that.
If command Type is "In Menu" it would show up in the menu and toolbar.
I'm not following you here. If you look at the screenshot, I have "In Menu" selected, but the Disable Clipboard Storing is not shown in the sidebar - but here: #2964 I was able to add the new command to the sidebar.
It isn't a big deal since there is a main menu drop-down for "Toggle Clipboard Storing", but what I really want is THAT item added to the sidebar menu and ideally "Action (F5)" removed from it.
Can you create separate issues for things unrelated to this issue?
Certainly, but I'm not sure what is remaining - please advise!
I'm not following you here. If you look at the screenshot, I have "In Menu" selected, but the Disable Clipboard Storing is not shown in the sidebar
I tried to reproduce that: After I enabled "In Menu" and clicked OK in the dialog, CopyQ somehow reverted the command and disabled "In Menu" 🤦 - so it is not possible to change the Type and show the command in toolbar. I need to fix that, so users can modify the built-in/predefined commands.
Can I just copy the .exe from this over to my previous folder, or do I need to re-enter all my settings in a new folder?
You need to copy the plugins/libraries/dlls too (otherwise the app could crash on some minor incompatibilities), and potentially other things (e.g. shared folder).
@hluk - Thank you so much. I'm going to start a new bug report for the menu items, but I have three more (ignorant) questions:
You need to copy the plugins/libraries/dlls too (otherwise the app could crash on some minor incompatibilities), and potentially other things (e.g. shared folder).
I should have re-worded that. I'm using the portable version. I have it set up correctly now, but if you release a 9.1.0.58, how would I update to it. Do I just unzip it over my current folder, or would that overwrite any of my settings or customizations?
What determines whether CopyQ is portable or not? Originally, I got it from PortableApps and it installed CopyQPortable.exe, which I think just launches ...\app\CopyQ\copyq.exe? For the 9.1.0.57, I just downloaded the .zip file and extracted it. Is that still portable, or does it need Portable in the .exe name, or is it always portable and the other versions just include a setup program.
How do I change the order of menu items. For example, if I want to move "New Item" toward the bottom:
I see the arrow keys, which should do what I want, but if I click them, nothing happens. If I try to select the item to move it, the item is executed and the arrows are hidden. Google says I should be able to drag and drop the items, which seems good, but doesn't seem to work either.
@hluk - Hi, I have a minor issue, but I'm not sure if it is with one of the settings or something else. With "Show on Start and Exit on Hide" if I minimize the main window, CopyQ exits. I only want it to exit if I close the main window.
So I guess what I'm looking for is "Show on Start and Exit on Close".
I reviewed the code above and the scripting API, but I couldn't figure it out. I know it is something with this line:
action('copyq: while (visible()) sleep(500); exit()');
I'm guessing minimized returns visible=False, but I couldn't see an option for "while "running" or similar.
Activity
Windows: Show the main window when activating the app icon
Windows: Show the main window when activating the app icon
hluk commentedon Feb 11, 2025
There was a similar issue on Linux, and it is solved by changing the command triggered by clicking on the icon of the installed app. The command has additional arguments:
copyq --start-server showI think I can fix this in the installer. Can you try this development version?
Marshall-Brooks commentedon Feb 11, 2025
@hluk - Thank you - it does NOT seem to be working for me in 9.1.0.56 - at least in the portable version.
It works slightly better but not ideally.
With 9.1.0.56, if I open it, check "Disable Tray Icon", exit via the tray icon, and re-open it, it works (and shows the main window). However, if I close the main window, it disappears, but it is still running in the task manager. The only thing that I see that is different is that with 9.1.0.56, once I shut it down in Task Manager, I don't get the "Copy Q did not shut down properly" error when I re-start it.
Also - we are approaching the solution a bit differently:
Your idea (I think) is that when you close the main window, CopyQ keeps running in the background. If you try to open it again, it sees that it is running in the background and opens the main window. This will work well for users that want CopyQ running basically all the time, and just hate seeing the tray icon.
My idea was to have CopyQ work where if the tray icon was disabled, closing the CopyQ window would completely exit CopyQ until you clicked the shortcut or double-clicked the .exe again.
Personally - I only want to use CopyQ when I know that I will want to copy multiple items to multiple locations.
BLUF - with your solution, I would still be better using my workaround above, although I agree that some solution needs to be done that users shouldn't have to use Task Manager to close the program (if the tray icon is disabled).
hluk commentedon Feb 11, 2025
Oh, I understand now. But that's the expected behavior, not a bug. Closing the main window does not exit the application. Normally, you need to use Ctrl+Q or File - Quit from menu bar to exit the app.
You can use the following command (here is how to add the command to CopyQ) to make the CopyQ show up when started and exit when the main window is closed:
(This will take effect only after you restart the app.)
Marshall-Brooks commentedon Feb 11, 2025
Not going to argue the point any more, but IMHO, if you disable the tray icon and you have no way to exit the app other than task manager once you close the main window, it's a bug (or at least it is unintuitive - i.e. it's not a feature.)
Simply amazing! THANK YOU!!! (But I have two minor issues):
If I close the window (and exit that app) and then re-open it, it shows a new pasted item of "Terminating Server". If I close it again and re-open it, it shows another pasted item of "Terminating Server". Is there a way to avoid this? (At least is there a way to ignore duplicates so that I only see it once?)
This one is really weird. If I disable the tray icon and open CopyQ, it opens with a blank main window - totally blank. If I click in the window or click CopyQ on the taskbar, after a few seconds it fills in the window and adds the menu bar back into the window. (I would prefer to NOT have the tray icon, but it doesn't really bother me, and I'd rather have it than have to deal with the pause for it start working.
Marshall-Brooks commentedon Feb 11, 2025
Related, but somewhat off-topic.
From what I'm reading, CopyQ is not supposed to create duplicates. It seems to be creating them for me. Not sure why.
There are several threads with example scripts for how to enable duplicates. It seems to me that enough people want or don't want this, that it would be helpful to have this as a default item.
Also - I thought my menu had the option to enable or disable clipboard storing, but it does not any more ...
How can I get the red circled commands to show up in the blue circled sidebar (and how can I remove sidebar items like Action that aren't listed under commands?
hluk commentedon Feb 12, 2025
If you disable tray, the main window will be minimized when closed, so you still have access to it and can exit the app with Ctrl+Q. You can also enable hiding the main window completely, but that was request for people who want to run the app in background and know how to reopen the window (
copyq show).Oh, looks like it is related a bug:
exit()should not print anything on standard output. Fixing.Unfortunately, that looks like some rendering issues in Qt. Possibly related to #2511.
Windows: Show the main window when activating the app icon
hluk commentedon Feb 12, 2025
It does not create duplicate items if new item data matches completely.
The command handling for the internal and predefined actions is not good. I need to think about how to change that.
If command Type is "In Menu" it would show up in the menu and toolbar. But for the predefined commands it does not seem to be possible to change Type. Workaround is to copy the commands, edit the copied code - remove
InternalId- and copy them back and set the Type. Here are the fixed commands:Can you create separate issues for things unrelated to this issue?
Thanks for reporting the problems!
hluk commentedon Feb 12, 2025
The fixed build is here: https://ci.appveyor.com/project/hluk/copyq/builds/51499684/artifacts
Marshall-Brooks commentedon Feb 12, 2025
@hluk - Appreciate the help, but have a lot of issues/questions:
I think that must have been what was happening. I don't see the option now, but I probably did select the option for hiding the main window completely as I thought that was what I wanted to do.
Not sure the best solution, but maybe it would be good to pop-up a warning when you clicked "Disable Tray Icon" if "Hide Main WIndow on Exit (???). Was also selected, and vice-versa with "Setting both these options will leave CopyQ running in the background with no way to access it unless you run "Copyq Show". Please confirm you want to proceed."
Confirmed fixed in 9.1.0.57. Question: Can I just copy the .exe from this over to my previous folder, or do I need to re-enter all my settings in a new folder? Also, my current folder has the .exe named as CopyQPortable.exe. Can I just shorten this to CopyQ.exe and still have it run as a portable application?
Agreed, it is a rendering issue. I don't think it is related to 2511, for one thing, even the menu bar is not hidden. For another, I've I click in the CopyQ main window, it eventually (after a few seconds) comes back normally. Would prefer not to create a new bug report, as I would have to say "If you enable the Show on startup and exit on close per 2965 and hide tray icon, Copy Q doesn't open correctly, initially", but I can if you want. Personally, I'm okay with leaving the tray icon running to avoid the issue.
Odd - I definitely thought it was doing so yesterday, but today it does not seem to be. Please disregard.
I'm not following you here. If you look at the screenshot, I have "In Menu" selected, but the Disable Clipboard Storing is not shown in the sidebar - but here: #2964 I was able to add the new command to the sidebar.
It isn't a big deal since there is a main menu drop-down for "Toggle Clipboard Storing", but what I really want is THAT item added to the sidebar menu and ideally "Action (F5)" removed from it.
Certainly, but I'm not sure what is remaining - please advise!
hluk commentedon Feb 12, 2025
I tried to reproduce that: After I enabled "In Menu" and clicked OK in the dialog, CopyQ somehow reverted the command and disabled "In Menu" 🤦 - so it is not possible to change the Type and show the command in toolbar. I need to fix that, so users can modify the built-in/predefined commands.
You need to copy the plugins/libraries/dlls too (otherwise the app could crash on some minor incompatibilities), and potentially other things (e.g.
sharedfolder).Marshall-Brooks commentedon Feb 12, 2025
@hluk - Thank you so much. I'm going to start a new bug report for the menu items, but I have three more (ignorant) questions:
I should have re-worded that. I'm using the portable version. I have it set up correctly now, but if you release a 9.1.0.58, how would I update to it. Do I just unzip it over my current folder, or would that overwrite any of my settings or customizations?
What determines whether CopyQ is portable or not? Originally, I got it from PortableApps and it installed CopyQPortable.exe, which I think just launches ...\app\CopyQ\copyq.exe? For the 9.1.0.57, I just downloaded the .zip file and extracted it. Is that still portable, or does it need Portable in the .exe name, or is it always portable and the other versions just include a setup program.
How do I change the order of menu items. For example, if I want to move "New Item" toward the bottom:
I see the arrow keys, which should do what I want, but if I click them, nothing happens. If I try to select the item to move it, the item is executed and the arrows are hidden. Google says I should be able to drag and drop the items, which seems good, but doesn't seem to work either.
Marshall-Brooks commentedon Feb 13, 2025
@hluk - Hi, I have a minor issue, but I'm not sure if it is with one of the settings or something else. With "Show on Start and Exit on Hide" if I minimize the main window, CopyQ exits. I only want it to exit if I close the main window.
So I guess what I'm looking for is "Show on Start and Exit on Close".
I reviewed the code above and the scripting API, but I couldn't figure it out. I know it is something with this line:
action('copyq: while (visible()) sleep(500); exit()');
I'm guessing minimized returns visible=False, but I couldn't see an option for "while "running" or similar.
Thanks in advance!!!
Marshall-Brooks commentedon Feb 13, 2025
Okay - I know just enough to be very dangerous!!!
I found -
toggle()
Shows or hides main window.
This uses the last window position and size which is updated whenever the window is moved or resized.
Returns
:
true only if main window is being shown, otherwise false.
Return type
:
bool
So I tried:
[Command] Command=" const onStart_ = onStart; global.onStart = function() { show(); sleep(2000); onStart_(); action('copyq: while (toggle()) sleep(500); exit()'); }" IsScript=true Name=Show on Start and Exit on CloseBut with that, the window and CopyQ closes after 2.5 seconds.
Changing it to
action('copyq: while (toggle()=false) sleep(500); exit()');
The window doesn't even open, CopyQ loads and exits in 2.5 seconds.
I edited the CopyQ-commands.ini file in the config folder and have it working like it was again, but ...