[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RP] list groups and windows
From: |
Joe Corneli |
Subject: |
Re: [RP] list groups and windows |
Date: |
Fri, 25 Feb 2005 02:20:14 -0600 |
A gother command. that's on the TODO too.
Wheee...
The appended "implementation" only works once you've visited some
other group (i.e. if you create two groups and say :gother, RP won't
do anything).
This would be easy to fix (at least, if this was lisp) by adding a
test in `cmd_gother' to see whether `rp_last_group' has changed from
its initialization value. But this ain't lisp, and I don't know what
the initialization value is.
My whole implementation may be a crock, but phenomenally, it seems to
work fine. RP must be really stable to be able to withstand this sort
of "abuse".
Cheers,
Joe
diff -c /Users/arided/ratpoison/src/actions.c ./src/actions.c
*** /Users/arided/ratpoison/src/actions.c Tue Feb 22 00:54:05 2005
--- ./src/actions.c Fri Feb 25 01:37:56 2005
***************
*** 207,212 ****
--- 207,213 ----
add_command ("gnewbg", cmd_gnewbg, 1, 1, 1,
"Name: ", arg_STRING);
add_command ("gnext", cmd_gnext, 0, 0, 0);
+ add_command ("gother", cmd_gother, 0, 0, 0);
add_command ("gprev", cmd_gprev, 0, 0, 0);
add_command ("gravity", cmd_gravity, 1, 0, 1,
"Gravity: ", arg_GRAVITY);
***************
*** 4407,4412 ****
--- 4408,4420 ----
}
cmdret *
+ cmd_gother (int interactive, struct cmdarg **args)
+ {
+ set_current_group (rp_last_group);
+ return cmdret_new (RET_SUCCESS, NULL);
+ }
+
+ cmdret *
cmd_gprev (int interactive, struct cmdarg **args)
{
set_current_group (group_prev_group ());
diff -c /Users/arided/ratpoison/src/actions.h ./src/actions.h
*** /Users/arided/ratpoison/src/actions.h Thu Feb 10 22:52:32 2005
--- ./src/actions.h Fri Feb 25 01:32:51 2005
***************
*** 129,134 ****
--- 129,135 ----
RP_CMD (gnew);
RP_CMD (gnewbg);
RP_CMD (gnext);
+ RP_CMD (gother);
RP_CMD (gprev);
RP_CMD (gravity);
RP_CMD (groups);
Binary files /Users/arided/ratpoison/src/actions.o and ./src/actions.o differ
diff -c /Users/arided/ratpoison/src/globals.c ./src/globals.c
*** /Users/arided/ratpoison/src/globals.c Thu Feb 10 22:52:33 2005
--- ./src/globals.c Fri Feb 25 01:35:31 2005
***************
*** 51,56 ****
--- 51,57 ----
Display *dpy;
rp_group *rp_current_group;
+ rp_group *rp_last_group;
LIST_HEAD (rp_groups);
LIST_HEAD (rp_children);
struct rp_defaults defaults;
diff -c /Users/arided/ratpoison/src/globals.h ./src/globals.h
*** /Users/arided/ratpoison/src/globals.h Thu Feb 10 22:52:33 2005
--- ./src/globals.h Fri Feb 25 01:43:00 2005
***************
*** 57,62 ****
--- 57,63 ----
extern struct list_head rp_groups;
extern rp_group *rp_current_group;
+ extern rp_group *rp_last_group;
/* Each child process is stored in this list. spawn, creates a new
entry in this list, the SIGCHLD handler sets child.terminated to be
Binary files /Users/arided/ratpoison/src/globals.o and ./src/globals.o differ
diff -c /Users/arided/ratpoison/src/group.c ./src/group.c
*** /Users/arided/ratpoison/src/group.c Fri Dec 3 21:33:24 2004
--- ./src/group.c Fri Feb 25 01:30:08 2005
***************
*** 471,476 ****
--- 471,479 ----
if (rp_current_group == g || g == NULL)
return;
+ /* Not as elegant or complex as the windows version. */
+ rp_last_group = rp_current_group;
+
rp_current_group = g;
/* Call the switch group hook. */