From 6d6e0462eb2dd1d770653f5e22582e3571c63c8f Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Sun, 23 Nov 2014 11:08:21 +0100 Subject: big ratpoison update --- ratpoison/.ratpoison | 1 - ratpoison/.ratpoisonrc.conf.un~ | Bin 6562 -> 97641 bytes ratpoison/clipboard | 7 +- ratpoison/numpad/ratnumpad.conf | 12 -- ratpoison/numpad/ratnumund.conf | 12 -- ratpoison/paneltoggle | 2 + ratpoison/pentfocus | 1 + ratpoison/ratpoisonrc.clipboard | 54 ++++---- ratpoison/ratpoisonrc.conf | 67 +++++---- ratpoison/screenrc | 1 + ratpoison/screenrc.admin | 6 +- ratpoison/screenrc.irssi | 1 - ratpoison/screenrcnobar | 4 + ratpoison/volind | 2 +- ratpoison/window_menu | 11 +- ratpoison/workspace | 298 ---------------------------------------- ratpoison/workspace.conf | 38 ----- ratpoison/workspace_menu | 10 +- 18 files changed, 100 insertions(+), 427 deletions(-) delete mode 120000 ratpoison/.ratpoison delete mode 100644 ratpoison/numpad/ratnumpad.conf delete mode 100644 ratpoison/numpad/ratnumund.conf delete mode 100755 ratpoison/workspace delete mode 100644 ratpoison/workspace.conf diff --git a/ratpoison/.ratpoison b/ratpoison/.ratpoison deleted file mode 120000 index 6b7f260..0000000 --- a/ratpoison/.ratpoison +++ /dev/null @@ -1 +0,0 @@ -.ratpoison \ No newline at end of file diff --git a/ratpoison/.ratpoisonrc.conf.un~ b/ratpoison/.ratpoisonrc.conf.un~ index b43b148..9d8c008 100644 Binary files a/ratpoison/.ratpoisonrc.conf.un~ and b/ratpoison/.ratpoisonrc.conf.un~ differ diff --git a/ratpoison/clipboard b/ratpoison/clipboard index 9033ac1..2cb6c2c 100755 --- a/ratpoison/clipboard +++ b/ratpoison/clipboard @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # # Clipboard menu # @@ -28,14 +28,15 @@ function entries() { fi for i in $(seq 1 9); do - repr=$(xcb -p $i | tr '\n$*?"'\''' ' ' | cut --bytes 0-59) + repr=$(xcb -p $i | tr '\n$*?"'\''' ' ' | cut --bytes 1-59) if [ $command = menu_paste ]; then cmd_item="$0 paste $i" else cmd_item="$0 set $i" fi #printf '%q %q ' $i "$repr" "$cmd_item" - echo -n "\"$i $repr\" \"$cmd_item\" " +# echo -n "\"$i: $repr\" \"$cmd_item\" " + echo -n "\"$i:$repr \" \"$cmd_item\" " done } diff --git a/ratpoison/numpad/ratnumpad.conf b/ratpoison/numpad/ratnumpad.conf deleted file mode 100644 index f3cc280..0000000 --- a/ratpoison/numpad/ratnumpad.conf +++ /dev/null @@ -1,12 +0,0 @@ -# Use numpad to move the rat -definekey top KP_End ratrelwarp -10 10 -definekey top KP_Down ratrelwarp 0 10 -definekey top KP_Next ratrelwarp 10 10 -definekey top KP_Left ratrelwarp -10 0 -definekey top KP_Begin ratclick 1 -definekey top S-KP_Begin ratclick 1 -definekey top KP_Right ratrelwarp 10 0 -definekey top KP_Home ratrelwarp -10 -10 -definekey top KP_Up ratrelwarp 0 -10 -definekey top KP_Prior ratrelwarp 10 -10 -definekey top KP_Delete banish diff --git a/ratpoison/numpad/ratnumund.conf b/ratpoison/numpad/ratnumund.conf deleted file mode 100644 index 32d4919..0000000 --- a/ratpoison/numpad/ratnumund.conf +++ /dev/null @@ -1,12 +0,0 @@ -# Use numpad to move the rat -undefinekey top KP_End -undefinekey top KP_Down -undefinekey top KP_Next -undefinekey top KP_Left -undefinekey top KP_Begin -undefinekey top S-KP_Begin -undefinekey top KP_Right -undefinekey top KP_Home -undefinekey top KP_Up -undefinekey top KP_Prior -undefinekey top KP_Delete diff --git a/ratpoison/paneltoggle b/ratpoison/paneltoggle index cb5f367..5e665bb 100755 --- a/ratpoison/paneltoggle +++ b/ratpoison/paneltoggle @@ -1,4 +1,6 @@ #!/bin/sh +# This shell script is PUBLIC DOMAIN. You may do whatever you want with it. + TOGGLE=$HOME/.toggle if [ ! -e $TOGGLE ]; then diff --git a/ratpoison/pentfocus b/ratpoison/pentfocus index b0d40de..e8be6f8 100755 --- a/ratpoison/pentfocus +++ b/ratpoison/pentfocus @@ -1,4 +1,5 @@ #!/bin/sh ratpoison -c 'ratwarp 1332 568' +sleep 0.01 ratpoison -c 'ratclick 1' ratpoison -c banish diff --git a/ratpoison/ratpoisonrc.clipboard b/ratpoison/ratpoisonrc.clipboard index 673e969..dd4bc29 100644 --- a/ratpoison/ratpoisonrc.clipboard +++ b/ratpoison/ratpoisonrc.clipboard @@ -17,41 +17,41 @@ chdir newkmap clipboard_paste newkmap clipboard_set -exec .ratpoison/clipboard init +exec ~/.ratpoison/clipboard init bind p readkey clipboard_paste bind y readkey clipboard_set # Menu version of paste and set -definekey clipboard_paste p exec .ratpoison/clipboard menu_paste -definekey clipboard_set y exec .ratpoison/clipboard menu_set +definekey clipboard_paste p exec ~/.ratpoison/clipboard menu_paste +definekey clipboard_set y exec ~/.ratpoison/clipboard menu_set # Clear buffers -definekey clipboard_set C exec .ratpoison/clipboard init +definekey clipboard_set C exec ~/.ratpoison/clipboard init # Push/pop -definekey clipboard_paste a exec .ratpoison/clipboard pop -definekey clipboard_set a exec .ratpoison/clipboard push +definekey clipboard_paste a exec ~/.ratpoison/clipboard pop +definekey clipboard_set a exec ~/.ratpoison/clipboard push # pop queue -definekey clipboard_paste q exec .ratpoison/clipboard pop_queue - -definekey clipboard_paste 1 exec .ratpoison/clipboard paste 1 -definekey clipboard_paste 2 exec .ratpoison/clipboard paste 2 -definekey clipboard_paste 3 exec .ratpoison/clipboard paste 3 -definekey clipboard_paste 4 exec .ratpoison/clipboard paste 4 -definekey clipboard_paste 5 exec .ratpoison/clipboard paste 5 -definekey clipboard_paste 6 exec .ratpoison/clipboard paste 6 -definekey clipboard_paste 7 exec .ratpoison/clipboard paste 7 -definekey clipboard_paste 8 exec .ratpoison/clipboard paste 8 -definekey clipboard_paste 9 exec .ratpoison/clipboard paste 9 - -definekey clipboard_set 1 exec .ratpoison/clipboard set 1 -definekey clipboard_set 2 exec .ratpoison/clipboard set 2 -definekey clipboard_set 3 exec .ratpoison/clipboard set 3 -definekey clipboard_set 4 exec .ratpoison/clipboard set 4 -definekey clipboard_set 5 exec .ratpoison/clipboard set 5 -definekey clipboard_set 6 exec .ratpoison/clipboard set 6 -definekey clipboard_set 7 exec .ratpoison/clipboard set 7 -definekey clipboard_set 8 exec .ratpoison/clipboard set 8 -definekey clipboard_set 9 exec .ratpoison/clipboard set 9 +definekey clipboard_paste q exec ~/.ratpoison/clipboard pop_queue + +definekey clipboard_paste 1 exec ~/.ratpoison/clipboard paste 1 +definekey clipboard_paste 2 exec ~/.ratpoison/clipboard paste 2 +definekey clipboard_paste 3 exec ~/.ratpoison/clipboard paste 3 +definekey clipboard_paste 4 exec ~/.ratpoison/clipboard paste 4 +definekey clipboard_paste 5 exec ~/.ratpoison/clipboard paste 5 +definekey clipboard_paste 6 exec ~/.ratpoison/clipboard paste 6 +definekey clipboard_paste 7 exec ~/.ratpoison/clipboard paste 7 +definekey clipboard_paste 8 exec ~/.ratpoison/clipboard paste 8 +definekey clipboard_paste 9 exec ~/.ratpoison/clipboard paste 9 + +definekey clipboard_set 1 exec ~/.ratpoison/clipboard set 1 +definekey clipboard_set 2 exec ~/.ratpoison/clipboard set 2 +definekey clipboard_set 3 exec ~/.ratpoison/clipboard set 3 +definekey clipboard_set 4 exec ~/.ratpoison/clipboard set 4 +definekey clipboard_set 5 exec ~/.ratpoison/clipboard set 5 +definekey clipboard_set 6 exec ~/.ratpoison/clipboard set 6 +definekey clipboard_set 7 exec ~/.ratpoison/clipboard set 7 +definekey clipboard_set 8 exec ~/.ratpoison/clipboard set 8 +definekey clipboard_set 9 exec ~/.ratpoison/clipboard set 9 diff --git a/ratpoison/ratpoisonrc.conf b/ratpoison/ratpoisonrc.conf index ce18f56..3b9fd89 100644 --- a/ratpoison/ratpoisonrc.conf +++ b/ratpoison/ratpoisonrc.conf @@ -1,13 +1,14 @@ -# info: C=control, M=meta/alt, s=super, S=shift +# info: C=control, M=meta/alt, s=super, S=shift, H = Hyper +# xnest for testing escape grave definekey top s-grave meta +definekey top Arabic_dammatan meta -#Test windows -set framesels '0123456789' - -#Palaver voice -definekey top s-Home exec /home/vasko/downloads/Palaver-master/hotkey +#unmanage Nautilus Desktop +unmanage Desktop +# set font with unicode support +set font -*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* #Style message box set bgcolour #fdf6e3 @@ -23,7 +24,7 @@ bind Tab nextscreen set wingravity center # Use the name of the program rather than the title in the window list -set winname class +set winname title #Pest control. banish @@ -45,30 +46,26 @@ exec nitrogen --restore #Border & Padding alias showpadding set border 3 alias hidepadding set border 0 +hidepadding -barinpadding 1 +barinpadding 0 alias showborder set barpadding 0 0 alias hideborder set barpadding 0 0 set fwcolor #657b83 set bwcolor #839496 -# Use numpad to move the rat -#source .ratpoison/numpad/ratnumpad.conf -bind KP_Multiply source .ratpoison/numpad/ratnumpad.conf -bind KP_Subtract source .ratpoison/numpad/ratnumund.conf - ###################################### # Panel ###################################### -alias rpbar exec sleep 20 && rpbar -alias rpbarsend exec rpbarsend +alias rpbar exec sleep 21 && rpbar +alias rpbarsend exec ~/.ratpoison/rpbarsend # tell ratpoison to ignore rpbar unmanage rpbar # leave space for bars # start rpbar -alias panel exec xfce4-panel --disable-wm-check +alias panel exec xfce4-panel --disable-wm-check && rpbar panel rpbar @@ -85,7 +82,7 @@ addhook newwindow rpbarsend unmanage conky unmanage xfce4-panel unmanage ratbar.pl -alias showpanel set padding 0 26 0 0 +alias showpanel set padding 0 27 0 0 alias hidepanel set padding 0 0 0 0 showpanel #------------------------------------------------------------- @@ -138,6 +135,21 @@ definekey top S-F10 exec rpws 22 definekey top S-F11 exec rpws 23 definekey top S-F12 exec rpws 24 +#definekey top s-F1 exec ratpoison -c 'meta F1' +#definekey top s-F2 exec ratpoison -c 'meta F2' +#definekey top s-F3 exec ratpoison -c 'meta F3' +#definekey top s-F4 exec ratpoison -c 'meta F4' +#definekey top s-F5 exec ratpoison -c 'meta F5' +#definekey top s-F6 exec ratpoison -c 'meta F6' +#definekey top s-F7 exec ratpoison -c 'meta F7' +#definekey top s-F8 exec ratpoison -c 'meta F8' +#definekey top s-F9 exec ratpoison -c 'meta F9' +#definekey top s-F10 exec ratpoison -c 'meta F10' +#definekey top s-F11 exec ratpoison -c 'meta F11' +#definekey top s-F12 exec ratpoison -c 'meta F12' + + + definekey top S-F12 exec rpws 13 definekey top M-S-F12 rpwsm13 @@ -160,27 +172,29 @@ bind K exchangeup bind w window_menu bind a title bind t time -definekey top s-l exec xscreensaver-command -lock +definekey top s-l exec i3lock +definekey top s-s exec ~/bin/sus definekey top s-L redisplay -bind c exec gksudo gnome-control-center +bind c exec gnome-control-center +bind C exec sudo gnome-control-center bind v hsplit bind V hsplit 2/3 bind s vsplit bind S vsplit 2/3 bind d remove bind space exec urxvt -bind S-space exec gksu gnome-terminal bind o only bind semicolon colon bind e exec bind u undo -bind I info +bind i info bind x delete bind X kill bind Escape abort -exec a=123 -definekey top s-B exec ratpoison -c "echo `echo $a`" +#Paste goodness +bind g exec ~/bin/imgur +bind P exec gist -P -p -t txt | perl -pe chomp | xclip alias bordtoggle exec ~/.ratpoison/bordtoggle alias bordscript exec ~/.ratpoison/borderscript @@ -217,7 +231,12 @@ definekey top s-f exec firefox definekey top s-m exec /home/vasko/.ratpoison/pentfocus definekey top s-v exec vlc definekey top s-g exec gvim -definekey top s-l exec libreoffice +#definekey top s-l exec libreoffice + +#----------------------------------------------------- +# Voice control +#----------------------------------------------------- +definekey top KP_Enter exec ~/Dropbox/speech/run-duplex.sh #------------------------------------------------------------- # Volume Control diff --git a/ratpoison/screenrc b/ratpoison/screenrc index cb29f66..7917907 100644 --- a/ratpoison/screenrc +++ b/ratpoison/screenrc @@ -28,6 +28,7 @@ bind 'o' only bind 'r' resize # bind buffer +bufferfile bind b eval writebuf "exec !!! $HOME/.ratpoison/screenout" diff --git a/ratpoison/screenrc.admin b/ratpoison/screenrc.admin index 42516d7..dc60e36 100644 --- a/ratpoison/screenrc.admin +++ b/ratpoison/screenrc.admin @@ -9,12 +9,12 @@ screen -t Admin3 3 screen -t Admin4 4 screen -t Root0 5 select 5 -exec sudo su +exec su screen -t Root1 6 select 6 -exec sudo su +exec su screen -t Root2 7 select 7 -exec sudo su +exec su select 0 diff --git a/ratpoison/screenrc.irssi b/ratpoison/screenrc.irssi index 8775960..0be6047 100644 --- a/ratpoison/screenrc.irssi +++ b/ratpoison/screenrc.irssi @@ -1,5 +1,4 @@ # change to home directory and source screenrc from ratpoison directory -escape ^xX chdir source .ratpoison/screenrcnobar diff --git a/ratpoison/screenrcnobar b/ratpoison/screenrcnobar index 64aedfd..57fccbf 100644 --- a/ratpoison/screenrcnobar +++ b/ratpoison/screenrcnobar @@ -4,6 +4,10 @@ vbell off startup_message off altscreen on +#multiuser +multiuser on +acladd vasko + # look and feel activity "Activity in %t(%n)" diff --git a/ratpoison/volind b/ratpoison/volind index 3444201..c562ef6 100755 --- a/ratpoison/volind +++ b/ratpoison/volind @@ -4,7 +4,7 @@ bottom=`echo $volm | awk '{print int($1 * 0.2 + 0.5)}'` top=$((20-$bottom)) if [[ "$volm" -eq "100" ]]; then - let volm=M+ + let volm=99 fi diff --git a/ratpoison/window_menu b/ratpoison/window_menu index 60f9af7..46b4bd3 100755 --- a/ratpoison/window_menu +++ b/ratpoison/window_menu @@ -6,6 +6,7 @@ # - 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="~/.ratpoison/ratmenu" # Yes, bash is really necessary, because it's version of printf makes this # script possible. Regular bourne shell printf does NOT. @@ -13,22 +14,22 @@ order=sequential window_index_str=$(ratpoison -c "info" | sed 's/^.*\([0-9]\)(.*$/\1/') if [ "$window_index_str" = "No window." ]; then group_index=$($HOME/.ratpoison/workspace current) - ratmenu -style dreary -fg "#657b83" -bg "#eee8d5" "No windows in group $group_index" + $ratmenu -style dreary -fg "#657b83" -bg "#eee8d5" "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 '#657b83' -bg '#eee8d5' -io $window_index \ - \"Select a Window\" /bin/true"; + ( printf "$ratmenu -style dreary -fg '#657b83' -bg '#eee8d5' -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 '#657b83' -bg '#eee8d5' -io $window_index \ - \"Select a Window\" /bin/true"; + ( printf "$ratmenu -style dreary -fg '#657b83' -bg '#eee8d5' -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"; diff --git a/ratpoison/workspace b/ratpoison/workspace deleted file mode 100755 index c314d0a..0000000 --- a/ratpoison/workspace +++ /dev/null @@ -1,298 +0,0 @@ -#!/usr/bin/env perl -# -# Copyright (c) 2006 Daniel M. Webb -# Copyright (c) 2005 Mike O'Connor -# All rights reserved. -# Author Daniel M. Webb -# Original Author Mike O'Connor -# -# Modified by Shawn Betts. -# -# code was adapeted from rpws that comes from ratpoison containing the follwing copyright: -# Copyright (C) 2003 Shawn Betts -# Author: Shawn Betts -# -use strict; -use Fcntl qw (:flock); -use Getopt::Std; - -my $ratpoison = $ENV{ "RATPOISON" } || "ratpoison"; -my $tmp=$ENV{ "TMP" } || "/tmp"; -my $lockfile = $ENV{ "WORKSPACE_LOCKFILE" } || "$tmp/workspace.$<.lock"; - -my $number_of_workspaces = 1; -my @ws_names; -my @ws_toggle_memory_trigger; -$ws_names[0] = "default"; # workspace 0 can't be renamed due to bug -for( my $i = 1; $i <= 13; $i++ ) -{ - $ws_names[$i] = "workspace$i"; - $ws_toggle_memory_trigger[$i] = "true"; -} - -# Load configuration now that defaults are set -require "$ENV{HOME}/.ratpoison/workspace.conf"; -set_workspaces(\$number_of_workspaces, \@ws_names, \@ws_toggle_memory_trigger); - -sub help -{ - system("pod2usage", $0); - print( "for more detailed documentation run \"perldoc $0\"\n" ); -} - -sub rp_call -{ - my $result = `$ratpoison -c "@_"`; - chomp( $result ); - chomp( $result ); - return $result; -} - -sub ws_init_ws -{ - my $num = shift; - - if ($num > 0) - { - rp_call( "gnew $ws_names[$num]" ); - } - my $fd = fdump(); - rp_call( "setenv fspl$num $fd" ); -} - -sub fdump -{ - return rp_call( "fdump" ); -} - -sub ws_init -{ - my $num = shift; - - # Backup the frames - my $fd = fdump(); - - rp_call( "select -" ); - rp_call( "only" ); - - my $i; - for( my $i = 0; $i < $number_of_workspaces; $i++ ) - { - ws_init_ws( $i ); - rp_call( "setenv toggle_memory$i 0" ); - } - # Rename group 0 now that there are other groups - # (it can't be deleted if it already exists) - #rp_call( "gdelete 0" ); - #rp_call( "gnew $ws_names[0]" ); - # NOTE: group 0 apparently can't be deleted even if empty, so can't be renamed. - - # Start in workspace 0. - $fd = fdump(); - rp_call( "gselect default" ); - rp_call( "setenv fspl0 $fd" ); - rp_call( "setenv cur_workspace 0" ); - - # restore the frames - rp_call( "frestore $fd" ); - - if( -e "$lockfile" ) - { - unlink ("$lockfile" ); - } -} - -sub ws_save_frames -{ - my $ws = rp_call( "getenv cur_workspace" ); - my $fd = fdump(); - rp_call( "setenv fspl$ws $fd" ); -} - -sub ws_restore -{ - my $new_ws = shift; - my $cur_ws = rp_call( "getenv cur_workspace" ); - # For togglers, give a warning if same ws is chosen. - # For non-togglers, selecting same ws toggles back - if ($new_ws == $cur_ws and $ws_toggle_memory_trigger[$cur_ws] eq "true") - { -# rp_call( "echo Already on workspace $new_ws" ); - } - else - { - if ($new_ws == $cur_ws) - { - # Special case of choosing non-toggler goes back to previous - $new_ws = rp_call( "getenv toggle_memory$cur_ws" ); - } - ws_save_frames(); - if ($ws_toggle_memory_trigger[$cur_ws] eq "true") - { - rp_call( "setenv toggle_memory$new_ws $cur_ws" ); - } - `killall xbindkeys`; - my $rc_dir = `dirname $0`; chomp($rc_dir); - my $rcfilename="$rc_dir/macro/xbindkeysrc/" . "xbindkeysrc.$ws_names[$new_ws]"; - if (-f $rcfilename) { - print "running xbindkeys -f $rcfilename\n"; - `xbindkeys -f $rcfilename`; - } - rp_call( "gselect $ws_names[$new_ws]"); - my $last = rp_call( "getenv fspl$new_ws" ); - rp_call( "frestore $last" ); - rp_call( "setenv cur_workspace $new_ws" ); - # Get window number/name too - my $window_info=rp_call("info"); - my $window_number = $window_info; - $window_number =~ s/^\(.*?\) (\d+).*$/$1/; - my $window_name = $window_info; - $window_name =~ s/^\(.*?\) \d+\((.*)\)$/$1/; -# rp_call( "echo Workspace: $ws_names[$new_ws]\nWindow : $window_number - $window_name" ); - } -} - -sub ws_toggle -{ - my $cur_ws = rp_call( "getenv cur_workspace" ); - my $new_ws = rp_call( "getenv toggle_memory$cur_ws" ); - ws_restore($new_ws); -} - -# unfinished: -sub list_all_windows -{ - my $cur_ws = rp_call( "getenv cur_workspace" ); - print("ratmenu -style dreary -fg '#657b83' -bg '#eee8d5'"); - # FIXME: 6 should be replaced with actual number of workspaces - foreach my $i (0..6) - { - rp_call( "gselect $ws_names[$i]"); - my $result = `$ratpoison -c "windows %n %t"`; - foreach my $line (split (/\n/, $result)) - { - my @window = split(/ /, $line); - print(" \"$ws_names[$i] : $line\" \"$0 $i; ratpoison -c \\\"select $window[0]\\\" \""); - } - } - ws_restore($cur_ws); -} - -sub add_aliases -{ - foreach my $i (0..$number_of_workspaces-1) { - rp_call ( "alias workspace$i exec $0 $i" ); - } - rp_call ( "alias workspace_toggle exec $0 toggle" ); - rp_call ( "alias rpwsn exec $0 next" ); - rp_call ( "alias rpwsp exec $0 prev" ); - rp_call ( "alias rpwsmn exec $0 movenext" ); - rp_call ( "alias rpwsmp exec $0 moveprev" ); - -} - -sub add_keys -{ - foreach my $i (0..$number_of_workspaces-1) { - rp_call ( "bind C-$i workspace$i" ); - } - rp_call ( "bind C-g workspace_toggle" ); -} - -my $arg = shift @ARGV; - -if( $arg eq "help" ) { - help(); -} elsif( $arg eq "init" ) { - my %opts; - ws_init(); - getopts('ka', \%opts); - add_aliases() if $opts{'a'} || $opts{'k'}; - add_keys() if $opts{'k'}; -} else { - open LOCK, ">>$lockfile" or die "Cannot open lockfile: $lockfile"; - flock(LOCK, LOCK_EX); - if ( $arg eq "toggle" ) { - ws_toggle(); - } elsif ( $arg eq "list_all" ) { - list_all_windows(); - } elsif ( $arg eq "current" ) { - my $cws = rp_call( "getenv cur_workspace" ); - print "$cws"; - } elsif ($arg >= 0 and $arg <= 13) { - ws_restore( $arg ); - } else { - help(); - } -} - -__END__ - -=head1 NAME - -workspace - Implements multiple workspaces in ratpoison - -=head1 SYNOPSIS - - workspace init [-k] [-a] - setup workspace with $number_of_workspaces workspaces - ($number_of_workspaces is set in the workspace.conf file). - -a sets up command aliases; - -k sets up key bindings and aliases. - workspace help - this documentation - workspace n - switch to this workspace - workspace toggle - switch to previous workspace (other than default) - workspace toggle_default - switch back and forth to between default workspace - workspace current - print the index of the current workspace - - -=head1 DESCRIPTION - - B implements multiple workspaces in ratpoison by making calls - to fdump, freestore. It was adapted from rpws which comes with - ratpoison in the contrib directory. - -=head1 USAGE - -Add the following line in ~/.ratpoisonrc - - exec /path/to/workspace init -k - -This creates 6 aliases workspace1, workspace2, etc. It also binds the keys C-1, -C-2, etc to each workspaceN alias. Workspace names can be configured at the -top of this script. - -The toggle command is analogous to the ratpoison "other" command for windows, -except it is for workspaces and is implemented in this script instead of within -ratpoison. - -If $ws_toggle_memory_trigger is true for a workspace, that workspace sets -the toggle memory on return. If it's false, it will just toggle back to the -previous workspace but the memory will stay the same. - -If there is a file /path/to/workspace/macro/xbindkeysrc/xbindkeysrc., -then xbindkeys will be run with this file as configuration. - -=head1 FILES - - workspace requires use of a lockfile. It defaults to using -/tmp/workspace..lock but this can be changed by setting the -environment variable WORKSPACE_LOCKFILE to your desired lockfile. - -=head1 AUTHOR - - Mike O'Connor - -=head1 COPYRIGHT - - Copyright (c) 2005 Mike O'Connor - All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. diff --git a/ratpoison/workspace.conf b/ratpoison/workspace.conf deleted file mode 100644 index 6d610f8..0000000 --- a/ratpoison/workspace.conf +++ /dev/null @@ -1,38 +0,0 @@ -sub set_workspaces { - my $number_of_workspaces = shift; - my $ws_names = shift; - my $ws_toggle_memory_trigger = shift; - - $$number_of_workspaces = 13; - - # user-customized workspace names: - $$ws_names[1] = "ranger"; - $$ws_names[2] = "firefox"; - $$ws_names[3] = "feeds"; - $$ws_names[4] = "admin"; - $$ws_names[5] = "school"; - $$ws_names[6] = "projects"; - $$ws_names[7] = "notes"; - $$ws_names[8] = "random"; - $$ws_names[9] = "mail"; - $$ws_names[10] = "irc"; - $$ws_names[11] = "wifi"; - $$ws_names[12] = "music"; - - # Does changing to this workspace set the toggle memory of the workspace you came from? - $$ws_toggle_memory_trigger[0] = "true"; - $$ws_toggle_memory_trigger[1] = "true"; - $$ws_toggle_memory_trigger[2] = "true"; - $$ws_toggle_memory_trigger[3] = "true"; - $$ws_toggle_memory_trigger[4] = "true"; - $$ws_toggle_memory_trigger[5] = "true"; - $$ws_toggle_memory_trigger[6] = "true"; - $$ws_toggle_memory_trigger[7] = "true"; - $$ws_toggle_memory_trigger[8] = "true"; - $$ws_toggle_memory_trigger[9] = "true"; - $$ws_toggle_memory_trigger[10] = "true"; - $$ws_toggle_memory_trigger[11] = "true"; - $$ws_toggle_memory_trigger[12] = "true"; -} - -return 1; diff --git a/ratpoison/workspace_menu b/ratpoison/workspace_menu index 020f887..6ffcb14 100755 --- a/ratpoison/workspace_menu +++ b/ratpoison/workspace_menu @@ -7,12 +7,18 @@ # 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 ]"; +( 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=$(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 -- cgit v1.2.3-54-g00ecf