Skip to content

A StreamDeck Plugin that allows a user to perform window actions, and navigate virtual desktops, on a windows machine

License

Notifications You must be signed in to change notification settings

aasmal97/Window-Actions

Repository files navigation

Important!!!

For Windows 10 users, updating to a version after KB5034203, will cause the plugin to crash. This issue is outlined here.

To continue using the plugin, do ONE of the following:

  1. Revert your Windows 10 version to KB5034203
  2. Update to Windows 11

Window Actions Elgato Plugin

This plugin allows a user to manipulate windows on Windows 10+, with the tap of a button or through a multi-action sequence, while using an Elgato Stream Deck

Quickstart

Download the following setup file

Pre-requisites

  • StreamDeck 4.1 +
  • Windows 10+

Description

The Elgato Stream Deck natively supports a open system action, which can be used to open any application you need. However, it lacks the ability to perform window actions of the windows that this action creates. When setting up a multi-action workflow, streaming, or recording, these actions are almost essential to have, since multiple applications need to be hidden or focused in.

This app allows users to use an Elgato Stream Deck to minimize, close, maximize, resize, focus or move windows on a Windows 10+ machine. It also supports Virtual Desktops and allows for their creation and navigation

Alternative Workaround

On a Windows 10+ machine, a workaround to perform these window actions (minimize, close, maximize, resize or move), would be to download nircmd, and create a .bat file, that when opened, runs a series of commands to perform such actions. However, this comes with the following problems:

  1. It's tedious to configure a different .bat file for every window action needed

  2. This requires learning the Windows OS CLI (Command Prompt or Powershell).

  3. It's difficult to change the workflow in the future, as it requires manually updating a new window identifier in the .bat file directly. This may be necessary if an application updates itself and it's identifiers change, or if an action was configured for a one-time use case using hwid.

  4. nircmd does not support virtual desktops (moving or navigating through them)

  5. nircmd is over decade old, and is potentially outdated and includes secruity vulnerabilities

    To amend these problems, this app/plugin was developed

How This Plugin Works

General Architecture

alt Window actions General Architecture Layout

Initiating Window Action Commands

This app uses the Win32 API to initiate most window actions. We use python's pywin32 library to wrap around this API, and expose their actions to us.

Initiating Monitor/Virtual Desktop Commands

To initiate virtual desktop and monitor actions, like moving a window to another virtual desktop or monitor, we send commands to a specific version of VirtualDesktopAccessor.dll. The multiple dll versions are stored here.

Documentation for these files can be found here

Ultimately, This allows us to interact with the Windows 10 and 11 unoffical Virtual Desktop API. We then package these dll files with the app.

Integrating Our App

We integrate our app with the Elgato Stream Deck Architecture by compiling our python app into an .exe file, using cx_Freeze. This .exe file becomes the entry point/Code path that our manifest.json points to for the plugin.

Configuring the Property Inspector

This is where most of the magic happens. Using Elgato's Property Inspector, we can create a simple and initutive HTML form, that accepts the required window Identifier, and passes it into our plugin, to execute. The quickest way to set this up, is by using pre-populated dropdowns, that can be selected. This prevents typos, and incorrect mappings, which commonly occur when writing directly to .bat files.

As an added bonus, it also means users don't need to write any code to configure their actions.

Populating Active Window Dropdown

To automatically populate a dropdown list of active/opened windows, we use pywin32's win32gui module. The result is then passed to the property inspector, for user selection.

Window Identifiers

The following are the valid identifier types that can be configured.