Skip to main content

Desktop switcher popup for BSPWM

Project description

BSPHUD

Desktop switcher popup for bspwm.

BSPHUD screenshot

BSPHUD is a window that pops up in the middle of your screen and gives an overview of the desktops on the currently focused monitor. Each desktop is represented by a black box. If the box is filled, there are windows on that desktop. The box with a ring around it is the currently focused desktop.

The idea is that you bind BSPHUD to the modifier key (not a combination; the modifier key itself) that you normally use for window management hotkeys, so that BSPHUD pops up right before you're about to switch to a different desktop, send a window to a different monitor, etc.

Installation

You can install through pip, Python's package manager:

pip install bsphud

And then launch BSPHUD like so:

python -m bsphud

Or you can simply copy src/bsphud/bsphud.py to a safe location and run it with Python:

python bsphud.py

Or you can even just run it directly:

./bsphud.py

BSPHUD has no dependencies except for Python and Tkinter. Tkinter is usually included with Python, but sometimes it's not, for example on minimal systems or if you compiled Python yourself and didn't explicitly enable Tkinter.

Configuration

BSPHUD will pop up when you send it SIGUSR1 and close when you send it SIGUSR2. Sending SIGUSR1 when the window is already open will cause BSPHUD to refresh the state of the desktop. BSPHUD writes its pid to /tmp/bsphud.pid.

Below is an example configuration with sxhkd:

# Show BSPHUD when left super is held down
Super_L
	kill -10 $(cat /tmp/bsphud.pid)

# Hide BSPHUD when left super is released
@Super_L
	kill -12 $(cat /tmp/bsphud.pid)

# If you have something like this
# (a shortcut to reload sxhkd),
# it is wise to add a delay before sending the signal,
# to prevent sxhkd from locking up
super + @Escape
	sleep 1; pkill -USR1 -x sxhkd ; notify-send sxhkd reloaded

# Any shortcuts that change 
# desktops/windows need to also send SIGUSR1
# in order to keep the BSPHUD display
# up to date with the state of the window manager

# super + <number> to switch to that desktop
# and super + shift + <number> to move window to that desktop
super + {_,shift + }{1-9,0}
	bspc {desktop -f,node -d} 'focused:^{1-9,10}' --follow; kill -10 $(cat /tmp/bsphud.pid)

# super + comma and super + period to cycle monitors
super + {_,shift} + {comma,period}
	bspc {monitor -f, node -m} {prev,next} --follow; kill -10 $(cat /tmp/bsphud.pid)

Misc notes

  • there needs to be a rule that tells bspwm to not manage the BSPHUD window. BSPHUD creates this rule automatically. Since the window is unmanaged, the border is actually drawn by BSPHUD itself, not by bspwm. BSPHUD queries your preferred border width and color using bspc config.

  • If you plan to run multiple instances of BSPHUD (e.g. multiuser system), it is wise to change the location of the PID file. For example:

python -m bsphud --pidfile /var/run/user/$(id -u)/bsphud.pid
  • bug: If you send a SIGUSR signal to BSPHUD immediately after launching it, it might crash. Working on it!

  • BSPHUD is inspired by the venerable XFCE desktop envrionment, which has a comparable feature built-in.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

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

bsphud-1.0.1.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

bsphud-1.0.1-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file bsphud-1.0.1.tar.gz.

File metadata

  • Download URL: bsphud-1.0.1.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for bsphud-1.0.1.tar.gz
Algorithm Hash digest
SHA256 809eaa1b43a5d3aebe7c27c3b7350f953eb71ca1af7b69b846b544e7006beeda
MD5 19c9e516aeef1f2451f92429333d47e4
BLAKE2b-256 9266067cb8fcba2259ccf042b4c292c1e552d8e53d97219b4dfc7728af5e3311

See more details on using hashes here.

File details

Details for the file bsphud-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: bsphud-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for bsphud-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f89d67a298dcc7a24c8b64a0d8d09dc819f930deef0a92d44d3f1ee4bf3fe22e
MD5 8d9249e68e452757bb01a2fb53af4cf2
BLAKE2b-256 b1150e8f6f9fdc4db9a01feaa026a44a45b5b5d8d025ab21fb065141e2345b01

See more details on using hashes here.

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