hluk / CopyQ

Clipboard manager with advanced features
GNU General Public License v3.0
8.22k stars 430 forks source link

CopyQ Not Remembering Window Size Across Multiple Monitors #2616

Open andrewcincotta opened 4 months ago

andrewcincotta commented 4 months ago

Running the latest version of CopyQ on the latest version of macOS.

Sometimes when switching between displays CopyQ will shrink the size of the main window. How can I get CopyQ to remember the size and position of the window when triggered through the global shortcut? I am using the default "Show/Hide Main Window" global shortcut in preferences.

As a temporary workaround, I've created a custom global shortcut that sizes my window properly on my main display: copyq: showAt(285, 285, 575, 300, '&Mac')

If someone can help me revise the above command to run a different showAt() depending on the display the cursor is on at the time of executing the command, that would be helpful. Additionally, this shortcut does not toggle the copyQ window, but instead only displays it. Is there a way I can also run hide() if copyQ is already focused?

andrewcincotta commented 4 months ago

Update: I have been working on a global shortcut and am nearly there. This is what I have:

`// set screenWidth and screenHeight to display with cursor's dimensions

const screenWidth = 2560; const screenHeight = 1440;

if (visible()) { hide(); } else { if (screenWidth === 2560 && screenHeight === 1440) { showAt(620, 350, 875, 525, '&Mac'); // 2560x1440p Monitor } else { showAt(285, 285, 575, 300, '&Mac'); // Internal Display } }`

Right now the above code will toggle showing/hiding the CopyQ window with the proper dimensions/position on my external display.

Now, I just need help with the comment starting the code. That is, I need to set the constants screenWidth and screenHeight to the dimensions of the display that the mouse cursor is on.