Skip to main content

raiseorlaunch

PyPI Python versions Build Status Coverage Code style: black License

A run-or-raise-application-launcher for i3 window manager.

Features

  • If a provided application is running, focus it's window, otherwise run it
  • Provide a regex for window class, instance and/or title to compare with running windows
  • Optionally enable case-insensitive comparison
  • Optionally provide a workspace to use for raising and running
  • Optionally provide an initial workspace to run the application
  • Optionally use the scratchpad for raising and running
  • Optionally provide a con_mark for raising and running
  • workspace_auto_back_and_forth (if enabled) remains functional
  • Optionally cycle through matching windows (this will break workspace_auto_back_and_forth if more than one window matches the given properties)
  • Optionally leave fullscreen on target workspace

Installation

Repositories

raiseorlaunch is in PyPI, so you can just

pip install raiseorlaunch

For Arch Linux users it's also available in the AUR.

Manual

Dependencies

Install

Installing it directly with the setup.py creates a script-entry-point that adds ~150ms delay. That's not acceptable for this kind of application.

This can be prevented, if creating a wheel first and installing that (needs wheel and pip):

python setup.py bdist_wheel
pip install ./dist/raiseorlaunch-${VERSION}-py3-none-any.whl

Run without installation

You can also just run raiseorlaunch without installing it:

python -m raiseorlaunch ${ARGUMENTS}

or:

./raiseorlaunch/__main__.py ${ARGUMENTS}

Usage and options

usage: raiseorlaunch [-h] [-c WM_CLASS] [-s WM_INSTANCE] [-t WM_TITLE]
                     [-e COMMAND] [-w WORKSPACE | -W TARGET_WORKSPACE | -r]
                     [-m CON_MARK] [-l EVENT_TIME_LIMIT] [-i] [-C] [-f] [-d]
                     [-v]

A run-or-raise-application-launcher for i3 window manager.

optional arguments:
  -h, --help            show this help message and exit
  -c WM_CLASS, --class WM_CLASS
                        the window class regex
  -s WM_INSTANCE, --instance WM_INSTANCE
                        the window instance regex
  -t WM_TITLE, --title WM_TITLE
                        the window title regex
  -e COMMAND, --exec COMMAND
                        command to run with exec. If omitted, -c, -s or -t
                        will be used (lower-case). Careful: The command will
                        not be checked prior to execution!
  -w WORKSPACE, --workspace WORKSPACE
                        workspace to use
  -W TARGET_WORKSPACE, --target-workspace TARGET_WORKSPACE, --init-workspace TARGET_WORKSPACE
                        target workspace
  -r, --scratch         use scratchpad
  -m CON_MARK, --mark CON_MARK
                        con_mark to use when raising and set when launching
  -l EVENT_TIME_LIMIT, --event-time-limit EVENT_TIME_LIMIT
                        Time limit in seconds to listen to window events after
                        exec. This is needed for setting a con_mark, or moving
                        the window to a specific workspace or the scratchpad.
                        Defaults to 2
  -i, --ignore-case     ignore case when comparing
  -C, --cycle           cycle through matching windows (this will break
                        workspace_back_and_forth if more than one window
                        matches the given properties)
  -f, --leave-fullscreen
                        Leave fullscreen on target workspace
  -d, --debug           display debug messages
  -v, --version         show program's version number and exit

Examples

CLI

Run or raise Firefox:

raiseorlaunch -c Firefox -s Navigator

Use the workspace SL for sublime text:

raiseorlaunch -w SL -c "^Sublime" -s sublime_text -e subl

Raise or launch SpeedCrunch and use the scratchpad:

raiseorlaunch -r -c SpeedCrunch

Use a script to start application:

raiseorlaunch -r -c SpeedCrunch -e "--no-startup-id /path/to/my-cool-script.sh"

Raise the window with the con_mark wiki. If not found, execute command and mark the new window matching the provided properties. Set the time limit to wait for a new window to 3 seconds:

raiseorlaunch -c Firefox -s Navigator -e "firefox --new-window https://wiki.archlinux.org/" -m wiki -l 3

i3 bindsym

In i3 config you can define a bindsym like that:

bindsym ${KEYS} exec --no-startup-id raiseorlaunch ${ARGUMENTS}

e.g.

bindsym $mod+s exec --no-startup-id raiseorlaunch -w SL -c "^Sublime" -s sublime_text -e subl

for binding $mod+s to raise or launch sublime text.

Quotation marks

The command will not be quoted when calling exec. Make sure you properly escape any needed quotation marks. For simple commands there is no need to do anything.

Known problems

Keybindings steal focus when fired. This can have a negative impact with applications that listen to FocusOut events and hide. This is due to how X works.

Example:

When using Guake Terminal with "Hide on lose focus" enabled, raiseorlaunch behaves as if the underlying window is focused.

Metadata

Release files for raiseorlaunch 2.3.5

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

Source distribution (sdist)

Source distribution for raiseorlaunch 2.3.5
File Size Uploaded Provenance
raiseorlaunch-2.3.5.tar.gz 18.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 29.9 kB

Release files / raiseorlaunch-2.3.5.tar.gz

Download URL raiseorlaunch-2.3.5.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2ff86ed266020311e4a7999ef7a6ba1e5118e90b2e243112a533619735511d6b
BLAKE2b-256 checksum
How to use checksums
a05c816e3db9b44863f7e86204b13567edb768bcdc696bcc80165e24d097cc33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / raiseorlaunch-2.3.5-py3-none-any.whl

Download URL raiseorlaunch-2.3.5-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48e223b16af6b3a9bcaad8779e5494ecd493de86f8b8a6d47cfb49bb6b1e6017
BLAKE2b-256 checksum
How to use checksums
034d064cac47b7298a313b4a467b4e80f7bf77a26bbb68bfaa2a6a1fa5fabcc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Security for raiseorlaunch 2.3.5

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.

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