Skip to main content

A DBus extension for rofi

Project description

This package provides a DBus foundation for rofi.

Current version is a proof-of-concept with a simple window switcher. The API will potentially change drastically.

Features

(These are all planned; 0.0.0 doesn’t really expose an API)

  • Spawn and populate scripts/modi via py-rofi-bus

  • Save information from scripts/modi

  • Split massive scripts/modi into smaller components that pass state through py-rofi-hub

Setup

System Dependencies

Installation

$ pip install --user py-rofi-bus

Example

Overview

Because 0.0.0 is a POC, I didn’t provide entry_points, a robust CLI, unit files, or tests.

This demo was written to emulate alt+tab functionality on i3, which does not have the notion of “last used window.”

The following instructions assume you installed to the user site. If you didn’t (e.g. you’re in a virtualenv and don’t need to), this command will get your package library instead.

python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"

The DBus Server

The DBus server sets up the communication hub. It can be launched via

$ python "$(python -m site --user-site)/py-rofi-bus/dbus_server.py"

This process provides functions to track the active window, get a list of active windows, and switch to a specified window.

The Window Listener

The window listener sets up the XCB event monitoring. It can be launched via

$ python "$(python -m site --user-site)/py-rofi-bus/window_listener.py"

As before, it must remain active. It monitors the screen’s root window for changes in the active window, and reports those changes to the dbus server.

Rofi Window Replacement

With those two components in place, it’s possible to launch the provided modi.

$ rofi -modi window_example:"$(python -m site --user-site)/py-rofi-bus/rofi_window_script.py" -show window_example

This modi is almost identical to the stock window modi. However, using the dbus server, it sorts the windows by activity. When a window is activated, it’s pushed to the top of the stack.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-rofi-bus-0.0.1.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distributions

py_rofi_bus-0.0.1-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

py_rofi_bus-0.0.1-py2-none-any.whl (2.4 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page