On Thu, Dec 13, 2012 at 9:57 AM, Nicholas Marriott <nicholas.marri...@gmail.com> wrote: > On Thu, Dec 13, 2012 at 09:38:01AM -0500, Scott Frazer wrote: >> On Wed, Dec 12, 2012 at 2:21 PM, Nicholas Marriott >> <nicholas.marri...@gmail.com> wrote: >> > Hi >> > >> > You definitely shouldn't use C0 control codes for this, you should >> > probably use DCS but with a different prefix instead of "tmux;" which is >> > used for raw passthrough (look at input_dcs_dispatch). >> > >> >> Yes, I thought that was probably not the best way to do it. I don't know how >> DCS works, but I'm sure Google will help. >> >> > However, I'm not sure we need code to do this at all. Can't you use a >> > wrapper script that sets the colour/renames the window/etc? That's what >> > I do for ssh. >> > >> > For example something like: >> >> [example snipped] >> >> I think that would work for the 'sticky' status that I want, but I would >> still >> have to use the alert and monitor-content indicators for fail/pass which have >> the limitations I mentioned before. I'll work on the DCS method and post a >> new patch. I understand it will likely be rejected, but perhaps someone else >> will find it useful. I certainly do :) > > You could check the return code and set different names/colours on > success or failure and bind a key to reset the window options, maybe not > quite as quick as it automatically removing the state but it'd work :-).
I thought some more about your approach of using the command line, and while I liked it I didn't want to manually remove the pass/fail status when I visited a window. So I created this patch which adds an 'attention' indication that is higher priority than the regular colors/attributes, and gets automatically removed when you go to the window. Again it feels a bit hacky, but was a simple way to do it. I like it better than my first approach because you can add colors/attributes any way you want for any number of things. Scott --- options-table.c | 15 +++++++++++++++ status.c | 12 ++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-) diff --git a/options-table.c b/options-table.c index 8ce838a..1e2bde1 100644 --- a/options-table.c +++ b/options-table.c @@ -655,6 +655,21 @@ const struct options_table_entry window_options_table[] = { .default_num = 8 }, + { .name = "window-status-attn-attr", + .type = OPTIONS_TABLE_ATTRIBUTES, + .default_num = 0 + }, + + { .name = "window-status-attn-bg", + .type = OPTIONS_TABLE_COLOUR, + .default_num = 8 + }, + + { .name = "window-status-attn-fg", + .type = OPTIONS_TABLE_COLOUR, + .default_num = 8 + }, + { .name = "window-status-attr", .type = OPTIONS_TABLE_ATTRIBUTES, .default_num = 0 diff --git a/status.c b/status.c index e841d80..9223401 100644 --- a/status.c +++ b/status.c @@ -692,6 +692,15 @@ status_print( attr = options_get_number(oo, "window-status-attr"); if (attr != 0) gc->attr = attr; + fg = options_get_number(oo, "window-status-attn-fg"); + if (fg != 8) + colour_set_fg(gc, fg); + bg = options_get_number(oo, "window-status-attn-bg"); + if (bg != 8) + colour_set_bg(gc, bg); + attr = options_get_number(oo, "window-status-attn-attr"); + if (attr != 0) + gc->attr = attr; fmt = options_get_string(oo, "window-status-format"); if (wl == s->curw) { fg = options_get_number(oo, "window-status-current-fg"); @@ -704,6 +713,9 @@ status_print( if (attr != 0) gc->attr = attr; fmt = options_get_string(oo, "window-status-current-format"); + options_set_number(oo, "window-status-attn-fg", 8); + options_set_number(oo, "window-status-attn-bg", 8); + options_set_number(oo, "window-status-attn-attr", 0); } if (wl->flags & WINLINK_BELL) { -- 1.7.8 ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users