ws-rename.sh 449 B

12345678910111213
  1. #!/bin/bash -ex
  2. # Rename a workspace, keeping its current number, so $mod+$num still works.
  3. # If nothing is given, remove the name.
  4. current_ws_num=$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true).num'| cut -d"\"" -f2)
  5. new_name=$(i3-input -P 'New name: ' | grep 'command = ' | cut -d" " -f3)
  6. if [ -z "$new_name" ]; then
  7. i3-msg "rename workspace to $current_ws_num"
  8. else
  9. i3-msg "rename workspace to \"$current_ws_num $new_name\""
  10. fi