summaryrefslogtreecommitdiffstats
path: root/scripts/rofi-workspaces
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2019-05-14 22:13:09 +0200
committerJokler <jokler.contact@gmail.com>2019-05-14 22:13:09 +0200
commit64b3f5883e5523e5193ba1583790cc8cfafcfe6e (patch)
tree8c604f28ede436cb2f43bd0a1c3c70d4e12461e6 /scripts/rofi-workspaces
downloaddotfiles-64b3f5883e5523e5193ba1583790cc8cfafcfe6e.tar.gz
dotfiles-64b3f5883e5523e5193ba1583790cc8cfafcfe6e.zip
Add scripts, polybar and i3 config files
Diffstat (limited to 'scripts/rofi-workspaces')
-rwxr-xr-xscripts/rofi-workspaces30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/rofi-workspaces b/scripts/rofi-workspaces
new file mode 100755
index 0000000..a93190f
--- /dev/null
+++ b/scripts/rofi-workspaces
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+moveto=0
+if [[ "$1" == "--move" ]]; then
+ moveto=1
+ shift
+fi
+
+function get_workspaces () {
+ workspace_json="$(i3-msg -t get_workspaces)"
+ IFS=','
+ read -ra split <<< "$workspace_json"
+
+ for entry in "${split[@]}"; do
+ if [[ "$entry" == *"name"* ]]; then
+ IFS='"'
+ read -ra split <<< "$entry"
+ echo "${split[3]}"
+ fi
+ done
+}
+
+selection=$(echo "$(get_workspaces)" | rofi -dmenu "$@")
+if [[ $moveto -eq 0 ]]; then
+ i3-msg workspace "$selection"
+else
+ i3-msg move container to workspace "$selection"
+fi
+
+# vim: expandtab sw=2 ts=2