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

Suggestion: Move current active window to a desktop? #24

Closed Elijas closed 5 years ago

Elijas commented 5 years ago

I often have to open Win + Tab to organize my desktops, although I feel it interrupts my flow, especially when I have to open it for moving just one window.

The easy way to implement this would be to use the dll that is already present by calling this function from it: MoveCurrentWindowToDesktop(number) (source here)

@pmb6tz, would you approve such PR? I'd also suggest these hotkeys with the PR: switching to desktop 1 with Tab + 1, moving active window to desktop 1 with CapsLock + 1

EDIT: I've already implemented this in my own private fork, works flawlessly

pmb6tz commented 5 years ago

I really like the suggestion - I would find this useful myself (it's very similar to my linux hotkeys using DWM). I'd suggest using shift+caps+ to move the active window to the other desktop (I think repurposing tab may interrupt some existing workflows). Using a modifier before the sequence is reasonably simple to remember.

Does the functionality also switch to the target desktop after moving the window? I think that would be ideal default behavior.

pmb6tz commented 5 years ago

BTW - I believe this is a duplicate of #2 - please double check..

Elijas commented 5 years ago
  1. Yes, it's a duplicate. My bad.
  2. Having Shift + Caps + 1 as hotkey is not possible by default (that is why I proposed Tab + 1) https://www.autohotkey.com/docs/Hotkeys.htm#combo Modifiers: Unlike a normal hotkey, custom combinations act as though they have the wildcard (*) modifier by default. For example, 1 & 2:: will activate even if Ctrl or Alt is held down when 1 and 2 are pressed, whereas ^1:: would be activated only by Ctrl+1 and not Ctrl+Alt+1. Therefore AHK sees Shift + Caps + 1 and Caps + 1 as the same. However, the workaround is to use if GetKeyState(Shift) (docs) inside the function, not sure if this will work.
  3. switch to the target desktop after moving the window <- easy

EDIT: PR is open: https://github.com/pmb6tz/windows-desktop-switcher/pull/28