A command-line utility that helps you bind keys to find and display a window, or open it if there is no instance running, in i3wm.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file i3_find_or_open-0.6.3.tar.gz
.
File metadata
- Download URL: i3_find_or_open-0.6.3.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.6.32-1-lts
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9711bf50cf90ddb9967a37425192fa1ae0d9ec983a3e4001d451376aa3beb9e |
|
MD5 | 4778fa33b57315a787d167ed478b74a9 |
|
BLAKE2b-256 | da816e05d5cc0b1981432ee2c06c0ed3e38a8ee34a23c0a956360c74e04a25ad |
File details
Details for the file i3_find_or_open-0.6.3-py3-none-any.whl
.
File metadata
- Download URL: i3_find_or_open-0.6.3-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.6.32-1-lts
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d2d24ab050162c273b8030888d96953308ff88647fe7297f8c1ac49372efe5e |
|
MD5 | 6fda3fecb9360233e8bd75a967174d05 |
|
BLAKE2b-256 | 5ecd6d7bf0728b134005dca06034366e5bc574bb0d64297460abebfbf5ab1139 |