Skip to main content

NAME

xpywm - A simple but extensible X11 window manager written in Python.

screenshot

screenshot

SYNOPSIS

xpywm

DESCRIPTION

This manual page documents xpywm, a simple but extensible X11 window manager written in Python. xpywm is a Python version of pwm (http://lsnl.jp/~ohsaki/software/pwm/), an X11 window manager written in Perl.

Development of pwm was motivated by perlwm (http://perlwm.sourceforge.net/), which is a window manager written entirely in Perl. The idea of implementing X11 window manager in a light-weight language is great since it allows you to fully customize the behavior of the window manager with a little programming. Similarly to perlwm, pwm is built based on X11::Protocol module developed by Stephen McCamant.

xpywm is ported from pwm. xpywm uses python3-xlib module for communication with the X11 display server.

The notable features of xpywm are its simplicity, compactness, and programmable cascaded/tiled window placement algorithms.

xpywm is simple in a sense that it is entirely written in Python, and it requires only python3-xlib module from PyPI. xpywm is written with less than 1,000 lines of code. If you are familiar with X11 protocol and basics of Python programming, you can easily read and understand the source code of xpywm.

xpywm is compact since it provides minimal window decorations. xpywm has no pop-up menus, graphical icons, and window animations. xpywm is designed to consume the minimum amount of screen space for letting users and applications to use as wide screen space as possible. For instance, xpywm draws the window title inside the window, rather than outside the window, which saves dozen-pixel lines around the window.

xpywm supports two types of window placement algorithms: programmed mode and tiled mode.

In the programmed mode, you can specify rules for inferring appropriate window geometries. By default, Emacs is placed at the top-left corner of the screen with 50% window width and 100% window height. Firefox, chromium, mupdf, xdvi, LibreOffice, tgif and Mathematica are placed next to the Emacs with 50% window width and 100% window height. The terminal window is placed at the bottom-right corner with 50% window width and 70% window height. If there exist more than two terminal windows, the size of each terminal window is shrunk to 1/4 of the screen, and placed in a non-overlapping way.

In the titled mode, all windows are placed in a titled fashion so that any window will have the same window width and height, and that any window will not overlap with others, as like tile-based window managers. Moreover, xpywm tries to allocate larger area for Emacs; i.e., if there are three windows, say, Emacs and two terminals, Emacs will occupy the half of the screen, and each terminal will have the quarter of the screen.

OPTIONS

None

INSTALLATION

$ pip3 install xpywm

CUSTOMIZATION

On startup, xpywm loads per-user RC script (~/.xpywmrc) if it exists. The RC script is any valid Python script. You can change the appearance and the behavior of xpywm using the RC file.

Since Python is one of interpreters, you can easily customize the behavior of xpywm by directly modifying its variables, functions, and methods. For instance, if you want to change the appearance of window frames, override variables. If you want to change the keyboard binding, modify the dictionary KEYBOARD_HANDLER. The key of the dictionary is the name of an X11 keysym string. The value of the dictionary is self explanatory: modifier is the mask of keyboard modifiers and callback is the reference to the callback function.

An example ~/.xpywmrc file is as follows.

# specify the title font
global TITLE_FONT
TITLE_FONT = '-hiro-fixed-medium-r-normal--8-80-75-75-c-80-iso646.1991-irv'

# add key binding: Alt + Ctrl + 6 to access your server
KEYBOARD_HANDLER['6'] = {
    'modifier': X.Mod1Mask | X.ControlMask, 'command': 'ssh -f your_server urxvt &'
}

# add key binding: Alt + Ctrl + F12 to execute your shell script
KEYBOARD_HANDLER['F12'] = {
    'modifier': X.ShiftMask, 'command': '/path/to/your/script.sh'
}

BINDINGS

  • Mod1 + Button1

    Move the current active window while dragging with pressing Mod1 + Button1.

  • Mod1 + Button3

    Resize the current active window while dragging with pressing Mod1 + Button3.

  • Ctrl + Mod1 + i

    Focus the next window. Available windows are circulated in the order of top-left, bottom-left, top-right, and bottom-right.

  • Ctrl + Mod1 + m

    Raise or lower the current active window.

  • Ctrl + Mod1 + '

    Toggle the maximization of the current active window.

  • Ctrl + Mod1 + ;

    Toggle the vertical maximization of the current active window.

  • Ctrl + Mod1 + ,

    Layout all available windows in the programmed mode.

  • Ctrl + Mod1 + .

    Layout all available windows in the tiled mode.

  • Ctrl + Mod1 + z

    Destroy the current active window.

  • Ctrl + Mod1 + y

    Toggle the current active window between the first and the second virtual screens.

  • Ctrl + Mod1 + [

    Switch to the previous virtual screen.

  • Ctrl + Mod1 + ]

    Switch to the next virtual screen.

  • Ctrl + Mod1 + 1

    Run a command "(unset STY; urxvt) &" via os.system() function.

  • Ctrl + Mod1 + 2

    Run a command "pidof emacs || emacs &" via os.system() function.

  • Ctrl + Mod1 + 3

    Run a command "pidof firefox || firefox &" via os.system() function.

  • Mod1 + F1 -- Mod1 + F4

    Switch to the virtual screen 1--4, respectively.

  • Shift + F7

    Enable the external video output through HDMI or DP port.

  • Ctrl + Mod1 + Delete

    Restart xpywm.

  • Ctrl + Mod1 + =

    Terminate xpywm.

AVAILABILITY

The latest version of xpywm is available at PyPI (https://pypi.org/project/xpywm/) .

SEE ALSO

twm(1), perlwm(1), pwm(1), xpymon(1), xpylog(1)

AUTHOR

Hiroyuki Ohsaki <code[atmark]lsnl.jp>

Metadata

Release files for xpywm 1.18

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

Source distribution (sdist)

Source distribution for xpywm 1.18
File Size Uploaded Provenance
xpywm-1.18.tar.gz 27.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xpywm 1.18
File Interpreter ABI Platform
xpywm-1.18-py3-none-any.whl Python 3 none any Details

Total release size: 53.5 kB

Release files / xpywm-1.18.tar.gz

Download URL xpywm-1.18.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f374c0cb8e81c2a5d3c184ffe7e286870ca0904124062cc4ae75beabe8dacff0
BLAKE2b-256 checksum
How to use checksums
0655a7c58bcbe0688e0e39899aa80884c263beefe3f90aa3922c0e08db383afc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / xpywm-1.18-py3-none-any.whl

Download URL xpywm-1.18-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31dbfbb9fde83b5672a2aa50d78e8b19cc3be9409bc61568d9ac94fb43af40a1
BLAKE2b-256 checksum
How to use checksums
16673730448d029ccfe3bb9ce6fe4610503db065865126cd786fd2ca10e32626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for xpywm 1.18

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.

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