Skip to main content

Python implementation of the VirtualDesktopAccessor for manipulating Windows 10 virtual desktops.

Project description

py-VirtualDesktopAccessor

Implements a subset of the functionality offered by https://github.com/Ciantic/VirtualDesktopAccessor, written in pure Python and installable via pip.

pip install pyvda

Usage

The following functions are implemented. The only deliberate difference with the behaviour of Ciantic's original DLL is that desktops here are 1-indexed, as this reflects the numbers shown in the task view.

def GetCurrentDesktopNumber() -> int:
def GetDesktopCount() -> int:
def MoveWindowToDesktopNumber(hwnd: int, number: int) -> None:
def GoToDesktopNumber(number: int) -> None:
def GetWindowDesktopNumber(hwnd: int) -> int:

def PinWindow(hwnd: int) -> None:
def UnPinWindow(hwnd: int) -> None:
def IsPinnedWindow(hwnd: int) -> bool:
def PinApp(hwnd: int) -> None:
def UnPinApp(hwnd: int) -> None:
def IsPinnedApp(hwnd: int) -> bool:

Example usage:

import pyvda
import win32gui

number_of_active_desktops = pyvda.GetDesktopCount()
current_desktop = pyvda.GetCurrentDesktopNumber()

current_window_handle = win32gui.GetForegroundWindow()
pyvda.MoveWindowToDesktopNumber(current_window_handle, 1)

pyvda.GoToDesktopNumber(3)

window_moved_to = pyvda.GetWindowDesktopNumber(current_window_handle)

Tips

Sometimes, after calling GoToDesktopNumber the focus will remain on the window in the previous desktop. This is at least partially fixed by calling:

from ctypes import windll
ASFW_ANY = -1
windll.user32.AllowSetForegroundWindow(ASFW_ANY)

before any call to GoToDesktopNumber. More details here and here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvda-0.0.7.tar.gz (6.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyvda-0.0.7-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

pyvda-0.0.7-py2-none-any.whl (7.8 kB view details)

Uploaded Python 2

File details

Details for the file pyvda-0.0.7.tar.gz.

File metadata

  • Download URL: pyvda-0.0.7.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for pyvda-0.0.7.tar.gz
Algorithm Hash digest
SHA256 bf94ddc768bfef1f5f6064f4dda5c46ec0ba3be5175d39e81ee478747486e296
MD5 6415c52648f0fd79433548278badefa1
BLAKE2b-256 bb9e1fd74cd040f970ab33d018b6a5bc4f7acf82da8cad143ec2da52ad775081

See more details on using hashes here.

File details

Details for the file pyvda-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: pyvda-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for pyvda-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ac28610d3e56597b7183c9e598b7936aa61121502e9d9560086bc756dbb655a5
MD5 12906eb18ff0dc27b8c10081d240568a
BLAKE2b-256 8952ceff7bbfc98eb625455d7ee51adfddddf4533176ab7db5d942a9217ae895

See more details on using hashes here.

File details

Details for the file pyvda-0.0.7-py2-none-any.whl.

File metadata

  • Download URL: pyvda-0.0.7-py2-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for pyvda-0.0.7-py2-none-any.whl
Algorithm Hash digest
SHA256 cd903cd17e35f3240bfe6db11df9a4a41a59cdae7bfe02875537397d3db123db
MD5 cb39f736997e69f9e02ae1611cc94201
BLAKE2b-256 cf0d083fed0d33f553fddcc0a0e40cce123207e770f43a10ba8c8b7f337d3f4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page