diff options
author | Vasil Zlatanov <vasil.zlatanov@gmail.com> | 2015-08-18 02:38:33 +0200 |
---|---|---|
committer | Vasil Zlatanov <vasil.zlatanov@gmail.com> | 2015-08-18 02:38:33 +0200 |
commit | 6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42 (patch) | |
tree | 93ebfb332b3a231931fe1b1276632bdaa33fa6e4 /Window_Manager/ratpoison/window_menu | |
parent | c021038355b6773ab13dae92327fda50c366395f (diff) | |
download | dotfiles-6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42.tar.gz dotfiles-6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42.tar.bz2 dotfiles-6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42.zip |
Organise everything systematically.
Diffstat (limited to 'Window_Manager/ratpoison/window_menu')
-rwxr-xr-x | Window_Manager/ratpoison/window_menu | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Window_Manager/ratpoison/window_menu b/Window_Manager/ratpoison/window_menu new file mode 100755 index 0000000..26f5e4d --- /dev/null +++ b/Window_Manager/ratpoison/window_menu @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Lets you switch between all windows in a way that minimizes keystrokes. + +# Two ways to order: +# - If order=last, the windows are listed in the order that you last visited them in. +# - If order=sequential, the windows are listed in number order. +order=sequential +ratmenu="~/.config/ratpoison/ratmenu" + +source ~/.colors + +# Yes, bash is really necessary, because it's version of printf makes this +# script possible. Regular bourne shell printf does NOT. + +window_index_str=$(ratpoison -c "info" | sed 's/^.*\([0-9]\)(.*$/\1/') +if [ "$window_index_str" = "No window." ]; then + group_index=$($HOME/.config/ratpoison/workspace current) + $ratmenu -style dreary -fg \"$COLOR0\" -bg \"$COLOR0\" "No windows in group $group_index" +/bin/true +else + ratpoison -c "echo $window_index_str" + echo "$window_index_str">/tmp/log + window_index=$[ $window_index_str + 1 ] + if [ $order = sequential ]; then + ( printf "$ratmenu -style dreary -fg \"$COLOR11\" -bg \"$COLOR0\" -io $window_index \ + "; + ratpoison -c "windows %n %n %t" | sort -n | while read w x z; do + a=$(printf "%3q" $x); b="ratpoison -c \"select $x\""; + printf " %q\\ %q %q" "$a" "$z" "$b"; + done; echo \;) | sh + elif [ $order = last ]; then + ( printf "$ratmenu -style dreary -fg \"$COLOR11\" -bg \"$COLOR0\" -io $window_index \ + "; + ratpoison -c "windows %l %n %t" | sort -rn | while read w x z; do + a=$(printf "%3q" $x); b="ratpoison -c \"select $x\""; + printf " %q\\ %q %q" "$a" "$z" "$b"; + done; echo \;) | sh + fi +fi |