How can I automate switching between virtual desktops using Python on Windows 10?
Asked
Active
Viewed 720 times
1 Answers
2
pyautogui can send keyboard presses to the current window, but system-wide commands will, obviously, work on any window. The shortcuts to switch virtual desktops are win+ctrl+right & win+ctrl+left. The Python code to use these with pyautogui is
import pyautogui as pa
pa.hotkey('win','ctrl','left') #will switch one desktop to the left
pa.hotkey('win','ctrl','right') #will switch one desktop to the right

Tuor
- 875
- 1
- 8
- 32