aboutsummaryrefslogtreecommitdiff
path: root/ratpoison/workspace_menu
blob: 6ffcb144f6390d487da2243c65d47bc4f5ecd48e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash

# Lets you switch between all workspaces in a way that minimizes keystrokes.
# The current workspace is selected.

# Yes, bash is really necessary, because it's version of printf makes this
# script possible.  Regular bourne shell printf does NOT.

workspace_command="/usr/bin/rpws"
ratmenu="~/.ratpoison/ratmenu"

( printf "$ratmenu -style dreary -fg '#657b83' -bg '#eee8d5' -io $[ $($workspace_command current) + 1 ]";
  ratpoison -c "groups" | while read s; do
    n=$(echo $s | sed 's/\([0-9]\+\).*/\1/');
#    w=$(echo $s | sed 's/[0-9]\+.\(.*\)/\1/');
    w=$(ratpoison -c "gselect $(($n-1))" -c "windows %t" -c "gprev")
    a=$(printf "%3q %q" $n $w); b="$workspace_command $n";
    if [ $n -ne 0 ];then
    printf " %q %q"  "$a" "$b";
    else
    printf " %q %q"  "Go to workspace:" "/bin/true";
    fi
  done; echo \;) | sh