Mike Merlin
Всего сообщений: 6
Дата регистрации: 27.07.2020
|
Создано:
12.10.2020 13:20:25
|
 |
I use (Classic) Virtual Desktops and love it.
I'm currently coding up a custom activity logger app for myself in C#
I want to determine which Virtual Desktop is the currently active one (every time my activity logger decides to write a record to it's database)
Question:
Is there some kind of API that I can query to determine which Virtual Desktop is active?
I did find this config file here:
C:\Users\Mike\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper\Composed.cwp
And it could be used in a hacky way, if I created a key:value data structure that maps a unique background color for each Virtual Desktop, to the name of each project that my time-tracker wants to assign for individual Virtual Desktops.
Just wondering if there is a cleaner neater way to determine which Virtual Desktop is active.
One quicker way I can think of (in a future upgraded version of Actual Window Manager) would be if the Title Bar text of the "Virtual Desktops Switcher" floating window could be changed every time a Virtual Desktop becomes active
something like:
Virtual Desktops Switcher [1] Virtual Desktops Switcher [2] Virtual Desktops Switcher [3] etc...
(I currently use six Virtual Desktops)
Then I can just read the window title from the window handle using C#
Thanks for letting me know if there is a more sensible way to do this, compared with reading the text data contained inside this file
C:\Users\Mike\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper\Composed.cwp
and having to make a ColorValue-to-VirtualDesktop mapper, and also make sure each desktop has a unique background color, and remember to update my logger code if I change a background color 
Cheers!
Mike
|
Bogdan Polishchuk
Администратор
Всего сообщений: 4113
Дата регистрации: 04.04.2012
|
Создано:
16.10.2020 04:09:34
|
Hello, Mike
Thank you for contacing us.
Цитата |
---|
Is there some kind of API that I can query to determine which Virtual Desktop is active? |
Unfortunately, for now there is no such API in our software or an easier way to determine which Virtual Desktop is active.
Best regards.
|
Mike Merlin
Всего сообщений: 6
Дата регистрации: 27.07.2020
|
Создано:
16.10.2020 05:29:35
|
 |
Thanks for letting me know.
I will go ahead and write myself some code to read the contents of Composed.cwp and make a method like I described above (a ColorValue-to-VirtualDesktop lookup map).
May I suggest a recommended feature for a future version of AWM:
Part 1:
Title Bar text of the "Virtual Desktops Switcher" (the floating window) is updated slightly, every time a Virtual Desktop becomes active.
something like this would work great for me:
Virtual Desktops Switcher [1] Virtual Desktops Switcher [2] Virtual Desktops Switcher [3] Virtual Desktops Switcher [4] Virtual Desktops Switcher [5]
e.g. [5] indicates the fifth virtual desktop is currently active and being used right now
Part 2:
Title Bar text of the "Virtual Desktops Switcher" (the floating window) is updated slightly, every time a new program or process becomes active,
then append the same text from AWM that already exists inside the "floating tooltip" (shown when hovering the mouse over a program icon) inside the "Virtual Desktops Switcher"
Something like this
Virtual Desktops Switcher [5] Actual Tools - Tools for Professionals - Google Chrome Virtual Desktops Switcher [5] Document 1 - Microsoft Word
e.g. [5] is showing the fifth virtual desktop is active
plus now, the text after that is the exact same text you already have in AWM, shown in the tooltip text, when hovering over a program icon
(see the picture attached as example)
so those these two examples:
Virtual Desktops Switcher [5] Actual Tools - Tools for Professionals - Google Chrome Virtual Desktops Switcher [5] Document 1 - Microsoft Word
are indicating:
- Virtual Desktop number 5 is active, and Chrome is open at page https://www.actualtools.com/ - Virtual Desktop number 5 is active, and Microsoft Word open on a new untitled document (Document 1)
This would be really excellent for helping me very easily determine the current virtual desktop, plus the currently active program window (with it's title)
Cheers! Mike
|