Skip to main content

i3-find-or-open

This repo provides a command-line tool: i3-find-or-open that can find a window by regex in your i3wm instance, and display it, or execute any command if it is not open.

It is intended to help you bind keys that will reliably show you a window, whether or not it is open already, but technically it is capable of showing you any window (which is uniquely identifiable by either title or class), or running an arbitrary command if it is not open.

Installation

i3-find-or-open is available on PyPI, and the best way to install it (if you don't want to break your system python installation) is to use pipx (N.B. there is an Arch package python-pipx to install this with).

pipx install i3-find-or-open

Note that if you want to bind keys in i3 to this program, it will need to be installed for all users:

sudo PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install i3-find-or-open

(or you could bind $HOME/.local/bin/i3-find-or-open if you'd rather not install it for everybody)

If you do want to risk breaking your system python, you could just use pip.

Or, you could install it in a virtual environment yourself (note that this is all pipx is doing, but you might rather manage these environments manually).

Usage

Let's say I wanted to use this to bind $mod+o to open my Obsidian vault (called "vault"):

bindsym $mod+o exec --no-startup-id "i3-find-or-open '^.* - vault - Obsidian v([1-9]|\.)+$' 'obsidian'"

It's worth noting that the title regex you use will usually have to be quite specific when running from a command line, as the title of your terminal emulator will likely include the full command string (make use of ^, and $ tokens where possible).

Some other examples, taken from my i3 config:

bindsym $mod+t exec --no-startup-id "i3-find-or-open 'timetable\.ods — LibreOffice Calc' 'libreoffice --norestore ~/icl/timetable.ods'"
bindsym $mod+q exec --no-startup-id "i3-find-or-open 'qBittorrent' 'qbittorrent'"

You can also use the -c flag to match a window class instead of title if the title completely changes (like for the Spotify app).

bindsym $mod+s exec --no-startup-id "i3-find-or-open -c 'Spotify' 'spotify-launcher'"

You can use the -t flag to toggle scratchpad windows (i.e. to mimic the effect of the scratchpad show command, but just for your targeted window). Keeping this off (as is the default) will make sure the behaviour is such that your keybinding will always show you the targeted window, no matter what.

Title and class information about any open window can be found with the xprop command.

Metadata

Release files for i3_find_or_open 0.6.4

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

Source distribution (sdist)

Source distribution for i3_find_or_open 0.6.4
File Size Uploaded
i3_find_or_open-0.6.4.tar.gz 15.1 kB Details

Built distribution (wheel)

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

Total release size: 31.4 kB

Release files / i3_find_or_open-0.6.4.tar.gz

Download URL i3_find_or_open-0.6.4.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ae2deaf0e80f59501671cc3167ab9626837909760901087e96aa993669469637
BLAKE2b-256 checksum
How to use checksums
ced5d4b22c2757966099125cb34d11a79a4d356b95cc8a0fec456cbbf6dfaca6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.7 Linux/6.12.53-1-lts

Release files / i3_find_or_open-0.6.4-py3-none-any.whl

Download URL i3_find_or_open-0.6.4-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c8f64ee82a2416b3c7c6cd725f39458e134d1645f5802927ae5ae294c575445
BLAKE2b-256 checksum
How to use checksums
16ccce9c39ca901e7bc2304076a9dfcca60f8145f7ef4809053d40bb32425506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.7 Linux/6.12.53-1-lts

Release history Release notifications | RSS feed

This release

0.6.4 This release

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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