Okay, so I have created a solution.
First download workspace.rb(taken from the blog, Userbound). You will need ruby to run this script.
workspace.rb
#!/usr/bin/ruby
require 'json'
JSON.parse(%x[i3-msg -t get_workspaces]).each do |workspace|
if (workspace['focused']) then
number = workspace['name'].split(/:/)[0]
newName = "#{number}: #{ARGV[0].chomp}"
%x[i3-msg 'rename workspace "#{workspace['name']}" to "#{newName}"']
%x[i3-msg 'bindsym Mod4+#{number} workspace "#{newName}"']
end
end
All it does is read from i3 and send messages to i3, so it can rename a workspace.
Then, download my script.
rename.sh
#!/bin/bash
# Rename current workspace
# deafult name and imput
name=$(echo -e "workspace" | dmenu)
ruby $HOME/scripts/wm-scripts/i3scripts/workspace.rb "$name"
It gets input gained from dmenu(with a default of 'workspace'), and then supplies that input into the ruby script.
Make sure you change the line ... $HOME/scripts/wm-scripts/i3scripts/workspace.rb ... to point to wherever you have saved workspace.rb
Now, go into your .i3 config and bind the script to a key in i3, and then reload your config(there is a shortcut for this reload by in the default config).
.i3/config
#rename workspace
bindsym Mod4+Shift+v exec /home/azrathud/scripts/wm-scripts/i3scripts/rename.sh
There you have dynamic workspace naming.
Note: see joepd's post about possible i3 workspace binding issues.
This behavior was weird. Apparently when I named my workspaces number 1
, etc. I could rename them using i3-msg bindkey ...
, but then other functions of i3 stopped working. Sorry for the confusion. Apparently shortcuts cannot be rebinded at runtime.