Skip to main content

x-open-point

@readwithai - X - blog - machine-aided reading

Open an application at a particular location and with a particular size when using X11.

Motivation

I was experimenting with positioning applications at particular positions in the interests of productivity while writing a blog post. Many applications support a --geometry option, however I found that this was far from always the cause and some applications like the popular image viewer feh did not support different gravities (i.e. you could not use a - for positions).

I decided to write a wrapper which externally start an application at a particular location.

Alternatives and prior work

wmctrl can move and resize a windows with the -e option. I am not aware of any tools that launch an application and then match the window id to the process id like this tool does.

Many applications have a -geometry or --geometry to provide this functionality but this is determined on an application-by-application basis, may be missing, and the features and inconsistent.

This application was partically inspired by the kstart launcher in KDE that launches an application while setting a few properties - though not the geometry.

Installation

You can install x-open-point with pipx:

pipx install x-open-point

Usage

The size and location for a window is specified using a syntax similar to X11 geometries.

To open xterm at 100 pixels from the left and 200 pixels from the top you can use:

x-open-point +100+200 xterm

node the plus sign before 100. This indicates that this is a distance from the left.

To open a window that is 200 pixels wide and 800 pixels tall you can run:

x-open-point 200x800 xterm

To open a window at the top-right corner you can use

x-open-point -0+0 xterm

Similarly you can use -0-0 for the bottom-right and +0-0 for the bottom-left.

To place the window at 100 from the left and 200 from the top and have it 300 pixels wide and 400 pixels high you can use:

x-open-point 300x400+100+200 xterm

In general, if you and expression of the form

expression := height "x" width x_gravity X y_gravity Y
height, width, X, Y := integer | percentage
x_gravity, y_gravity := "+" | "-"

An x_gravity of + means that the horizontal is from the left side of the screen to the window, - from the right side of the screen. Similarly for y_gravity. X is the horizontal distance from a screen edge to the window. Y is the vertical distance.

Support

If you found this tool useful, you could support it by giving me money ($3 maybe) on my ko-fi.

You could also my tools json-wmctrl which lists windows with additional information, or json-xwininfo. Or read some of my writing on how to take effective notes in Obsidian.

I've personally found that Obsidian has allowed me for drive-by note taking while coding quite valuable. You could read something I wrote about this on my blog.

About me

I am @readwithai, I make tools related to reading, research and agency sometimes using Obsidian.

You can follow me on X on my blog.

@readwithai logo

Metadata

Release files for x-open-point 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for x-open-point 1.1.1
File Size Uploaded Provenance Actions
x-open-point-1.1.1.tar.gz 4.9 kB Without provenance Details for x-open-point-1.1.1.tar.gz

Release files / x-open-point-1.1.1.tar.gz

Download URL x-open-point-1.1.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
089e9d3315cac249314b3d07a143fa7439fa55ce130046854de37576c6aaf685
BLAKE2b-256 checksum
How to use checksums
edac00831ddbe03ac273e84eb17fa2ebfdd80299ccdcdf015454c81b88c10951
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Security for x-open-point 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page