This is essentially just a rust rewrite of bsptab with changes that align much better with how I'd like to use it.
I found the original bsptab
quite nice, but I kept finding myself wanting to:
- merge multiple
tabbed
s together all at once - completely explode a
tabbed
- immediately embed exactly one window to a
tabbed
For these reasons, these are the exact features implemented in my version. The main draw for this version is the simple/intuitive interface:
bsptab-rs create [WID]...
takes a list of window ids, which all get combined into a singletabbed -c -d
instance. Any existing tabbed instances get flattened out, so you never end up with nestedtabbed
s. This simple behavior enables all of the following:create <WID>
-- turning any window into a tabbed instance.create <WID0> <WID1>
-- ifWID0
andWID1
are both normal windows, this creates atabbed
and adds both windows to it.create <WID> <TAB>
-- ifWID
is a normal window andTAB
is atabbed
, this will addWID
to it.create <TAB0> <TAB1>
-- ifTAB0
andTAB1
are bothtabbed
s, this will merge both into onetabbed
.
bsptab-rs detach <TAB>
takes the id of atabbed
window and detaches the currently focused window (reparenting it to the root).detach --all <TAB>
-- will instead detach all of the windows, deleting the tabbed instance under normal operation. Good for if you decide you no longer want some windows tabbed together, and would rather see them all at once.- no-op if the provided window id is not a
tabbed
.
bsptab-rs embed <WID>
first callscreate <WID>
and then creates a one-time listener for a new node being added to the bspwm tree. When a new node is created (i.e. the next opened window), it gets attached with<WID>
.embed <WID> & <command>
turnsWID
into atabbed
and embeds the window opened bycommand
with it. This is particularly useful for opening a new terminal in the sametabbed
, but can work for anything that opens a window.- Do note that the listener applies to any node opened anywhere.
bsptab-rs transfer <WID0> <WID1>
is equivalent toattach
in the older bsptab implementation, just much faster. Quoting, "Attach window to tabbed container . If is a tabbed container, detach the active window and attach it to the new container. If is not a tabbed container, call create first."- This is more like i3-style tabs.
- Due to bugs in
tabbed
, this has to completely rip apart the first tabbed and remake it.
- For convenience, any window/tabbed id can also be a bspc node_sel, which simply calls
bspc query -N -n <node_sel>
at runtime to get the correct window id. This means that you can use strings like "focused" or "west" when usingbsptab-rs
.
Install tabbed and rust.
cargo build --release
creates a binary at target/release/bsptab-rs
which you can copy to somewhere in your path.
This is a (slightly edited/simplified) excerpt from my current sxhkdrc file.
######################
# tabbed manipulation
# -------------------
# super + t base chord for all tabbed manipulation
# t (create) create new tabbed container on focused window
# r (detach) remove focused window from tabbed container
# shift + r (detach --all) remove all windows from tabbed container
# e (embed) attach next opened window to focused window
# z (embed terminal) attach a terminal to focused window
# {h,j,k,l} (create) merge focused tabbed/window with target tabbed/window
# arrows (transfer) attach focused window with target tabbed/window
super + t; t
bsptab-rs create focused
super + t; r
bsptab-rs detach focused
super + t; shift + r
bsptab-rs detach --all focused
super + t; e
bsptab-rs embed focused
super + t; {super +, } z
{ , } bsptab-rs embed focused & alacritty
super + t; {h,j,k,l}
bsptab-rs create focused {west,south,north,east}
super + t; {Left,Down,Up,Right}
bsptab-rs transfer focused {west,south,north,east}
demo1.webm
bsptab-rs create
-- Combine two windows into a singletabbed
bsptab-rs embed
-- Open a new window as a tab
demo2.webm
bsptab-rs create
-- Merge multipletabbed
s togetherbsptab-rs detach
-- Detach one window
demo3.webm
bsptab-rs transfer
-- Transfer from onetabbed
to anotherbsptab-rs detach --all
-- Detach all windows from atabbed
- Proper testing (how do I test a program like this properly?)
- Better error handling
- Support for bspc node selectors by passing to
bspc query -N -n
- Would it be cleaner/faster to
send
to the socket directly instead of calling abspc
command?
- Would it be cleaner/faster to
- Maintain tab ordering more consistently
- Parity with original bsptab (maybe not fully?)
- attach
- autoattach