This script enables dynamic workspace name changing in the i3 window manager. The script is based on this script by Jeroen Janssens .
Press you desired key combination ($mod+n) and enter the new workspace name. If you run it on workspace 1 and enter "irc" at the prompt the workspace will be named 1:irc
. Using the numbered workspace configuration in i3 it will be accessible using your normal key binding (such as $mod+1) even though it has been renamed.
Save this bash script as i3-rename-workspace
somewhere within your system path. Don't forget to make it executable.
#!/bin/bash
WS=$(i3-msg -t 'get_workspaces' | sed -e 's/{"num/\n{"num/g' | grep \"focused\":true | sed -e 's/,"/\n/g' | grep name | cut -d\" -f 3)
WS_TEXT=$(echo $WS | cut -d \: -f 2)
WS_NR=$(echo $WS | cut -d \: -f 1)
NEW=$(zenity --text="Enter new name:" --entry --title="Rename workspace $WS" --entry-text="$WS_TEXT")
i3-msg "rename workspace \"$WS\" to \"$WS_NR:$NEW\""
Make the following changes to ~/.i3/config
Add the key binding
bindsym $mod+n exec i3-rename-workspace
Make sure your workspace switching key bindings are using the numbered
directive
bindsym $mod+1 workspace number 1
bindsym $mod+1 workspace number 2
...
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+1 move container to workspace number 2
...
Doesn't seem to work? Also tried the other script that this one is based on, same output.
Step1 execute command:
Step2 change name and click OK:
Step3 receive error message: