summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorHatem Nassrat <hnassrat@gmail.com>2009-02-23 09:57:18 -0400
committerShawn Betts <sabetts@gmail.com>2009-04-13 04:51:53 -0700
commite2282bd77f041430c510203365b18436a60d0586 (patch)
tree414dc0f1295c81b8b251a3dd00092c5569bed955 /contrib
parent82be5b35eda82f8dd4b6e19940d6a7bee1b582ea (diff)
downloadratpoison-e2282bd77f041430c510203365b18436a60d0586.zip
Allowing for next and prev workspace switching.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/rpws32
1 files changed, 31 insertions, 1 deletions
diff --git a/contrib/rpws b/contrib/rpws
index 089e0a2..4408734 100755
--- a/contrib/rpws
+++ b/contrib/rpws
@@ -1,6 +1,12 @@
#!/usr/bin/perl -w
#
+# Copyright (c) 2009 Hatem Nassrat <hnassrat@gmail.com>
+# All rights reserved. Modifications under same license as original script.
+# ChangeLog:
+#
+# Added C-M-Right and C-M-Left for next and prev workspace
+#
# Copyright (c) 2005 Mike O'Connor
# All rights reserved.
# Author Mike O'Connor <stew@vireo.org>
@@ -72,6 +78,9 @@ sub ws_init
rp_call( "setenv fspl1 $fd" );
rp_call( "setenv wspl 1" );
+ # Keep track of workspace count
+ rp_call( "setenv wspc $num" );
+
# restore the frames
rp_call( "frestore $fd" );
@@ -94,6 +103,22 @@ sub ws_restore
ws_save();
+ if ( $which =~ /^(?:next|prev)$/ )
+ {
+ my $ws = rp_call( "getenv wspl" );
+ my $wspc = rp_call( "getenv wspc" );
+
+ if ( $which eq 'next' )
+ {
+ $ws++;
+ }
+ else
+ {
+ $ws--;
+ }
+ $which = ( ( $ws - 1 ) % $wspc ) + 1;
+ }
+
if( $which == 1 )
{
rp_call( "gselect default" );
@@ -115,6 +140,8 @@ sub add_aliases
foreach my $i (1..$n) {
rp_call ( "alias rpws$i exec $0 $i" );
}
+ rp_call ( "alias rpwsn exec $0 next" );
+ rp_call ( "alias rpwsp exec $0 prev" );
}
sub add_keys
@@ -123,6 +150,8 @@ sub add_keys
foreach my $i (1..$n) {
rp_call ( "definekey top M-F$i rpws$i" );
}
+ rp_call ( "definekey top C-M-Right rpwsn" );
+ rp_call ( "definekey top C-M-Left rpwsp" );
}
my $arg = shift @ARGV || 'help';
@@ -170,7 +199,8 @@ Add the following line in ~/.ratpoisonrc
exec /path/to/rpws init 6 -k
This creates 6 aliases rpws1, rpws2, etc. It also binds the keys M-F1,
-M-F2, etc to each rpwsN alias.
+M-F2, etc to each rpwsN alias. Moreover, rpwsn (Next) and rpwsp (Prev) are
+created, and C-M-{Right,Left} are bound to rpws{n,p}.
=head1 FILES