Skip to main content

Manages a layout of windows

Project description

windowlayout

Minimalist package to manage a layout of windows in Python. Currently, only windows is supported, and I've only used this on Windows 10.

Background

I have a lot of monitor space and got tired of rearranging my windows manually. I quickly cobbled together a tool to let me save and restore window arrangements. You are now reading about this tool.

Usage

  1. Install with pip (pip install windowlayout) on Python 3.6 or greater
  2. Open your favorite programs and arrange them to your liking on your monitor
  3. Save the current layout as a starting point: python -m windowlayout save
  4. Edit ~/.windowlayout.json to tweak it (see below)
  5. When you want this window layout again, run python -m windowlayout apply
  6. For alternate layouts, specify a name after save or apply.

Configuration

By default, layout data is stored in ~/.windowlayout.json. The -f/--layout-file argument can be used to specify another file. The layout data has two main sections: programs, and layouts.

NOTE: Usually you will have all sorts of vauge background windows you can't identify after running save. You should remove anything from your layout that you don't recognize. Also, if you don't need the title or class fields to distinguish between programs, don't use them.

Program Configuration

The "programs" json object specifies named programs that you may use in layouts. They have the following fields

  • command: The command line string to run to start the program (required)
  • detected_command: The command line string to look for to find an already running window of this program (if not specified, command is used)
  • detected_title: If specified, the window title must match this string when finding an already running instance of the window
  • detected_class: If specified, the window class must match this string when finding an already running instance of the window
  • suppress_start: If true (default is false if unspecified), do not attempt to start the program if a pre-existing window is not found

The detected_command field exists because sometimes you need run one command to start a program but the process owning the window doesn't have the same command. The detected_title is useful when a process may have multiple windows but only one is the "real" one. The suppress_start flag was added because when I start Spotify while this program is running, the Spotify UI freezes and I haven't debugged why.

Layout Configuration

The "layouts" json object contains definitions for the available layouts you can apply. The default layout when no layout is specified is named "default".

Each layout is a json object where the property names reference a named program in the "programs" object. If you want to have multiple windows with the same program, you need multiple entries in the "programs" object. Normally you need this anyway so you can specify command-line arguments for the different windows.

The property value is another json object specifying the left, top, bottom, and right coordinates of the window. These coordinates are in pixels and may be negative depending on the monitor layout. The top / left coordinates are 0, and values increase towards bottom / right.

The simplest way to define a layout is to arrange the windows roughly how you want them and save the layout. Then prune the list of programs down to what you care about and remove restrictions you don't need (like detected_title being the empty string).

If you want to create a second layout and have already crafted an initial one, consider using the -f argument to specify an alternate file. That way, all the stuff you removed the first time doesn't get added back when it is detected again.

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

windowlayout-0.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

windowlayout-0.0.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file windowlayout-0.0.1.tar.gz.

File metadata

  • Download URL: windowlayout-0.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for windowlayout-0.0.1.tar.gz
Algorithm Hash digest
SHA256 95620c5a8c7535cfedeaf2fe669a8306b727353df9cd648c04256c8b10b8de0e
MD5 c1d3507a50b823d40b92e5d1279626eb
BLAKE2b-256 d6b9a60c8373c878f8f7c1f4a03d3c3ca324d36120435edc66a162e14c1588a2

See more details on using hashes here.

File details

Details for the file windowlayout-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: windowlayout-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for windowlayout-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51160877ecf37e9c9f0efb2412ea6201a712965d5f20d0329a52c93b30a5e6c9
MD5 61fd382c7dc12d0ea5e66f4799a1d864
BLAKE2b-256 584b0d78a68debef49f569effb64783a1611e1c4ecf5898be286487ba0b0c06c

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