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
XCB Python bindings (preferably via xcffib)
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
Built Distributions
Hashes for py_rofi_bus-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba50a611d702494b0a322b5fd17ea7df5c4fe8b63d1722a581fa7012901dbfe4 |
|
MD5 | c2682f2deaa5d5b786feb6598c7f7205 |
|
BLAKE2b-256 | 11827e4a0ea0f5051fe5a2f1cc911fecec0b7f42628d4ca04ec3676a95dcbd9a |
Hashes for py_rofi_bus-0.0.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a17e1ad3f6b8a25fc1f17efc7d2b9692faf70c13efdc517053e90540e1971988 |
|
MD5 | 7e7fb494e70e6e1fae6b9e71e16bcbde |
|
BLAKE2b-256 | fde295c8b329ab9ea9f9282f57dcf033557131e0be14a114f1ee732d4a0fd519 |