aboutsummaryrefslogtreecommitdiff
path: root/rofi
diff options
context:
space:
mode:
Diffstat (limited to 'rofi')
-rwxr-xr-xrofi/workspaces.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/rofi/workspaces.sh b/rofi/workspaces.sh
new file mode 100755
index 0000000..4bff293
--- /dev/null
+++ b/rofi/workspaces.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+WORKSPACES=~/.config/i3/workspaces
+
+if [ -z $1 ]; then
+ for fic in ~/.config/i3/workspaces/*.json; do
+ echo $(basename "$fic" .json)
+ done
+ exit 0
+else
+ i3-msg "workspace $1; append_layout ${WORKSPACES}/${1}.json; workspace back_and_forth" > /dev/null
+ # get the list of windows on the current workspace
+ WINDOWS=$(xdotool search --all --onlyvisible --desktop $(xprop -notype -root _NET_CURRENT_DESKTOP | cut -c 24-) "" 2>/dev/null)
+ for window in $WINDOWS; do
+ HAS_PID=$(xdotool getwindowpid $window 2>&1 | grep "pid" | wc -l)
+
+ #if [ ! $HAS_PID -eq 0 ]; then
+ # echo "$window does not have a process"
+ #else
+ xdotool windowunmap $window
+ xdotool windowmap $window
+ #fi
+done
+ exit 1
+fi