heyman / heynote

A dedicated scratchpad for developers
https://heynote.com
Other
3.86k stars 194 forks source link

The global hotkey does not move Heynote to the current desktop in Windows #162

Open peterjaric opened 8 months ago

peterjaric commented 8 months ago

Describe the bug Windows supports virtual desktops, but Heynote doesn't seem to. When pressing the global hotkey, instead of Heynote appearing at the current desktop, focus is instead moved to the desktop Heynote is on.

To Reproduce Steps to reproduce the behavior:

  1. Open Heynote on one desktop. Make sure it isn't minimized or hidden.
  2. Go to another desktop.
  3. Press the global hotkey.

Expected behavior Heynote opens on the current desktop.

Desktop (please complete the following information):

Additional context This is maybe hard to fix, depending on what APIs are available to Electron.

Currently I am using this AutoHotkey script as a workaround:

; Show/hide heynote
^+h::
  if (WinActive("ahk_exe heynote.exe") = "0x0")
  {
    ; Hide and show window to make sure it opens on the current
    ; desktop. Otherwise it will open on the desktop where it was
    ; minimized and focus will be moved to that desktop.
    WinHide, heynote
    WinShow, heynote
    WinActivate, heynote
  }
  else
  {
    WinMinimize, heynote
  }
return

Maybe it is possible to use the same trick I am using by hiding and showing Heynote?

heyman commented 8 months ago

I looked into this when implementing the global hotkey feature, but did not manage to make it work.

Electron lacks an API for workspaces/desktops.

I believe I experimented with the workaround suggested here, though I'm now completely certain.

Also, if we were to find a way to move the window to the active desktop, maybe we would want that configurable. I could see someone having Heynote on a second screen and that moving the window to another screen would be undesirable.

Chris-Greaves commented 7 months ago

I might have misunderstood the issue, but is the solution as easy as selecting the window to showup up on all desktops automatically? (see below) image

This ensures that the window appears on each desktop even after restarts. I do the same thing with Everything by voidtools which also has a global hotkey to bring it up.