* [sup-talk] [PATCH] Title bar and status bar widget
@ 2007-11-08 10:44 Marcus Williams
2007-11-08 12:10 ` vasudeva
2007-11-12 0:48 ` William Morgan
0 siblings, 2 replies; 9+ messages in thread
From: Marcus Williams @ 2007-11-08 10:44 UTC (permalink / raw)
This patch adds two new hooks that allow you to set the title bar of a
terminal (default is no title, to support non-terminal users) and the
status bar of sup (default is standard status bar string).
status-bar-widget
-----------------
File: /home/marcus/.sup/hooks/status-bar-widget.rb
Generates the contents of the status bar
Variables:
total: Total number of messages in inbox
spam: Total number of messages marked as spam
new: Total number of messages marked as unread (new)
mode: Mode string
status: Mode status
title: Mode title
terminal-title-widget
---------------------
File: /home/marcus/.sup/hooks/terminal-title-widget.rb
Generates the contents of the title bar
Variables:
total: Total number of messages in inbox
spam: Total number of messages marked as spam
new: Total number of messages marked as unread (new)
mode: Mode string
status: Mode status
title: Mode title
So I have in my terminal-title-widget.rb (giving me a quick way to see
if I have any email when iconised):
"Sup/#{Redwood::VERSION} - #{new} unread of #{total} messages"
In my title bar this looks like
Sup/0.2 - 12 unread of 4520 messages
Note that the numbers come from the index, so if you read a message
and dont save (via '$') the display doesnt know about those changes.
Incoming messages go straight to index so will update it
automatically.
If its any use I could add counts for other forms of messages
(starred/killed etc) but I only use the spam, new and total and I only
use spam to track what the before-add-message hook is doing :)
Marcus
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-08 10:44 [sup-talk] [PATCH] Title bar and status bar widget Marcus Williams
@ 2007-11-08 12:10 ` vasudeva
2007-11-09 7:40 ` Marcus Williams
2007-11-12 0:48 ` William Morgan
1 sibling, 1 reply; 9+ messages in thread
From: vasudeva @ 2007-11-08 12:10 UTC (permalink / raw)
* on 11-08-07, Marcus Williams wrote:
> This patch adds two new hooks that allow you to set the title bar of a
> terminal (default is no title, to support non-terminal users) and the
> status bar of sup (default is standard status bar string).
A case for :confirm_no_patches ? ;)
/></
--
linkswarm.com :: Collaborative Insolence
vasudeva.linkswarm.com/gallery :: For The Faint of Heart
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-08 12:10 ` vasudeva
@ 2007-11-09 7:40 ` Marcus Williams
0 siblings, 0 replies; 9+ messages in thread
From: Marcus Williams @ 2007-11-09 7:40 UTC (permalink / raw)
On 8.11.2007, vasudeva wrote:
> * on 11-08-07, Marcus Williams wrote:
> > This patch adds two new hooks that allow you to set the title bar of a
> > terminal (default is no title, to support non-terminal users) and the
> > status bar of sup (default is standard status bar string).
>
> A case for :confirm_no_patches ? ;)
Oops! :) Attached this time....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: widgets-patch
Type: application/octet-stream
Size: 2037 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20071109/5cedd47f/attachment.obj
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-08 10:44 [sup-talk] [PATCH] Title bar and status bar widget Marcus Williams
2007-11-08 12:10 ` vasudeva
@ 2007-11-12 0:48 ` William Morgan
2007-11-12 9:23 ` Marcus Williams
1 sibling, 1 reply; 9+ messages in thread
From: William Morgan @ 2007-11-12 0:48 UTC (permalink / raw)
Hi Marcus,
Excerpts from Marcus Williams's message of Thu Nov 08 02:44:44 -0800 2007:
> This patch adds two new hooks that allow you to set the title bar of a
> terminal (default is no title, to support non-terminal users) and the
> status bar of sup (default is standard status bar string).
This patch actually has a problem, which you can see if you try and use
"say" from within one of those hooks, or if you insert an error into the
hook code.
The problem is that the hooks are executed from draw_status, which is
executed within the context of a lock on Ncurses.mutex.
BufferManager#flash (which is triggered by both a call to #say and an
error) cannot be called within that lock or a double-lock exception
occurs.
So, either Ncurses.mutex needs to be a reentrant lock (I have played
around with this but haven't yet been able to get it to work), or the
code that runs these hooks needs to run outside of the lock (which takes
place in BufferManager#draw_screen and #completely_redraw_screen).
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-12 0:48 ` William Morgan
@ 2007-11-12 9:23 ` Marcus Williams
2007-11-12 17:02 ` William Morgan
0 siblings, 1 reply; 9+ messages in thread
From: Marcus Williams @ 2007-11-12 9:23 UTC (permalink / raw)
On 12.11.2007, William Morgan wrote:
> So, either Ncurses.mutex needs to be a reentrant lock (I have played
> around with this but haven't yet been able to get it to work), or the
> code that runs these hooks needs to run outside of the lock (which takes
> place in BufferManager#draw_screen and #completely_redraw_screen).
Presumably after the unlock, rather than before the lock on the mutex
if the stuff is redrawing? I'll resubmit later today.
Marcus
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-12 9:23 ` Marcus Williams
@ 2007-11-12 17:02 ` William Morgan
2007-11-12 22:07 ` Marcus Williams
0 siblings, 1 reply; 9+ messages in thread
From: William Morgan @ 2007-11-12 17:02 UTC (permalink / raw)
Excerpts from Marcus Williams's message of Mon Nov 12 01:23:59 -0800 2007:
> Presumably after the unlock, rather than before the lock on the mutex
> if the stuff is redrawing? I'll resubmit later today.
Actually I think the best would be to call the hooks before the lock,
and pass in the values to actually be drawn into the locked code, so
that the draw happens within the lock. It means adding a couple
arguments to some of these methods, probably.
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-12 17:02 ` William Morgan
@ 2007-11-12 22:07 ` Marcus Williams
2007-11-26 20:42 ` William Morgan
0 siblings, 1 reply; 9+ messages in thread
From: Marcus Williams @ 2007-11-12 22:07 UTC (permalink / raw)
On 12.11.2007, William Morgan wrote:
> Actually I think the best would be to call the hooks before the lock,
> and pass in the values to actually be drawn into the locked code, so
> that the draw happens within the lock. It means adding a couple
> arguments to some of these methods, probably.
Attached is a patch for this. Not sure if this is the best way of
doing it as I've used accessors on buffer class rather than passing
args.
Marcus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: widget-diffs
Type: application/octet-stream
Size: 2692 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20071112/a834f4e4/attachment.obj
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-12 22:07 ` Marcus Williams
@ 2007-11-26 20:42 ` William Morgan
2007-11-26 20:45 ` Marcus Williams
0 siblings, 1 reply; 9+ messages in thread
From: William Morgan @ 2007-11-26 20:42 UTC (permalink / raw)
Excerpts from Marcus Williams's message of Mon Nov 12 14:07:17 -0800 2007:
> Attached is a patch for this. Not sure if this is the best way of
> doing it as I've used accessors on buffer class rather than passing
> args.
I've added this functionality to SVN trunk, although I had to deviate
pretty far from the patch in order to get everything right. I also
changed the variable names slightly. Check it out and see if it does
everything you want.
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] [PATCH] Title bar and status bar widget
2007-11-26 20:42 ` William Morgan
@ 2007-11-26 20:45 ` Marcus Williams
0 siblings, 0 replies; 9+ messages in thread
From: Marcus Williams @ 2007-11-26 20:45 UTC (permalink / raw)
On 26.11.2007, William Morgan wrote:
> I've added this functionality to SVN trunk, although I had to deviate
> pretty far from the patch in order to get everything right. I also
> changed the variable names slightly. Check it out and see if it does
> everything you want.
On it now - cant get the title text to work yet, but I might be
missing something. Just trying to re-jig my shell and pipe patches so
that the shell one is in bin/sup. Will submit soon.
Marcus
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-11-26 20:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08 10:44 [sup-talk] [PATCH] Title bar and status bar widget Marcus Williams
2007-11-08 12:10 ` vasudeva
2007-11-09 7:40 ` Marcus Williams
2007-11-12 0:48 ` William Morgan
2007-11-12 9:23 ` Marcus Williams
2007-11-12 17:02 ` William Morgan
2007-11-12 22:07 ` Marcus Williams
2007-11-26 20:42 ` William Morgan
2007-11-26 20:45 ` Marcus Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox