summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAli Gholami Rudi <aliqrudi@gmail.com>2008-10-11 08:33:32 +0330
committerShawn <sabetts@juicebox.(none)>2008-10-12 17:11:54 -0700
commit2557e59fc5ce7690d05856b04e0ea5aaff6f9f60 (patch)
tree1cdb0859bfb23b581144df7c2b9664d5b32e5ab9 /src
parent96f8765e306e2a5ed27546d2fec9b08613d369c2 (diff)
downloadratpoison-2557e59fc5ce7690d05856b04e0ea5aaff6f9f60.zip
add grename command
Diffstat (limited to 'src')
-rw-r--r--src/actions.c9
-rw-r--r--src/actions.h1
-rw-r--r--src/group.c8
-rw-r--r--src/group.h1
4 files changed, 19 insertions, 0 deletions
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);