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

Pin a window to all desktops #32

Closed pmb6tz closed 5 years ago

pmb6tz commented 5 years ago

Surfacing a comment from issue #11 which I think should be considered as a feature.

  1. I am now looking for another feature which is already implemented in Windows but I haven't yet figured out how to do it on AutoHotKey:

How do I tell Windows (or the active program) to pin its window or all its app's windows to all desktops?

In another virtual desktop manager, I found an AutoHotKey line that looks something like PostMessage, % WM_SYSCOMMAND , % desktopnumber, % windowid, , % "ahk_id " windowid (exact line is line 82 of https://github.com/jpginc/windows10DesktopManager/blob/master/dllWindowMover.ahk )

To the best of my understanding, what this is doing is telling that window that it is now on the other desktop.

I have no idea how to derive this command, and I am also wondering how also to derive a command that would tell the window (or the windows shell, if that is the case) to pin the app (or just the current window) to all Virtual Desktops.


  1. Also, I thought of and (sloppily) implemented another cool feature for a virtual desktop manager, which is to show the icons differently on different desktops. I did this by calling an external program called DesktopOK, which has the ability to save and load arrangements, and can be called from command line.

  1. I think it is somewhat silly that our programs are ahead of Window's basic functionality... I mean, I searched but I couldn't even find an official Windows API or documentation with the command for pinning the windows. So maybe if someone tells the right people at Microsoft we can get these features (or at least I can figure out how to make my own buttons; haha).

The main reason I am even writing these codes is because I want these features myself and they are not implemented yet >_<

Thank you all for sharing and I will look into this.

Originally posted by @ghost in https://github.com/pmb6tz/windows-desktop-switcher/issues/11#issuecomment-300140738

pmb6tz commented 5 years ago

I'd say 1 makes the most sense - 2 may be outside of the scope of this project (I included his entire comment but mainly meant to focus on 1). There could be other ways for identifying what desktop number the user is on.

Elijas commented 5 years ago

Implemented solutions to both:

  1. https://github.com/pmb6tz/windows-desktop-switcher/pull/33
  2. https://github.com/pmb6tz/windows-desktop-switcher/pull/34