0

In Windows 10 you can create multiple desktops and switch between them. I want to run a python3 code when I am on a certain desktop. How do I detect which desktop I'm on?

3
  • stackoverflow.com/questions/2764356/… Commented Dec 30, 2020 at 22:04
  • @ΕυάγγελοςΓρηγορόπουλος, how does that help OP with their question about the current Windows desktop? Commented Dec 30, 2020 at 22:36
  • I'm not on Windows, but see this answer here and the linked VirtualDesktopAccessor.dll. Then it's probably GetCurrentDesktopNumber() what you need to call from that library. Commented Dec 31, 2020 at 3:15

1 Answer 1

1

Download the VirtualDesktopAccessor.dll from here and put it in your working directory.

Run the following code:

import ctypes

vda = ctypes.WinDLL("VirtualDesktopAccessor.dll")
num = vda.GetCurrentDesktopNumber()
print(num)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.