I want to rename a workspace but retain the workspace number by default, in i3 user guide, I find the following script to do so.
bindsym $mod+r exec i3-input -F 'rename workspace to "%s"' -P 'New name: '
But the problem is that it doesn't keep workspace number by default, so I have to remember to type the workspace number.
I've found a way to get the number of the focused workspace number with following command, but I don't know how to concat the number to with the input name together in i3 config.
i3-msg -t get_workspaces | jq '.[] | select(.focused == true) | .num'
So, I'm wondering whether in i3 config file, I can execute some kind of function to concat the workspace number with user input to achieve my purpose?
I don't think you can. But, you can always do whatever you want if you create a script and call it with
exec
in your i3-config. So, for example:~/bin/i3-rename-workspace (or wherever is convenient for you):
Somewhere in your i3-config:
Remember to provide the full path to your script, or put it somewhere in i3's
$PATH
.