Re: Swap behavior request and thanks for the RPWS changes.
tomm smith <[email protected]>
| Newsgroups | gmane.comp.window-managers.ratpoison.devel |
|---|---|
| Message-ID | <[email protected]> |
@jbaber good call, I added 2 lines to deal with the case of a single frame being open, I have attached the new script along with another small change. @kelly Thank you, that is a good point. There is no particular reason I was doing it like that, besides possibly over complicating things, I updated the script with the new awk line and things seem to be working well. good looking out. _______________________________________________ Ratpoison-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/ratpoison-devel
swap_wrapper.sh
(application/x-sh, 682 B)
#!/bin/bash
# Synopsis: Simple wrapper script for ratpoisons "swap" feature
# Author: thims (root DOT packet AT gmail DOT com)
# Date: 20090309
# Comments:
# A simple wrapper script to give ratpoisons "swap" command the
# ability to automatically swap frames if only 2 frames are open.
frames=$(( $(ratpoison -c sfdump | sed 's/,/\n/g' | wc -l) - 1)) # minus 1 due to the trailing , in sfdump
framenum=( )
cnt=0
for i in $(ratpoison -c sfdump | sed 's/,/\n/g' | awk '{print $3}')
do
framenum[$cnt]=$i
cnt=$((cnt + 1))
done
if [ $frames == 2 ] ;then
ratpoison -c "swap ${framenum[0]} ${framenum[1]}"
elif [ $frames -lt 2 ] ;then
exit 0
else
ratpoison -i -c swap
fi