summaryrefslogtreecommitdiff
path: root/bin/rename_workspace
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2016-03-08 11:49:33 +0000
committerUrbain Vaes <urbain@vaes.uk>2016-03-08 11:49:33 +0000
commit164e54bafc7c6450ce71f9571d5b774cff310557 (patch)
tree96c6ab2409041351a03728ed9687b100d93bf34e /bin/rename_workspace
parentd8c21e3fb1e0380c3c61265ea647b5365574059a (diff)
Add Khoi's scripts
Diffstat (limited to 'bin/rename_workspace')
-rwxr-xr-xbin/rename_workspace12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/rename_workspace b/bin/rename_workspace
new file mode 100755
index 0000000..7636fd2
--- /dev/null
+++ b/bin/rename_workspace
@@ -0,0 +1,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"