albertored11 / bsptab

Suckless' tabbed integration into bspwm
MIT License
82 stars 3 forks source link
bspwm tabbed tabs xorg

bsptab

AUR license AUR version

bsptab is a collection of bash scripts for integrating tabbed, a tool from suckless to create tabbed containers in X environments, into bspwm, a tiling window manager based on binary space partitioning.

bspwm is an awesome WM, but it only does its job, which does it well: managing windows. However, bspwm is also extremely scriptable! With these scripts, you can easily organize windows into tabs, which is a really useful feature for many workflows.

This project is based on Bachhofer/tabc.

Please open an issue/pull request if you find any kind of bug, if you'd like to see any new features, or especially if you think any part of the code should be rewritten in a better way, since I am not a bash expert at all.

Features

Dependencies

Tabbed recommendations

Required

Installation

Just clone the repo and run make install inside the repo directory.

If you are using a pacman-based distro (Arch, Manjaro...), you can use the AUR package (if you like it, please leave a vote 😁).

Usage

tabc

This script is used to manage tabbed containers (creating, attaching/detaching windows and toggling autoattach feature), as well as to launch helper daemons.

Run tabc <command>.

Available commands:

tabbed-sub, tabbed-unsub

These two scripts are used to enable autoattach feature for tabbed containers. This means that, when a new window is added from the container (in bspwm terms, when a new window is the brother of the container), it is automatically attached to it.

You can use them running tabbed-sub <wid> &; tabbed-unsub <wid> &, but you won't probably need it since they are called from related tabc commands.

Keybindings

It is really useful to run tabc script through user-defined keybindings, so you can create tabbed containers, attach/detach windows to them and toggle autoattach feature just using your keyboard.

Example keybindings for sxhkd

Add the following lines to your sxhkdrc:

# add to tabbed container
ctrl + alt + {Left,Down,Up,Right}
    tabc attach $(bspc query -N -n) {$(bspc query -N -n west),$(bspc query -N -n south),$(bspc query -N -n north),$(bspc query -N -n east)}

# create/remove from tabbed container
super + z 
    id=$(bspc query -N -n); \
    [[ "$(tabc printclass $id)" == "tabbed" ]] \
    && tabc detach $id \
    || tabc create $id 

# toggle autoattach in tabbed container
super + shift + z 
    tabc autoattach $(bspc query -N -n) 

Demos

tabc create command

Open a Chromium window, create a tabbed container using a keyboard shortcut and open new windows as tabs.

tabc attach command

Attach window (right) to a tabbed container (left) using a keyboard shortcut.

tabc detach command

Detach a couple of windows from a tabbed container and then combine them to create a new container (again, using keyboard shortcuts).

tabc autoattach command

Toggle autoattach function using a keyboard shortcut: first, it is enabled, so new windows appear as tabs; then, it is disabled, so new windows are placed as usual

tabc autod command

Open an instance of pcmanfm-qt, and a tabbed container is automatically created, so every new window opened is added as a tab.

TODO