ArchLabs Linux

Dynamic workspace names in Sway and i3

This simple script changes names of workspaces to the name of the window last focused in each of them. It works well in Sway, but not in i3. Confirmed to work with swaybar and i3-bar.

Note: in the default ArchLabs i3 config file workspaces have fixed names, and all bindings and window behavior use the names. For the script to work, we need to use numbers instead of names. See the example config file.

The script depends on the i3ipc-python package.

5 Likes

Nice!

1 Like

Nice work @nwg!

1 Like

Wow, thanx for sharing @nwg

1 Like

After 3 days of unsuccessful testing I’m giving up on the i3 version, at least for now. It works well on one and loops on another machine, and I can’t figure out the reason. I don’t really need it on i3, since tint2 works well there, and I can stick to my t2ec and psuinfo packages. See OP for GitHub links.

A small but pleasing the eye update: the window name is now prepended with the tiling mode indicator (horizontal / vertical).

The script should work as well on sway as on i3.

3 Likes

Looks great @nwg

1 Like

Since it’s sometimes difficult to guess if a maximized window is floating or not, I thought to add the third glyph to represent the floating state.

1 Like

The brand new and finally fixed python i3ipc module v2.0.1 v2.1.1 has been released. Better late than never. Not yet in AUR, but I do hope it’s going to change soon.

I built up-to-date Arch and Void python-i3ipc packages locally, and I rewrote the wsdnames script. You may find it here: https://github.com/nwg-piotr/swayinfo/blob/master/wsdnames-i3ipc-2.0.1.py. For me it works as well on Sway, as on i3.

Pay attention to the fact, that it will most probably crash on python-i3ipc<2.0.1 + Sway.

Thx for sharing @nwg . Might be useful to other members .

1 Like

Nice work here ! @nwg

1 Like