i3/.config/i3/rename_workspace.sh
2015-09-06 10:21:17 -04:00

14 lines
391 B
Bash
Executable File

#!/bin/bash
num=`i3-msg -t get_workspaces | jq 'map(select(.focused == true))[0].num'`
i3-input -F "rename workspace to \"$num:%s\"" -P 'New name: '
name=`i3-msg -t get_workspaces | jq 'map(select(.focused == true))[0].name'`
# If empty name was set
echo "$name"
if [[ "$name" =~ ^\"[0-9]+:\ *\"$ ]]
then
# Remove trailing comma and whitespace
i3-msg "rename workspace to \"$num\""
fi