You are not logged in.

#26 2010-02-17 05:30:25

Emit
Member
Registered: 2009-02-15
Posts: 1

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

BetterLeftUnsaid wrote:

Here it is with a notification.  I have notifications for volume change, download completions, and other misc. stuff.
<screenshot>

sorry for going off topic but what is the name of that beautiful font?

(op: awesome script btw)

Offline

#27 2010-02-17 05:46:06

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Emit wrote:

sorry for going off topic but what is the name of that beautiful font?

Looks like Envy Code R to me...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#28 2010-02-17 07:56:50

BetterLeftUnsaid
Member
From: My Happy Place
Registered: 2007-11-04
Posts: 78

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Emit wrote:
BetterLeftUnsaid wrote:

Here it is with a notification.  I have notifications for volume change, download completions, and other misc. stuff.
<screenshot>

sorry for going off topic but what is the name of that beautiful font?

Terminal font is Terminus, the font in the bottom and title bar is Cure, part of the artwiz-fonts package

Last edited by BetterLeftUnsaid (2010-02-17 07:58:01)

Offline

#29 2010-03-14 14:18:47

dauerbaustelle
Member
Registered: 2010-02-07
Posts: 62

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Apparently statnot doesn't work for me. I don't get any notifications printed when I send some using notify-send. I'm using the AUR version. I don't have notification-daemon installed.

Offline

#30 2010-03-15 00:23:32

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

I think it would be better if statnot just printed its output to stdout. It would make it suitable for other uses without modifying the source, for instance in dzen or dvtm's status bar.

Then, to get it to work in dwm, just pipe it to a script like this:

#!/bin/sh

while read -r LINE; do
    xsetroot -name "$LINE"
done

Assuming it's named dwmstatus:

statnot | dwmstatus

By the way, I'm writing a similar program that should be done pretty soon. Instead of using libnotify though, it uses a file directory similar to the way wmii handles its status bar. Then you have a separate application to feed it libnotify stuff...

Last edited by fflarex (2010-03-16 02:54:28)

Offline

#31 2010-03-25 05:56:55

decibelmute
Member
From: ~/
Registered: 2009-11-27
Posts: 12
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

I've changed statnot's update_text function to a simple "print text," in hopes of being able to pipe the output into wmii's statusbar, via something like

statnot | while read -r LINE; do
  wmiir xwrite /rbar/status "$LINE"
done

However, even though "statnot" prints the messages normally when run by itself, for some reason, the output is entirely unpipeable. Even running "statnot | cat" does nothing. I've also tried using

subprocess.call(["wmiir", "xwrite", "/rbar/status", text])

inside update_text, but this also produces an empty status bar.

Any ideas on this issue? Is this a bug, or am I doing something wrong here?

Edit: I was being stupid and didn't have it set up right in wmiirc tongue it's fixed and works fine now

Last edited by decibelmute (2010-03-27 23:14:15)

Offline

#32 2010-03-25 17:28:40

ScottKidder
Member
Registered: 2008-10-27
Posts: 23

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

I've ended up writing to a file and then reading from there with xmonad, and xmobar. Obviously not optimal, but it works.


archlinux|xmonad
++++++++++[>++++++++>+++++++>+++<<<-]>+++.>---.<----.+++++..>>++.<++++++++.--.-----..+.<--.

Offline

#33 2010-03-25 18:09:33

YamiFrankc
Member
From: Mexico
Registered: 2009-06-19
Posts: 177
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

This is great
And how this can be shown in dzen?

It looks like theres a server error, i cant edit this post until now :s

Last edited by YamiFrankc (2010-03-26 00:53:18)


Thanks and greetings.

Offline

#34 2010-07-13 17:07:35

SynrG
Member
Registered: 2010-07-13
Posts: 1

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

halhen wrote:

* Is this a project worth doing at all?

I can see such a thing being useful for my project, http://wiki.debian.org/DebianEeePC.  We've been recommending LXDE, particularly for the older, smaller netbooks like the original model 4G and have supported all models of Eee PC with an eeepc-acpi-scripts package that has its own kludged-together OSD using aosd_cat but not libnotify.  We're at the point where we'd like to rip this out and replace it with something better, probably using notify-send to generate the messages and therefore we want to know what to recommend to LXDE users or other users of plain WMs to receive and display the notifications.

* Is python OK or rewrite in e.g. C?

Rewriting in C seems better to keep dependencies light.  Dragging in the whole python stack is a bit excessive, though python is nice for prototyping.

* Anything else?

Would you be interested in hacking on https://wiki.ubuntu.com/NotifyOSD to reduce dependencies?  Maybe do without dbus, and replace gconf with some xdg config instead?  I know it's a different approach (not text-only) but it would be easier to drop in on top of *any* WM without having to integrate it, and would meet the "lightweight" criteria.

Ben

Offline

#35 2010-10-30 15:11:35

Sara
Member
From: USA
Registered: 2009-07-09
Posts: 219
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Thank you for this excellent piece of software! Had never imagined I would be able to get notifications in dwm... now, I wonder, how did I ever live without them? This has replaced conky for me big_smile.

Here's my .statusline.sh in case anyone is interested (there's probably a better way to get the memory data from ps_mem):

#!/bin/sh
battime=`~/.scripts/ibam.sh`
bat0=`acpi -b | awk -F " " 'NR==1 {print $4}' | tr -d ,`
bat1=`acpi -b | awk -F " " 'NR==2 {print $4}' | tr -d ,`
ram=`sudo ps_mem | awk -F "                        " '{print $2}' | sed '/^$/d'`
#uptime=`uptime | awk -F " " '{print $3}' | tr -d ,`
time=`date +%H:%M`
echo "BATT ["$bat0"] ["$bat1"] ["$battime"] RAM ["$ram"] ALERTS [$1] "$time"";

I especially love seeing the sound changes from the status bar (I used to always fire up alsamixer just for a visual interface, but now, with statnot, this is not necessary), and I have cron jobs that print visual alerts into the status bar using the notify-send command (e.g. for new mail).


Registed Linux User 483618

Offline

#36 2010-10-30 15:24:56

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

And here's mine smile I'm using the statuscolors patch to highlight certain notifications (the \x01 and \x02 characters). Any chance statnot will be upgraded to use a configuration file?

Scott

#!/bin/sh
function netstatus {
eth=`ifconfig|grep eth0`
wlan=`ifconfig|grep wlan0`
status=`ping -qc1 google.com 2> /dev/null`
if [ -n "$status" ]; then
    if [ `ifconfig|grep wlan0|wc -l` -ne "0" ]; then
        link=wlan0;
    elif [ `ifconfig|grep eth0|wc -l` -ne "0" ]; then
        link=eth0;
    fi
else
    link=down;
fi
sshstatus=`ps aux|grep 'ssh -f'|wc -l`
if [ "$sshstatus" -ge 2 ]; then
    sshstatus='S'
else
    sshstatus='\x02S\x01'
fi
}

function netspeed {
#
# displays download / upload speed by checking the /proc/net/dev with
# 2 second delay
#
netstatus
if [ "$link" == "down" ]; then
    echo -e "\x02Network Down\x01"
    exit 1
fi

old_state=$(cat /proc/net/dev | grep ${link})
sleep 1
new_state=$(cat /proc/net/dev | grep ${link})

old_dn=`echo ${old_state/*:/} | awk -F " " '{ print $1 }'`
new_dn=`echo ${new_state/*:/} | awk -F " " '{ print $1 }'`
dnload=$((${new_dn} - ${old_dn}))

old_up=`echo ${old_state/*:/} | awk -F " " '{ print $9 }'`
new_up=`echo ${new_state/*:/} | awk -F " " '{ print $9 }'`
upload=$((${new_up} - ${old_up}))

d_speed=$(echo "scale=0;${dnload}/1024" | bc -lq)
u_speed=$(echo "scale=0;${upload}/1024" | bc -lq)

echo -e -${d_speed}k +${u_speed}k "$sshstatus"
}

function topproc {
    echo "`ps -e -o pcpu,args --sort pcpu | tail -1| sed 's/\/.*\///g' |awk '{print $2" "$1}'`"
}

function memory {
    USED=`free -m | awk '$1 ~ /^-/ {print $3}'`
    TOTAL=`free -m | awk '$1 ~ /^Mem/ {print $2}'`
    echo "100*$USED/$TOTAL" | bc
}

function diskuse {   ## Usage - diskuse {mount point}
    USED=`df -hP|grep $1|awk '{print $5}'|sed 's/\%//'`
    echo "$USED"
}

function mailcount {
    m=`ls ~/mail/INBOX/new|wc -l`
    if [ "$m" == "0" ]; then
        echo "::"
    else
        echo -e ":: \x02Mail\x01::"
    fi
}
function weather { ## Only print .weather if network is up. Weather.sh is run by cron
netstatus

if [  "$link" == "down" ]; then
    echo "Weather N/A"
    exit 1
else
    cat ~/.weather|head -1
fi

}    
function batt {
    perc=`acpi | awk '{print $4}'|sed 's/,//'`
    state=`acpi | awk '{print $3}'`
    if [ "$state" = "Discharging," ]; then
        echo -e "\x02$perc\x01"
    else
        echo "$perc"
    fi
}

function music {  ## Print currently playing artist
    tmp=`mpc |grep "\[playing\]" | wc -l`
    if [ "$tmp" == "1" ]; then
        vis=`mpc current | awk -F "-" '{print $1}'`
        echo ":: $vis"
    fi
}

function date_mute {  # Print Date, Time. Highlight it all if volume is muted
    d=`date +'%a %d %b %H:%M'`
    dm=`date +'%H:%M'`
    vol=`amixer|head -n6|tail -n1|awk '{print $7}'`
    if [ "$vol" = "[off]" ]; then
        echo -e "\x02--Mute--\x01 $dm"
    else
        echo "$d"
    fi
}
if [ $# -eq 0 ]; then
    echo " $(topproc) $(music):: $(netspeed):: M $(memory) :: / $(diskuse `mount |grep ' / '|awk '{print $1}'|sed -e 's/\/dev\///'`) :: $(batt)$(mailcount) $(weather):: $(date_mute) ::"
else
    echo -e " $(topproc) $(music):: $(netspeed):: M $(memory) :: / $(diskuse `mount |grep ' / '|awk '{print $1}'|sed -e 's/\/dev\///'`) :: $(batt)$(mailcount) $(weather):: \x02$1\x01 ::"
 fi

Offline

#37 2010-10-30 20:28:22

halhen
Member
From: Gothenburg, Sweden
Registered: 2009-04-08
Posts: 56
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

I'm happy some keep using this old sin of mine! I got inspired enough to write 0.0.3 - only a year and a half after 0.0.2. Changes:

* Support for configuration (see statnot -h or http://code.k2h.se/statnot.html , section Configuration)
* Fixed PKGBUILD, so python2 is used

If you hacked the old statnot file to configure, your changes will be lost. Sorry.


statnot - status text manager and notification-daemon for dwm, wmii and the like
shic - SHellscript Irc Client

Offline

#38 2010-11-02 15:27:39

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Cool thanks for the update! Using it here and it works great. I think this is more of a libnotify question that I asked in a different thread, but maybe you know...is there a way to override an older notification of the same urgency with a newer notification. For example, when changing volume and displaying it with notify-send into the dwm status bar with statnot, each push of the vol up/down button sends the notification, which stays for it's alloted 3 seconds before displaying the next volume level. So if I hit vol-down like 6 times in a row, I get, well, 6 3 second notifications. Any way to hack that to only see the last one? Hope I'm making sense!

Thanks!
Scott

Offline

#39 2010-11-02 15:32:00

Sara
Member
From: USA
Registered: 2009-07-09
Posts: 219
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

firecat53 wrote:

Cool thanks for the update! Using it here and it works great. I think this is more of a libnotify question that I asked in a different thread, but maybe you know...is there a way to override an older notification of the same urgency with a newer notification. For example, when changing volume and displaying it with notify-send into the dwm status bar with statnot, each push of the vol up/down button sends the notification, which stays for it's alloted 3 seconds before displaying the next volume level. So if I hit vol-down like 6 times in a row, I get, well, 6 3 second notifications. Any way to hack that to only see the last one? Hope I'm making sense!

Thanks!
Scott

Actually, he's posted a solution for this at his website. Here's the pertinent stuff:

notify-send can also be used for other, more direct messages. For exampe, I call a script called dwm-volume when my volume media buttons on the keyboard are pressed. This script adjusts the volume and sends a notification containing e.g. vol [52%] [on].

#!/bin/sh
 if [ $# -eq 1 ]; then
     amixer -q set Master $1
 fi
 notify-send -t 0 "`amixer get Master | awk 'NR==5 {print "vol " $4, $6}'`"

As you can see, I use the option -t 0 to notify-send, i.e. I request that the notification should show for zero milliseconds. For statnot, this means that the message should show for a regular status tick, by default two seconds, but if other notifications arrive, like a second press on the volume button, it goes away. This setup allows my audio volume to show only when I change it, while it updates instantly when I press the media buttons.

So in short, if you do

notify-send -t 0

you'll get the desired effect. Happily, not hackish at all smile.

Last edited by Sara (2010-11-02 15:32:49)


Registed Linux User 483618

Offline

#40 2010-11-02 15:48:43

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,537

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Sara wrote:

So in short, if you do

notify-send -t 0

you'll get the desired effect. Happily, not hackish at all smile.

I just tried this and found that the notifications NEVER timed out and stayed up on the screen forever until closed

Online

#41 2010-11-02 17:00:47

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

@Sara -- ah, thanks! That actually works quite well for the volume control. However... smile

I'm still playing with my weechat notifications -- I have them stay in the status bar for longer: about a minute, so this trick of setting -t0 doesn't work. It would be ideal for the most recent notification to supersede the existing one.

Scott

Offline

#42 2010-11-02 20:34:45

halhen
Member
From: Gothenburg, Sweden
Registered: 2009-04-08
Posts: 56
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

skunktrader wrote:
Sara wrote:

So in short, if you do

notify-send -t 0

you'll get the desired effect. Happily, not hackish at all smile.

I just tried this and found that the notifications NEVER timed out and stayed up on the screen forever until closed

Really? And the regular updates are working when you dont try the -t 0 stuff?

Try

    # notify-send -t 5000 "five seconds"; notify-send -t 0 "should not see"; notify-send -t 0 "for a tick";'

You should see the "five seconds" for five seconds, next "for a tick" for two seconds, and then back to your normal statusbar.

I'm happy to take a look at your ~/.statusline.sh if you think another set of eyes can help.


statnot - status text manager and notification-daemon for dwm, wmii and the like
shic - SHellscript Irc Client

Offline

#43 2010-11-02 20:53:04

halhen
Member
From: Gothenburg, Sweden
Registered: 2009-04-08
Posts: 56
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

firecat53: Impressive statusline!

firecat53 wrote:

It would be ideal for the most recent notification to supersede the existing one.

That this is not the case, is by design. Notifications can come from many places at the same time and build a queue, where each one should show for a certain amount of time if it asks to. I can't think of a way to handle both queue-able notifications and lower priority ones at the same time without adding unproportional complexity. I could add a configuration option to ignore queueing and always show only the most recent one, for the amount of time it asks to be shown.

Example:

* 12:00:00 You receive a chat message that should show for 60 seconds.
* 12:00:15 You receive another message, which replaces the old and shows for 60 seconds
* 12:01:15 The regular status line shows

Example 2:

* 12:00:00 You receive a chat message that should show for 60 seconds
* 12:00:02 A volume update comes along with -t 0, and replaces the chat message
* 12:00:04 The regular status line shows

Would that be useful to you?


statnot - status text manager and notification-daemon for dwm, wmii and the like
shic - SHellscript Irc Client

Offline

#44 2010-11-02 21:03:58

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

halhen: Thanks! Actually yes, that would be useful to me. Since my notification usage is pretty limited, that would actually be perfect for my workflow. If I'm playing with the volume, I'm going to see a notification sitting in the statusbar anyways, so it's ok to cancel it and show the volume notification.

Scott

Offline

#45 2010-11-03 18:14:13

halhen
Member
From: Gothenburg, Sweden
Registered: 2009-04-08
Posts: 56
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

There, a new version is in AUR.

To disable queueing, i.e. showing the most recent notification, configure as such:

QUEUE_NOTIFICATIONS=False

The project moved from my domain to github, so the few added lines of documentation is at http://github.com/halhen/statnot.

Let me know if I screwed up somewhere.


statnot - status text manager and notification-daemon for dwm, wmii and the like
shic - SHellscript Irc Client

Offline

#46 2010-11-03 18:47:21

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

The new QUEUE_NOTIFICATIONS=False works perfectly!  Thanks, man smile

Scott

Offline

#47 2011-06-09 10:52:36

Snark1994
Member
From: Wales
Registered: 2011-06-09
Posts: 30

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Hm, I found wmii a couple of days ago, and it didn't handle libnotify events (I use pidgin - there's a hackish way to view notifications, but I really wanted to use the "proper" libnotify way)

Anyway, the default way you use statnot has functionality which is duplicated in wmii, so I thought I might share my setup.

I launch statnot as:

statnot ~/.config/statnot/config.py & 

~/.config/statnot/config.py contains:

def update_text(text):
    import os
    file = open("%s/.config/statnot/notification" % os.getenv("HOME"),"w")
    file.write(text)
    file.close()

~/.statusline.sh contains:

if [ $# -ge 1 ]; then
    echo "NOTIFICATION: $1 | ";
fi

And somewhere in my wmiirc is:

status() {
    echo -n $(cat ~/.config/statnot/notification) 'Wireless' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality) '|' $(date)
}

So any notifications found by statnot are put at the start of the wmii status line.

Amazing script, saved me reinventing the wheel (again) big_smile


Snark1994

Offline

#48 2011-06-10 16:34:05

cyrusza
Member
From: Italy
Registered: 2011-05-18
Posts: 29
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Awesome tool. I found that it reacts bad to the clock adjusting, but i don't know if it can be called a "bug".

However i want to share my setup with 2 windows managers and 1 config file:

This is my statnot.conf

DEFAULT_NOTIFY_TIMEOUT = 5000 # milliseconds
MAX_NOTIFY_TIMEOUT = 7000 # milliseconds
NOTIFICATION_MAX_LENGTH = 100 # number of characters
STATUS_UPDATE_INTERVAL = 3.0 # seconds

# export WMNAME in ~/.xinitrc before the windows manager start
import os
STATUS_COMMAND = ['/bin/bash', '%(HOME)s/scripts/%(WMNAME)s/statnot-statusline.sh' % {'HOME': os.getenv('HOME'), 'WMNAME': os.getenv('WMNAME')}] 

USE_STATUSTEXT=True
QUEUE_NOTIFICATIONS=True

WMNAME needs to be exported in .xinitrc. My scripts are placed in $HOME/scripts/$WMNAME/statnot-statusline.sh

--------------------------

My statnot scripts are used in conjunction with dzen2. This is one of my statnot-statusline.sh script that plays well with dzen2 using a named pipe:

# Create the named pipe
[ ! -p /tmp/statnot ] && mkfifo /tmp/statnot

if [ $# -eq 0 ]; then
    # Get date
    date=$(echo "^fg(grey)"$(date '+%A %d %B %Y') ; echo "^fg(cyan)"$(date '+%H:%M'))

    # Echo results
    echo $date >> /tmp/statnot
else
    # Echo notification
    echo  "NOTIFICATION: $1" >> /tmp/statnot;
fi

Obviusly, dzen2 must be started somewhere like this:

tail -n1 -f /tmp/statnot | dzen2

Last edited by cyrusza (2011-06-10 16:35:51)

Offline

#49 2011-09-02 09:01:27

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Quick question: short of rewriting my status script, is there any way to get statusline.sh to work with bashisms like process substitution?


# edit: nvm: missed it in the conf file...

Last edited by jasonwryan (2011-09-02 09:20:06)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#50 2011-09-12 05:09:14

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Lightweight, text-only notification-daemon for dwm, wmii and the like

Anyone else seeing dropbox crash with statnot?

process 7632: Array or variant type requires that type string be written, but end_dict_entry was written.
The overall signature expected here was 'susssasa{ss}' and we are on byte 10 of that signature.
  D-Bus not built with -rdynamic so unable to print a backtrace

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB