Skip to main content

bspc wrapper for python

Project description

bspcpy

It's a wrapper for the bspwm command line utility bspc.

bspwm is an awesome tiling window manager with a bunch of features, but when I need to develop some script that is a bit more advanced, there are not many options other than using a bash script (which I hate). So, to address this problem, I wrote this simple API.

Usage

Since everything has the same names as the original bspc, It should be very easy to use.

For now, I have only implemented the query commands

nodes(selector: str) -> Node_set()
desktops(selector: str) -> set[Desktop]
monitors(selector: str) -> set[Monitor]

and the classes that represent nodes, desktops, and monitors.

All query methods return Python sets, so it is possible to filter the nodes using set notation.

from bspc import query

floating_nodes = query.nodes('.floating')

for node in floating_nodes:
    if 'firefox' in node.name: 
        node.layout = 'tiled'

This snippet finds all floating Firefox windows and puts them in tiled layout.

I wrote an implementation of a scratchpad using bspcpy in the examples folder.

Requirements

Installation

Via pip

python -m pip install bspcpy

Upgrade

python -m pip install --upgrade bspcpy

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

bspcpy-1.0.3.3.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bspcpy-1.0.3.3-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file bspcpy-1.0.3.3.tar.gz.

File metadata

  • Download URL: bspcpy-1.0.3.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.9.3 CPython/3.11.5

File hashes

Hashes for bspcpy-1.0.3.3.tar.gz
Algorithm Hash digest
SHA256 2468ce009dcfcf1b3089f24d7994a5cdd8f0a2af32a01523ee00cfc9009c23e4
MD5 740becef3b4161990cbcb95212f952fb
BLAKE2b-256 51c0b3645c60d99dfb504410e4ef19feaa8b31142d8955c18791c2a76128b719

See more details on using hashes here.

File details

Details for the file bspcpy-1.0.3.3-py3-none-any.whl.

File metadata

  • Download URL: bspcpy-1.0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.9.3 CPython/3.11.5

File hashes

Hashes for bspcpy-1.0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5456d9a9ea0e60edb13671ee89d25beca7712203ae1dc13ae3f995b2ba50d634
MD5 e6d5ab86d5e229a6810ad7b2d7b22cd1
BLAKE2b-256 3f2ecca2e934bd2fea3ead503d30ec916697aa6a5623bec4ef1c1a5e9800f016

See more details on using hashes here.

Supported by

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