[O] Clocking time in frame title bar

2012-02-23 Thread Borbus
Hi,

I'm really enjoying using org-mode's clocking features and it's nice
that it shows the current task and total clocking time in the modeline
but for me there is a problem with this: I often have multiple windows
open and my frame is split horizontally.  This means the modeline is too
short to contain this information.  Also even if I could see it, it's
being displayed redundantly in multiple modelines.

So I thought about how it could be different and I realised something: I
use the emacs GTK GUI but I turn off most things, scrollbars, menubars
etc. but there is one thing still wasting space: the frame title bar.
So why not use this space?

I know emacs lisp and I'm happy to write a patch for this myself, but
before I dive in I would like to ask a couple of questions here: first,
does this sounds feasible?  Is there something I don't know about the
frame title that would make it unsuitable for being constantly updated
like the modeline?  Secondly, if it seems feasible, where is the best
place to start in the org code (org-clock.el I guess) and would there be
a preferable way to be able to switch this feature on and off?

Thanks,

Borbus.



Re: [O] Clocking time in frame title bar

2012-02-23 Thread Borbus
Well I just went ahead and wrote the hack anyway and it seems to work
for me, here is what I did:

;; show clock and timer stuff in the frame title
(defvar plain-frame-title-format frame-title-format)
(defun clock-in-frame-title ()
  (if (org-clocking-p)
  (setq frame-title-format (list (concat
  (car plain-frame-title-format)
   :: Clocked in: 
  (org-clock-get-clock-string)
   :: Pomodoro:
  org-timer-mode-line-string)))
(setq frame-title-format plain-frame-title-format)))
(run-at-time t 1 'clock-in-frame-title)
(add-hook 'org-clock-in-hook 'clock-in-frame-title)
(add-hook 'org-clock-out-hook 'clock-in-frame-title)
(add-hook 'org-clock-cancel-hook 'clock-in-frame-title)

Any comments? Is run-at-time the best thing to use here?  Note that I
use the Pomodoro method and use the code to start the Pomodoro that was
posted to this list previously: http://orgmode.org/worg/org-gtd-etc.html

Borbus.