Re: [dwm] Notifications

2008-09-30 Thread bill lam
On Mon, 29 Sep 2008, Carlos Pita wrote:

> > How about using dzen[1]?
> 
> I didn't know about it, thanks for the advice.
> 
> I've wrote a simple bash script that takes care of wrapping long lines
> and dynamically adjust the notification window width according to the
> longest line and the current font (using the provided textwidth
> utility). Maybe someone else will find it useful.

Thank you for sharing.

OT, is Carlos your family name?  I'm not quite sure the order of
family name and given name, some great soccer players also called
Carlos.

-- 
regards,

GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3



Re: [dwm] Notifications

2008-09-30 Thread Premysl Hruby
On (29/09/08 17:18), Carlos Pita wrote:
> To: dwm@suckless.org
> From: Carlos Pita <[EMAIL PROTECTED]>
> Subject: [dwm] Notifications
> Reply-To: dwm mail list 
> List-Id: dwm mail list 
> 
> Hi,
> 
> I use irssi+bitlbee to cover all my im/irc needs. Up til now my window
> manager was ratpoison and I had programmed a simple perl hook which
> output the incoming message to ratpoison's status bar. This bar is
> normally hidden and only shows up when the echo command is called,
> overlayed above the current window.
> 
> As I prefer to keep dwm bar hidden by default, I'm not able to see the
> urgent flag mark that dwm sets on the tag list. So I tried to figure
> out a way to be notified without permanently wasting the top bar
> pixels. I came up to two different solutions:
> 
> 1) toggle the bar visible if urgent hint is set for any client.
> 
> 2) hack manage() to show (g)xmessages floating bottom right without
> stealing focus.
> 
> I'd implemented both variants with relative ease. I think I'll keep
> the first one as it's the most spartan and requires less changes.
> 
> What do you think? Anyone had the same problem and came to a different 
> solution?
> 
> Regards
> -Carlos
> 

For notifications I heavily use urgency wm hint. It's setup is terminal
dependent, in (u)rxvt it's as easy as 

Rxvt.urgentOnBell: true

into your .Xresources. The second step is to setup irssi to beep on
hilight/query etc. This can be done with:

/set beep_msg_level NOTICE MSGS HILIGHT
/set beel_beeps OFF

and if you run irssi in screen (as I do, I connect to it via ssh) put
this into .screenrc:

vbell off
bell_msg 'Bell in window %n^G'

With this all, you can get easily notified by simple "beep" on terminal,
so mutt can notify you on new mail, lftp on download finished etc. etc.

-Ph

-- 
Premysl "Anydot" Hruby, http://www.redrum.cz/



Re: [dwm] Notifications

2008-09-29 Thread Carlos Pita
> I've wrote a simple bash script that takes care of wrapping long lines

I think I should  have given an example of its intended usage:

notify "Martin says:" "I'm going home now, I will give you a call later, cyl!"

The second parameter will be wrapped. The popup will appear
uncollapsed (both title and body lines visible), top-left and stay for
8 seconds. These are the defaults, which can be easily changed by
tweaking the code.

Regards
-Carlos


> #!/bin/sh
>
> FONT=-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*
> WIDTH=40
> COLORS="-bg black -fg red"
> SCREEN_WIDTH=1280
> TIMEOUT=8
>
> if [[ -z $1 ]]
> then
>echo "Usage: notify title_line [other_line...]"
>exit 1
> fi
>
> pkill dzen2 # kill previous notification
> text=$1
> if [[ -n $2 ]]
> then
>body=`echo $2 | fold -s -w $WIDTH`
>text="$text
> $body"
> fi
> lm=(`echo "$text" | awk -v font=$FONT 'BEGIN { max = 0; } {
> ("textwidth " font " \"" $0 "\"") | getline cur; if (cur > max) { max
> = cur } } END { print (NR-1) " " (max+20) }'`)
> if ((lm[0] > 0))
> then
>larg="-l ${lm[0]}"
> fi
> warg="-w ${lm[1]}"
> xarg="-x $((SCREEN_WIDTH - lm[1]))"
> echo "$text" | dzen2 -p $TIMEOUT $xarg -y 0 $warg $larg -bg black -fg
> red -fn $FONT -e "onstart=uncollapse;button3=exit"&
>
> exit 0
>
>
> Regards
> -Carlos
>



Re: [dwm] Notifications

2008-09-29 Thread Carlos Pita
> How about using dzen[1]?

I didn't know about it, thanks for the advice.

I've wrote a simple bash script that takes care of wrapping long lines
and dynamically adjust the notification window width according to the
longest line and the current font (using the provided textwidth
utility). Maybe someone else will find it useful.

#!/bin/sh

FONT=-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*
WIDTH=40
COLORS="-bg black -fg red"
SCREEN_WIDTH=1280
TIMEOUT=8

if [[ -z $1 ]]
then
echo "Usage: notify title_line [other_line...]"
exit 1
fi

pkill dzen2 # kill previous notification
text=$1
if [[ -n $2 ]]
then
body=`echo $2 | fold -s -w $WIDTH`
text="$text
$body"
fi
lm=(`echo "$text" | awk -v font=$FONT 'BEGIN { max = 0; } {
("textwidth " font " \"" $0 "\"") | getline cur; if (cur > max) { max
= cur } } END { print (NR-1) " " (max+20) }'`)
if ((lm[0] > 0))
then
larg="-l ${lm[0]}"
fi
warg="-w ${lm[1]}"
xarg="-x $((SCREEN_WIDTH - lm[1]))"
echo "$text" | dzen2 -p $TIMEOUT $xarg -y 0 $warg $larg -bg black -fg
red -fn $FONT -e "onstart=uncollapse;button3=exit"&

exit 0


Regards
-Carlos



Re: [dwm] Notifications

2008-09-29 Thread Antoni Grzymala
Carlos Pita dixit (2008-09-29, 17:18):

> pixels. I came up to two different solutions:
> 
> 1) toggle the bar visible if urgent hint is set for any client.
> 
> 2) hack manage() to show (g)xmessages floating bottom right without
> stealing focus.
> 
> I'd implemented both variants with relative ease. I think I'll keep
> the first one as it's the most spartan and requires less changes.
> 
> What do you think? Anyone had the same problem and came to a different 
> solution?

How about using dzen[1]?

[1]http://gotmor.googlepages.com/dzen

-- 
[a]


signature.asc
Description: Digital signature


[dwm] Notifications

2008-09-29 Thread Carlos Pita
Hi,

I use irssi+bitlbee to cover all my im/irc needs. Up til now my window
manager was ratpoison and I had programmed a simple perl hook which
output the incoming message to ratpoison's status bar. This bar is
normally hidden and only shows up when the echo command is called,
overlayed above the current window.

As I prefer to keep dwm bar hidden by default, I'm not able to see the
urgent flag mark that dwm sets on the tag list. So I tried to figure
out a way to be notified without permanently wasting the top bar
pixels. I came up to two different solutions:

1) toggle the bar visible if urgent hint is set for any client.

2) hack manage() to show (g)xmessages floating bottom right without
stealing focus.

I'd implemented both variants with relative ease. I think I'll keep
the first one as it's the most spartan and requires less changes.

What do you think? Anyone had the same problem and came to a different solution?

Regards
-Carlos