summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ratpoison.12
-rw-r--r--doc/ratpoison.texi4
-rw-r--r--src/actions.c9
-rw-r--r--src/actions.h1
-rw-r--r--src/group.c8
-rw-r--r--src/group.h1
6 files changed, 25 insertions, 0 deletions
diff --git a/doc/ratpoison.1 b/doc/ratpoison.1
index b27473d..c1cfc6d 100644
--- a/doc/ratpoison.1
+++ b/doc/ratpoison.1
@@ -378,6 +378,8 @@ Select the prior group. Most window commands only see windows in the
effective group.
.cmd gravity [ \fBnw | \fBw | \fBsw | \fBn | \fBc | \fBs | \fBne | \fBe | \fBse ]
Change how in its frame the current window is aligned.
+.cmd grename
+Rename current group.
.cmd groups
Output a list of all groups with their number.
.cmd gselect group
diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index 1b38e2b..788c7f0 100644
--- a/doc/ratpoison.texi
+++ b/doc/ratpoison.texi
@@ -607,6 +607,10 @@ Go to the last accessed group.
Go to the previous group in the list.
@end deffn
+@deffn Command grename
+Rename current group.
+@end deffn
+
@deffn Command gselect @var{group}
Select a particular group by name or number. If @var{group} is not
provided, ratpoison will interactively prompt for the group.
diff --git a/src/actions.c b/src/actions.c
index 4187877..ef71285 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -254,6 +254,8 @@ init_user_commands(void)
"Name: ", arg_STRING);
add_command ("gnewbg", cmd_gnewbg, 1, 1, 1,
"Name: ", arg_STRING);
+ add_command ("grename", cmd_grename, 1, 1, 1,
+ "Change group name to: ", arg_STRING);
add_command ("gnext", cmd_gnext, 0, 0, 0);
add_command ("gprev", cmd_gprev, 0, 0, 0);
add_command ("gother", cmd_gother, 0, 0, 0);
@@ -4855,6 +4857,13 @@ cmd_gnewbg (int interactive, struct cmdarg **args)
}
cmdret *
+cmd_grename (int interactive, struct cmdarg **args)
+{
+ group_rename (rp_current_group, ARG_STRING(0));
+ return cmdret_new (RET_SUCCESS, NULL);
+}
+
+cmdret *
cmd_gselect (int interactive, struct cmdarg **args)
{
rp_group *g;
diff --git a/src/actions.h b/src/actions.h
index 76ee85f..3fcd3b7 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -140,6 +140,7 @@ RP_CMD (gnext);
RP_CMD (gprev);
RP_CMD (gother);
RP_CMD (gravity);
+RP_CMD (grename);
RP_CMD (groups);
RP_CMD (gselect);
RP_CMD (h_split);
diff --git a/src/group.c b/src/group.c
index e5d66f9..069b677 100644
--- a/src/group.c
+++ b/src/group.c
@@ -101,6 +101,14 @@ group_add_new_group (char *name)
return g;
}
+void
+group_rename (rp_group *g, char *name)
+{
+ if (g->name)
+ free (g->name);
+ g->name = xstrdup (name);
+}
+
rp_group *
group_next_group (void)
{
diff --git a/src/group.h b/src/group.h
index 4e6ad81..176e4ee 100644
--- a/src/group.h
+++ b/src/group.h
@@ -53,6 +53,7 @@ rp_group *group_next_group (void);
rp_group *group_last_group (void);
rp_group *group_add_new_group (char *name);
+void group_rename (rp_group *g, char *name);
rp_window_elem *group_find_window (struct list_head *list, rp_window *win);
rp_window_elem *group_find_window_by_number (rp_group *g, int num);