summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-09-13 11:14:29 +0000
committersabetts <sabetts>2001-09-13 11:14:29 +0000
commit73f336b75de79e011842bb5f4851c2e5169c76ab (patch)
treeb13c57e9f8bdf19eed171ad4473eb343523dc49b /src/actions.c
parentd5b04e0048b0f1bd5a3d5a8f6c5f49aecab5ed64 (diff)
downloadratpoison-73f336b75de79e011842bb5f4851c2e5169c76ab.zip
(command): Gobble the whitespace between the
command and the argument list. Code that did this in specific commands has been removed. (cmd_setenv): new function (cmd_meta): rename from cmd_generate. All dependant code updated. (cmd_redisplay): rename from cmd_maximize. All dependant code updated. (initialize_default_keybindings): bind "redisplay" to C-t l and C-t c-l. (cmd_msgwait): rename from cmd_defbartimeout. All dependant code updated.
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c70
1 files changed, 44 insertions, 26 deletions
diff --git a/src/actions.c b/src/actions.c
index a38c9e7..c963a1a 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -42,11 +42,11 @@ static user_command user_commands[] =
{"escape", cmd_escape, arg_STRING},
{"exec", cmd_exec, arg_STRING},
{"focus", cmd_next_frame, arg_VOID},
- {"generate", cmd_generate, arg_STRING}, /* rename to stuff */
+ {"meta", cmd_meta, arg_STRING},
{"help", cmd_help, arg_VOID},
{"hsplit", cmd_h_split, arg_VOID},
{"kill", cmd_kill, arg_VOID},
- {"maximize", cmd_maximize, arg_VOID},
+ {"redisplay", cmd_redisplay, arg_VOID},
{"newwm", cmd_newwm, arg_STRING},
{"next", cmd_next, arg_VOID},
{"number", cmd_number, arg_STRING},
@@ -65,10 +65,11 @@ static user_command user_commands[] =
{"version", cmd_version, arg_VOID},
{"vsplit", cmd_v_split, arg_VOID},
{"windows", cmd_windows, arg_VOID},
+ {"setenv", cmd_setenv, arg_STRING},
/* Commands to set default behavior. */
{"defbarloc", cmd_defbarloc, arg_STRING},
- {"defbartimeout", cmd_defbartimeout, arg_STRING},
+ {"msgwait", cmd_msgwait, arg_STRING},
{"defborder", cmd_defborder, arg_STRING},
{"deffont", cmd_deffont, arg_STRING},
{"definputwidth", cmd_definputwidth, arg_STRING},
@@ -90,22 +91,11 @@ static user_command user_commands[] =
implemented. See the screen documentation for what should be
emulated with these commands */
#if 0
- {"hardcopy", cmd_unimplemented, arg_VOID},
{"lastmsg", cmd_unimplemented, arg_VOID},
{"license", cmd_unimplemented, arg_VOID},
- {"lockscreen", cmd_unimplemented, arg_VOID},
- {"meta", cmd_unimplemented, arg_VOID},
{"msgminwait", cmd_unimplemented, arg_VOID},
- {"msgwait", cmd_unimplemented, arg_VOID},
{"nethack", cmd_unimplemented, arg_VOID},
- {"redisplay", cmd_unimplemented, arg_VOID},
- {"screen", cmd_unimplemented, arg_VOID},
- {"setenv", cmd_unimplemented, arg_VOID},
- {"shell", cmd_unimplemented, arg_VOID},
- {"shelltitle", cmd_unimplemented, arg_VOID},
{"sleep", cmd_unimplemented, arg_VOID},
- {"sorendition", cmd_unimplemented, arg_VOID},
- {"startup_message", cmd_unimplemented, arg_VOID},
{"stuff", cmd_unimplemented, arg_VOID},
#endif
{0, 0, 0} };
@@ -208,7 +198,7 @@ initialize_default_keybindings (void)
prefix_key.state = MODIFIER_PREFIX;
add_keybinding (prefix_key.sym, prefix_key.state, "other");
- add_keybinding (prefix_key.sym, 0, "generate");
+ add_keybinding (prefix_key.sym, 0, "meta");
add_keybinding (XK_g, ControlMask, "abort");
add_keybinding (XK_0, 0, "select 0");
add_keybinding (XK_1, 0, "select 1");
@@ -238,8 +228,8 @@ initialize_default_keybindings (void)
add_keybinding (XK_exclam, ControlMask, "colon exec " TERM_PROG " -e ");
add_keybinding (XK_k, 0, "delete");
add_keybinding (XK_k, ControlMask, "delete");
- add_keybinding (XK_m, 0, "maximize");
- add_keybinding (XK_m, ControlMask, "maximize");
+ add_keybinding (XK_l, 0, "redisplay");
+ add_keybinding (XK_l, ControlMask, "redisplay");
add_keybinding (XK_n, 0, "next");
add_keybinding (XK_n, ControlMask, "next");
add_keybinding (XK_p, 0, "prev");
@@ -468,7 +458,7 @@ cmd_source (int interactive, void *data)
}
char *
-cmd_generate (int interactive, void *data)
+cmd_meta (int interactive, void *data)
{
XEvent ev1, ev;
ev = rp_current_event;
@@ -1038,12 +1028,11 @@ cmd_abort (int interactive, void *data)
return NULL;
}
-/* Maximize the current window. */
+/* Redisplay the current window by sending 2 resize events. */
char *
-cmd_maximize (int interactive, void *data)
+cmd_redisplay (int interactive, void *data)
{
force_maximize (current_window());
-
return NULL;
}
@@ -1067,9 +1056,9 @@ cmd_escape (int interactive, void *data)
action->state = key->state;
}
- /* Update the "generate" keybinding */
+ /* Update the "meta" keybinding */
action = find_keybinding(prefix_key.sym, 0);
- if (action != NULL && !strcmp (action->data, "generate"))
+ if (action != NULL && !strcmp (action->data, "meta"))
{
action->key = key->sym;
action->state = 0;
@@ -1455,20 +1444,20 @@ cmd_defmaxsizepos (int interactive, void *data)
}
char *
-cmd_defbartimeout (int interactive, void *data)
+cmd_msgwait (int interactive, void *data)
{
int tmp;
if (data == NULL
|| sscanf (data, "%d", &tmp) < 1)
{
- message (" defbartimeout: One argument required ");
+ message (" msgwait: One argument required ");
}
if (tmp >= 0)
defaults.bar_timeout = tmp;
else
- message (" defbartimeout: Bad argument ");
+ message (" msgwait: Bad argument ");
return NULL;
}
@@ -1776,3 +1765,32 @@ cmd_defbgcolor (int interactive, void *data)
return NULL;
}
+
+char *
+cmd_setenv (int interactive, void *data)
+{
+ char *var, *string;
+
+ if (data == NULL)
+ {
+ message (" setenv: Two arguments required ");
+ return NULL;
+ }
+
+ /* Get the 2 arguments. */
+ var = xmalloc (strlen (data) + 1);
+ string = xmalloc (strlen (data) + 1);
+ if (sscanf (data, "%s %s", var, string) < 2)
+ {
+ message (" setenv: Two arguments required ");
+ free (var);
+ free (string);
+ return NULL;
+ }
+
+ setenv (var, string, 1);
+
+ free (var);
+ free (string);
+ return NULL;
+}