summaryrefslogtreecommitdiff
path: root/contrib/rpshowall.sh
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-11-22 19:08:13 +0000
committersabetts <sabetts>2003-11-22 19:08:13 +0000
commit863e018ef2cf8851694cbd9b7c3889d52fe50b17 (patch)
treea4d857c0a7d7192ad2c6bcc0eb253664d8ab376d /contrib/rpshowall.sh
parentcf7ad617d4ce46c6bac6ac28e5323ab53e3ef17b (diff)
downloadratpoison-863e018ef2cf8851694cbd9b7c3889d52fe50b17.zip
(pkgdata_DATA): add rpshowall.sh
(EXTRA_DIST): likewise
Diffstat (limited to 'contrib/rpshowall.sh')
-rw-r--r--contrib/rpshowall.sh51
1 files changed, 43 insertions, 8 deletions
diff --git a/contrib/rpshowall.sh b/contrib/rpshowall.sh
index b4d8570..487ad90 100644
--- a/contrib/rpshowall.sh
+++ b/contrib/rpshowall.sh
@@ -2,16 +2,39 @@
# rpshowall
# ratpoison script to show all open windows
-# 2003 Florian Cramer <cantsin@zedat.fu-berlin.de>
+# Copyright (C) 2003 Florian Cramer <cantsin@zedat.fu-berlin.de>
+
+# Usage :
+#
+# rpshowall [no arguments]
+# if called from a terminal, show all open windows and
+# restore previous frame layout upon keystroke
+#
+# rpshowall [n>1]
+# show all open windows for n seconds,
+# then restore previous frame layout
+#
+# rpshowall 0
+# show all open windows, do not restore previous frame layout
if [ -z $RATPOISON ]; then
RATPOISON=ratpoison
fi
+
+# Parse input argument
+
+if [ $*>0 ]; then
+ wait="$*"
+else
+ wait=-1
+fi
+
+
# Save current frameset
framecount=`$RATPOISON -c windows | wc -l | sed -e "s/[ ]*//g"`
-curframe=`$RATPOISON -c windows | grep "^.\*" | sed -e "s/^\([0-9]*\)\*.*/\1/"`
-$RATPOISON -c "setenv tmp `$RATPOISON -c 'fdump'`"
+curframe=`$RATPOISON -c windows | grep "^[0-9]*\*" | sed -e "s/^\([0-9]*\).*/\1/"`
+curlayout=`$RATPOISON -c fdump`
# Create split view of all open windows
@@ -29,10 +52,22 @@ while [ $i -le $framecount ]; do
i=$[$i+1];
done
-
-# Restore frameset
+# Depending on the argument the script was executed with,
+# 1- select a new window and exit opening it fullscreen
+# 2- restore frameset after keyboard input
+# 3- restore frameset after $wait seconds of delay
$RATPOISON -c "select $curframe"
-echo -n "Restore window layout... "
-read i
-$RATPOISON -c "frestore `$RATPOISON -c 'getenv tmp'`"
+if [ $wait -eq 0 ]; then
+ $RATPOISON -i -c fselect
+ $RATPOISON -c only
+else
+ $RATPOISON -i -c windows
+ if [ $wait -eq -1 ]; then
+ echo -n "Hit return to restore window layout. "
+ read i
+ else
+ sleep $wait
+ fi
+ $RATPOISON -c "frestore $curlayout"
+fi