summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2004-10-05 05:03:54 +0000
committersabetts <sabetts>2004-10-05 05:03:54 +0000
commit9e4afcbbc2a5aa949bd94a65f0bf931513005386 (patch)
treebdb56ea989010acbe6d031691f26ff9d0322b71c
parentc3e876b118cb8a0234091180b1d64602da31e563 (diff)
downloadratpoison-9e4afcbbc2a5aa949bd94a65f0bf931513005386.zip
new command, sselect
(cmd_sselect): new function. added prototype.
-rw-r--r--ChangeLog3
-rw-r--r--NEWS3
-rw-r--r--doc/ratpoison.texi12
-rw-r--r--src/actions.c35
-rw-r--r--src/actions.h1
5 files changed, 51 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index cbd0dfb..1b3a3c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2004-10-05 Shawn Betts <katia_dilkina@verizon.net>
+ * src/actions.c: new command, sselect
+ (cmd_sselect): new function. added prototype.
+
* src/events.c (property_notify): pass the root window to
receive_command.
(receive_command): take a root window as an argument and use it to
diff --git a/NEWS b/NEWS
index 9cf6812..6d9f1ef 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
ratpoison NEWS --- history of user-visible changes. -*- outline -*-
* Changes since 1.3.0
+** new command, sselect
+sselect lets you jump to an X11 screen by number.
+
** configure script warns about missing history lib
Rather than error out, now, ratpoison will just be built without history.
diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index 2af7291..c9e070e 100644
--- a/doc/ratpoison.texi
+++ b/doc/ratpoison.texi
@@ -764,8 +764,9 @@ space.
The X Windowing System assigns each monitor a screen number. To switch
to another screen use the commands @command{nextscreen} and
-@command{prevscreen}. ratpoison will tell you which frame has focus by
-drawing the current frame indicator in it.
+@command{prevscreen}. Or, @command{sselect} to jump to a specified
+screen. ratpoison will tell you which frame has focus by drawing the
+current frame indicator in it.
Many commands operate only on the current screen. This becomes
apparent when you have 2 screens each with 1 frame. In each frame you
@@ -774,7 +775,8 @@ command @command{other}, for instance, you'll get a message ``No other
window.'' ratpoison means there's no other window to switch to in the
current screen. If you want to switch to the other xterm you can
switch to it by name (use @command{select} or @kbd{C-t '}), by number,
-or you can use @command{nextscreen} and @command{prevscreen}.
+or you can use @command{nextscreen}, @command{prevscreen}, and
+@command{sselect}.
@deffn Command nextscreen
This jumps you to the next X11 screen. @command{nextscreen} is
@@ -786,6 +788,10 @@ This jumps you to the previous X11 screen. @command{prevscreen} is
used for dual-head displays and multiple monitor setups.
@end deffn
+@deffn Command sselect @var{n}
+This jumps you to the @var{n}th X11 screen. Screen numbers start at 0.
+@end deffn
+
@node Keystrokes, Hooks, Multiple Monitors, Top
@chapter Keystrokes
diff --git a/src/actions.c b/src/actions.c
index 5321ed3..821efa9 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -100,6 +100,7 @@ static user_command user_commands[] =
{"shrink", cmd_shrink, arg_VOID},
{"source", cmd_source, arg_STRING},
{"split", cmd_v_split, arg_STRING},
+ {"sselect", cmd_sselect, arg_STRING},
{"startup_message", cmd_startup_message, arg_STRING},
{"time", cmd_time, arg_VOID},
{"title", cmd_rename, arg_STRING},
@@ -3031,6 +3032,40 @@ cmd_prevscreen (int interactive, char *data)
}
char *
+cmd_sselect(int interactive, char *data)
+{
+ char *str;
+ char *tmp;
+ int new_screen;
+ if (data == NULL)
+ str = get_input ("Select Screen: ", trivial_completions);
+ else
+ str = xstrdup (data);
+
+ if (str == NULL)
+ return NULL;
+
+ tmp = strtok (str, " ");
+ if (tmp)
+ {
+ new_screen = string_to_window_number (tmp);
+ if (new_screen < 0)
+ {
+ message (" sselect: invalid argument ");
+ free (str);
+ return NULL;
+ }
+ if (new_screen < num_screens)
+ set_active_frame (screen_get_frame (&screens[new_screen], screens[new_screen].current_frame));
+ else
+ message (" sselect: out of range ");
+ }
+
+ free (str);
+ return NULL;
+}
+
+char *
cmd_warp (int interactive, char *data)
{
if (data == NULL && !interactive)
diff --git a/src/actions.h b/src/actions.h
index f027df1..62e5df5 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -124,6 +124,7 @@ char *cmd_newkmap (int interactive, char *data);
char *cmd_delkmap (int interactive, char *data);
char *cmd_definekey (int interactive, char *data);
char *cmd_set (int interactive, char *data);
+char *cmd_sselect(int interactive, char *data);
rp_keymap *find_keymap (char *name);
void initialize_default_keybindings (void);