27 lines
637 B
Bash
Executable file
27 lines
637 B
Bash
Executable file
#!/bin/bash
|
|
|
|
cur_ws="$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true)')"
|
|
cur_ws_number="$(echo "$cur_ws" | jq '.num')"
|
|
|
|
cur_ws_name="$(echo "$cur_ws" | jq --raw-output '.name')"
|
|
# Strip workspace number from name
|
|
if [[ $cur_ws_name == [0-9] ]]; then
|
|
cur_ws_name=""
|
|
else
|
|
cur_ws_name="${cur_ws_name#[0-9]:}"
|
|
cur_ws_name="${cur_ws_name# }"
|
|
fi
|
|
|
|
newname="$(
|
|
rofi -dmenu \
|
|
-p "rename workspace $cur_ws_number:" ||
|
|
echo "$cur_ws_name"
|
|
)"
|
|
|
|
echo "renaming to \`$newname\`"
|
|
|
|
if [[ -z $newname ]]; then
|
|
i3-msg "rename workspace to \"$cur_ws_number\""
|
|
else
|
|
i3-msg "rename workspace to \"$cur_ws_number: ${newname//"/\\"}\""
|
|
fi
|