pmb6tz / windows-desktop-switcher

An AutoHotKey script for Windows that lets a user change virtual desktops by pressing CapsLock + <num>.
MIT License
1.23k stars 230 forks source link

Fixed a bug where the simulated "ctrl+win+LEFT/RIGHT" gets picked up … #10

Closed kannymayo closed 5 years ago

kannymayo commented 8 years ago

…by certain active programs listening on "win+LEFT/RIGHT", causing them to snap left/right. 2 programs found with such behavior are EmuCon and Clover, both of which run in tabbed mode.

However, other tabbed programs like Chrome doesn't suffer from this bug; so probably it's just these 2 programs couldn't handle the simulated keystrokes well.

Perlence commented 8 years ago

Do you have any troubles with createVirtualDesktop and deleteVirtualDesktop? They use Ctrl-Win combination too.

kannymayo commented 8 years ago

No, I don't have any. The problem with switchDesktopByNumber() is that the 3-key combination (ctrl+win+LEFT) to trigger it has a special 2-key "sub-combination" (win+LEFT), and this sub-combination is the system-wide default snapping shortcut. When some not-so-well written programs like Emucon and Clover are focused, this sub-combination would get picked up by them and snap the window.

But if you look at createVirtualDesktop() and deleteVirtualDesktop(), such sub-combination does not exist; so they don't cause any trouble for me.

pmb6tz commented 5 years ago

I couldn't actually reproduce this change with clover (I don't use conemu though) but it does seem to decrease the speed a bit because of the keypress delay. For now I don't think I can accept this PR.. Maybe you were using different hotkeys than capslock+num?

Elijas commented 5 years ago

I've encountered this bug of snapping windows too and the fix didn't help. However, the bug has already been fixed with the merged https://github.com/pmb6tz/windows-desktop-switcher/pull/20

Can we close this PR?

pmb6tz commented 5 years ago

@Elijas , #20 fixes this as a side effect of using the dll?

Elijas commented 5 years ago

@pmb6tz An active window is snapped to a side of the screen with a Win + Left/Right (script somehow triggers it even though it sends Ctrl + Win + Left/Right). With #20 no windows are ever active during the switching, therefore they don't snap anymore.

Regarding the dll, I think no, there should be no side effects of having it. The dll is only used to retrieve the active window.

pmb6tz commented 5 years ago

I've tested and this issue appears to be fixed now as of #20 . Thanks!