about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-08-29 21:41:10 +0100
committerJames Booth <boothj5@gmail.com>2013-08-29 21:41:10 +0100
commit4738a15c89998ca0cae5621be652bb401721cdd5 (patch)
treee3d19f961799d17f0ee13c6a3abcf651c987970f
parent659e449e1287b05d8f56860938b73190609d8982 (diff)
downloadprofani-tty-4738a15c89998ca0cae5621be652bb401721cdd5.tar.gz
Added /win command to access unlimited windows
-rw-r--r--src/command/command.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index bae6a7c3..ef00fae8 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -143,6 +143,7 @@ static gboolean _cmd_tiny(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_titlebar(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_vercheck(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_who(gchar **args, struct cmd_help_t help);
+static gboolean _cmd_win(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_wins(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_xa(gchar **args, struct cmd_help_t help);
 
@@ -409,6 +410,14 @@ static struct cmd_t command_defs[] =
           "Example : /nick bob",
           NULL } } },
 
+    { "/win",
+        _cmd_win, parse_args, 1, 1, NULL,
+        { "/win num", "View a window.",
+        { "/win num",
+          "------------------",
+          "Show the contents of a specific window in the main window area.",
+          NULL } } },
+
     { "/wins",
         _cmd_wins, parse_args, 0, 1, NULL,
         { "/wins [tidy|prune]", "List or tidy active windows.",
@@ -1662,6 +1671,19 @@ _cmd_wins(gchar **args, struct cmd_help_t help)
     return TRUE;
 }
 
+static gboolean
+_cmd_win(gchar **args, struct cmd_help_t help)
+{
+    int num = atoi(args[0]);
+    if (ui_win_exists(num)) {
+        ui_switch_win(num);
+    } else {
+        cons_show("Window %d does not exist.", num);
+    }
+
+    return TRUE;
+}
+
 static
 gint _compare_commands(Command *a, Command *b)
 {