summaryrefslogtreecommitdiff
path: root/bin/rename_workspace
blob: 7636fd2e9bbeb216f3465aaaaaaa888859d8d048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash

workspace=$(i3-msg -t get_outputs | grep -Po '"current_workspace":"[^\"]*"' | sed 's/"current_workspace":"\([^"]\+\)"/\1/g')
number=$(echo "${workspace//[!0-9]}")

new_name=$(zenity --entry --title="Rename workspace" --entry-text "$workspace")
if [[ "$new_name" != *:* ]]; then
    new_name="$number:$new_name"
fi

echo $new_name
exec i3-msg rename workspace to "$new_name"