ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] Displaying output of commands in the bar


From: Benno
Subject: [RP] Displaying output of commands in the bar
Date: Sun May 18 02:09:14 2003
User-agent: Mutt/1.4i

Hi all,

Haven't been actively following ratpoison dev for the last year
or so hopefully this hasn't been suggested before.

This patch adds an echo_exec command to ratpoison. The command
passed to echo_exec is executed with its stdout redirected to
the ratpoison bar.

Here are some lines from my .ratpoisonrc to show how it can 
be useful. (Note that you could achieve the same thing by 
doing something like: 
 bind <key> exec ratpoison -c "echo `<command>`"
However that forks a stupid amount of times and seems like
a bit of a hack to me.)

bind grave colon echo_exec 
bind Insert echo_exec cdcd info
bind u echo_exec uptime

Note that the time function can now be removed from ratpoison
and replaced with:

bind a echo_exec date

which opens up the whole world of being able to change the
format of the time string. (Just what you always wanted, right?)

Implementation notes:
It uses marked_message_printf() to display the output, which
previously used marked_message() to display things. Of course
marked_message() doesn't work so well for display strings that 
contains \t and \n, so I changed marked_message_printf to use
marked_wrapped_message() instead. This seems fine to me, since
marked_wrapped_message() seems to work fine for short strings as 
well.

(On a side note, does marked_message() even need to exist anymore?)

Bugs/TODO: 
* Display stderr as well as stdout.
* Be able to cancel the command.

Patch attached is against latest CVS.

Benno

Attachment: echo_exec.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]