From 8d4deda2bbc743826560814daecaab027586d616 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 8 Jan 2011 11:30:58 -0500 Subject: [PATCH] Feature #309 - Added feature #309, which sets the xterm title when reports are run, according to the configuration variable 'xterm.title', which defaults to off. --- ChangeLog | 2 ++ NEWS | 2 ++ doc/man/taskrc.5.in | 4 ++++ src/Config.cpp | 1 + src/Context.cpp | 11 +++++++++++ src/command.cpp | 1 + 6 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index a6063faf1..2618829bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,8 @@ + Added feature #158, regular expression support for filters and substitutions. + Added feature #247, providing infinite width reports when redirecting output to a file, by setting defaultwidth to 0. + + Added feature #309, which sets the xterm title when reports are run, + according to the configuration variable 'xterm.title', which defaults to off. + Added feature #546, which is a 'count' command that counts tasks, and is intended to help scripts that manipulate task output. + Added feature #567, which makes it possible to apply an offset to the first diff --git a/NEWS b/NEWS index 998b27790..a9be79d0f 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,8 @@ New configuration options in taskwarrior 1.9.4 and imported tasks that don't otherwise have a due date. - edit.verbose can be set to 'off' to eliminated the help text when using the 'task edit' command. + - xterm.title can be set to 'on' to update the xterm window title when a + report is run. Newly deprecated features in taskwarrior 1.9.4 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 2f75e3844..215eb9cde 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -281,6 +281,10 @@ setting. The default value is off, because this advanced feature could cause confusion among users that are not comfortable with regular expressions. +.TP +.B xterm.title=no +Sets the xterm window title when reports are run. Defaults to off. + .TP .B _forcecolor=no Taskwarrior shuts off color automatically when the output is not sent directly diff --git a/src/Config.cpp b/src/Config.cpp index 51562fcb9..db439ce31 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -84,6 +84,7 @@ std::string Config::defaults = "undo.style=side # Undo style - can be 'side', or 'diff'\n" "burndown.bias=0.666 # Weighted mean bias toward recent data\n" "regex=no # Assume all search/filter strings are regexes\n" + "xterm.title=no # Sets xterm title for some commands\n" "\n" "# Dates\n" "dateformat=m/d/Y # Preferred input and display date format\n" diff --git a/src/Context.cpp b/src/Context.cpp index 9f2d359ec..ed155cb9a 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -206,6 +206,17 @@ int Context::dispatch (std::string &out) hooks.trigger ("pre-dispatch"); + // For read-only commands, optionally update the xterm window title. + // Why just the read-only commands? Because this capability is to answer the + // question of 'what did I just do to generate this outout?'. + if (config.getBoolean ("xterm.title") && + cmd.isReadOnlyCommand ()) + { + std::string title; + join (title, " ", args); + std::cout << "]0;task " << title << "" << std::endl; + } + // TODO Just look at this thing. It cries out for a dispatch table. if (cmd.command == "projects") { rc = handleProjects (out); } else if (cmd.command == "tags") { rc = handleTags (out); } diff --git a/src/command.cpp b/src/command.cpp index 31c00bc8c..cca6155df 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -1158,6 +1158,7 @@ int handleShow (std::string& outs) "active.indicator tag.indicator recurrence.indicator recurrence.limit " "list.all.projects list.all.tags undo.style verbose rule.precedence.color " "merge.autopush merge.default.uri pull.default.uri push.default.uri " + "xterm.title " #ifdef FEATURE_SHELL "shell.prompt " #endif