This is a script named rncd (Rename Current Desktop) in my ~/.local/bin which is bound to a hotkey in my keyboard. Works fine for me.
#!/usr/bin/bash
# 1. Get current workspace index
idx=$(xdotool get_desktop)
# 2. Extract current names and pick the one at our index
current_name=$(xprop -root _NET_DESKTOP_NAMES | perl -ne 'print "$1\n" while /"(.*?)"/g' | sed -n "$((idx + 1))p")
# 3. Prompt user via Rofi
# Using -mesg to show current name and -filter for initial text
new_name=$(rofi -dmenu -p "Rename Workspace $idx:" -mesg "Current: $current_name" -filter "$current_name" -lines 0 -theme-str 'window {width: 500px;}')
# Alternative if the above doesn't work:
# new_name=$(echo "$current_name" | rofi -dmenu -p "Rename Workspace $idx:" -lines 0 -theme-str 'window {width: 500px;}')
# 4. If user didn't hit Escape or cancel, feed it to your C tool
if [[ -n "$new_name" ]]; then
rncw "$new_name"
fiA lightweight, high-performance C utility designed to rename the currently active workspace in X11 environments (Openbox, LXQt, Fluxbox, etc.).
Most CLI tools like xprop handle workspace names as standard strings. When dealing with a large number of workspaces (e.g., 40), these tools often fail to correctly insert the Null bytes (\0) required by the EWMH specification to separate names. This results in the "Panel Stretch" bug, where the entire list of names is concatenated into the first workspace's label.
rncw fixes this by communicating directly with the X Server, performing memory-level surgery on the _NET_DESKTOP_NAMES property to ensure names remain individual and correctly indexed.
You need the X11 development libraries installed on your system.
- Arch Linux:
sudo pacman -S libx11 gcc - Debian/Ubuntu:
sudo apt install libx11-dev gcc - Fedora:
sudo dnf install libX11-devel gcc
Compile the source using gcc:
gcc -O2 -o rncw rncw.c -lX11Move the binary to your path for global access:
sudo mv rncw /usr/local/bin/To rename the workspace you are currently sitting on:
rncw "Development"To use rncw with a graphical prompt, use this Zsh wrapper. It extracts the current name, opens a pre-filled Rofi prompt, and feeds the result to rncw.
#!/usr/bin/env zsh
idx=$(xdotool get_desktop)
current_name=$(xprop -root _NET_DESKTOP_NAMES | perl -ne 'print "$1\n" while /"(.*?)"/g' | sed -n "$((idx + 1))p")
new_name=$(echo "" | rofi -dmenu -p "Rename:" -filter "$current_name" -lines 0)
if [[ -n "$new_name" ]]; then
rncw "$new_name"
fiImportant: The current C implementation uses Xlib, which is specific to X11.
Wayland does not have a global "Root Window" property system like X11. Workspace management on Wayland is handled by the specific compositor. If you migrate to Wayland, you do not need this C tool; instead, use the native IPC commands:
- Sway:
swaymsg rename workspace to "Name" - Hyprland:
hyprctl dispatch renameworkspace <id> "Name" - River:
riverctl set-repeat(depends on tags)
For X11 "Daily Drivers," rncw remains the most robust solution for maintaining clean panels and workspace organization.
rncw performs the following steps:
- Queries
_NET_NUMBER_OF_DESKTOPSto safely allocate memory. - Queries
_NET_CURRENT_DESKTOPto find your location. - Retrieves the binary blob from
_NET_DESKTOP_NAMES. - Reconstructs a new buffer, replacing only the segment belonging to the current index.
- Uses
XChangePropertywithPropModeReplaceto update the X Server.
