You are not logged in.

#1 2009-04-13 00:36:10

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

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

Hi all,

I've spent the night putting together a prototype for a lightweight notification-daemon replacement targeting dwm and similar WMs (technically not a daemon yet, but it'll get there). The idea is to have a continously updating status message, like most of you have today. When a notification arrives, it should replace the status message for a given amount of time. Use cases: notification when email / IM arrives, show volume when adjusting it through media keys, new song in media player, etc

My prototype integrates with the regular dbus/Desktop Notifications that you probably know through libnotify and notify-send. The prototype is on github; see README for instructions. I probably should fiddle with it a bit more before letting it out there, but I'd like some feedback before continuing too far. (If you're really hot on commenting: it's getting really late in Sweden, so I'll be AFK for a while.).

Dependencies: python and python-notify.

Thanks in advance!
halhen

* Is this a project worth doing at all?
* How to manage quick, overriding messages cleanly, e.g. media button volume change? Is the current 0-time idea OK?
* Can update_text be modified easily for other WMs?
* Is calling a command and reading from stdout the preferred way of fetching status texts?
* Is python OK or rewrite in e.g. C?
* Anything else?

Last edited by halhen (2010-10-30 20:31:51)


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

Offline

#2 2009-04-13 12:21:12

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

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

Version 0.0.1 is out and in AUR as statnot. Installation instructions in README (exclude 'make install' if you install the AUR package).

I could use some help with the following:
* Testing, particulary with different libnotify-enabled applications. Does the format "<summary> <body>" work best?
* Code for how to update status message with other WMs (or any other use you can think of, e.g. email notifications?)
* Bug reports / any other comments

A good nights sleep gave some perspective. Maybe I shouldn't do a "proper" dbus-integration? The reason not to is that statnot runs just fine without it, and this way it does not mess with existing notification daemons. Also, to set the regular status message statnot must run in the background regardless if there is a notification.

My setup is:
* ~/.xinitrc
* ~/.statusline.sh
* ~/.dwm-run.sh
* volume.sh - bound to XF86XK_AudioRaiseVolume, XF86XK_AudioLowerVolume and XF86XK_AudioMute.

This gives me a status message like '[load 0.02 0.11 0.09] [mem 6.5%] [bat 100%]   14:18'. When I lower/raise/mute volume, it shows like 'vol [83%] [on]'. I've also tested it with Pidgin / pidgin-libnotify.

Please drop me a line or vote up package if you find statnot useful.

Last edited by halhen (2009-04-13 16:02:38)


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

Offline

#3 2009-04-13 16:33:03

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

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

I haven't had much time to play around with this yet (stupid Humanities class >.>), but so far I love it.

One quick thing - it appears dbus-python is a dependency as well.

Offline

#4 2009-04-13 17:24: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

BetterLeftUnsaid wrote:

I haven't had much time to play around with this yet (stupid Humanities class >.>), but so far I love it.

One quick thing - it appears dbus-python is a dependency as well.

Great! big_smile

You're absolutely right. I think the dependencies should be ('python' 'dbus-python' 'pygtk'). Let me know if I'm mistaken. A fix will be in next release / AUR-package.

Thanks a million.


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

Offline

#5 2009-04-13 20:08:53

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

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

halhen wrote:

I think the dependencies should be ('python' 'dbus-python' 'pygtk'). Let me know if I'm mistaken. A fix will be in next release / AUR-package.

This seems right to me.

* Is this a project worth doing at all?
Yep yep

* How to manage quick, overriding messages cleanly, e.g. media button volume change? Is the current 0-time idea OK?
I like the 0-time setup.  It makes it easy to get a quick notification across.  One thing I was thinking about was the option to append the notification text to the current status text instead of replacing it.  This way it gives the option to keep normal status stuff as well as a notification.  For example, I'd love to have my normal status text be:

[C: 1%  R: 8%]  [B: 96%  H: 81%]  [D: 0K  U: 0K]  [E: 0  U: 0]  []  [03.55]

But when a notification is received, change it to:

[C: 1%  R: 8%]  [B: 96%  H: 81%]  [D: 0K  U: 0K]  [E: 0  U: 0]  []  [03.55] [New Notification]

* Is calling a command and reading from stdout the preferred way of fetching status texts?
I like this as well.  It gives the ability to have an external script do whatever it wants/needs and then format the output itself before giving it to statnow

* Is python OK or rewrite in e.g. C?
I'm biased in that I use Python for almost everything tongue, but I think Python works well, and no rewrite necessary.

* Anything else?
I think a full dbus integration is good.  However, I didn't have any other notification daemon previously, so the current dbus integration doesn't conflict with anything for me.  And considering that this is for lightweight WM's, I think there's a good chance that other people aren't going to have a notification daemon as well.


So far I haven't found any bugs, but I haven't tried much with libnotify apps yet.

Last edited by BetterLeftUnsaid (2009-04-13 20:22:28)

Offline

#6 2009-04-13 22:28:28

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

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

BetterLeftUnsaid wrote:

One thing I was thinking about was the option to append the notification text to the current status text instead of replacing it.  This way it gives the option to keep normal status stuff as well as a notification.  For example, I'd love to have my normal status text be:

[C: 1%  R: 8%]  [B: 96%  H: 81%]  [D: 0K  U: 0K]  [E: 0  U: 0]  []  [03.55]

But when a notification is received, change it to:

[C: 1%  R: 8%]  [B: 96%  H: 81%]  [D: 0K  U: 0K]  [E: 0  U: 0]  []  [03.55] [New Notification]

I like it. In fact, I like it so much I've added it and released 0.0.2 to AUR. Basically, the .statusline.sh script gets called both for regular status updates and for notification formatting. If $1 is present, it contains the notification message. An example .statusline.sh:

if [ $# -eq 0 ]; then
    loadavg="`cat /proc/loadavg | awk '{print $1, $2, $3}'`";
    echo "[load ${loadavg}]   `date +'%R'`";
else
    echo "NOTIFICATION: $1";
fi

This prints `[load 0.27 0.15 0.10]   12:25` by default and "NOTIFICATION: <text>" when a notification should show. Gotcha: check your .statusline.sh so you handle the $1 case, if notifications doesn't appear.

BetterLeftUnsaid wrote:

* Anything else?
I think a full dbus integration is good.  However, I didn't have any other notification daemon previously, so the current dbus integration doesn't conflict with anything for me.  And considering that this is for lightweight WM's, I think there's a good chance that other people aren't going to have a notification daemon as well.

If I'm correct, D-Bus starts the associated application when a notification is recieved. This application usually chooses to stay alive, but that should not be nescessary. If there is someone listening for the notifications, it receives them and no application is started.

statnot needs to run in background whether there is a notification or not (to update regular status messages). Waiting for D-Bus to start statnot doesn't make much sense, right?


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

Offline

#7 2009-04-13 22:36:30

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

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

0.0.2 is out. Changelog:

* Notification is passed to the status script for formatting. (see above or README)
* Corrected dependecies.

Shout-out to BetterLeftUnsaid for feedback.


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

Offline

#8 2009-04-13 23:06:25

droog
Member
Registered: 2004-11-18
Posts: 877

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

This looks pretty neat, I tried it yesterday but don't have any applications that use libnotify so i just sent myself some messages to my statusbar tongue
What applications are you guys using that make use of libnotify?
after a few searches i could only find transmission, pidgin and amarock, i only use transmission sometimes out of those.

/edit
nevermind i just thought to check the libnotify package and saw the 25 apps that require it.

Last edited by droog (2009-04-13 23:10:10)

Offline

#9 2009-04-14 01:24:32

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

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

droog wrote:

What applications are you guys using that make use of libnotify?

I had planned on using this mostly with weechat, as there is a libnotify plugin on their website.  Also, I think the volume-change notification would be nice to have as well.

@halhen
I don't think I fully understood the whole dbus process when I first wrote about it ... so it'd probably be best just to ignore anything I said about it hmm

And yays! Thanks for the ability to append the notification.  Now I can completely replace conky with this <3

Offline

#10 2009-04-14 06:23:12

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

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

droog wrote:

What applications are you guys using that make use of libnotify?

I started this project to get a clean way of updating the status bar with temporary messages, for example when changing volume. I decided to use a standard rather than to reinvent another wheel.

statnot hasn't been around long enough for me to integrate it everywhere, but I'll use it primarily through scripting (notify-send) for new mail / IMs, new packages that needs updating, to notify me when long running tasks - downloads / compiles / ... - finish, etc.

Last edited by halhen (2009-04-14 06:24:53)


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

Offline

#11 2009-04-16 21:06:20

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've written some documentation on how to use statnot and uploaded it to http://code.k2h.se/statnot.html. I'm looking for more creative uses for statnot, so please share if you have any cool tips. Also, let me know if you would like some features added.


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

Offline

#12 2009-11-05 11:45:15

splicer
Member
Registered: 2009-10-30
Posts: 11

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

I've been wanting something similar to this for pidgin notifications, but with some enhancements. I've always liked how MSN messenger worked - conversations generate flashing notifications on the toolbar until the conversation window gains focus. Unfortunately, (at least when running in dwm) Pidgin's DBus interface only seems to be able to notify you when messages are received, but not when the window gains focus. So I'm not sure how to implement it, or if it can be implemented at all. There's a signal for 'MessageDisplayed' but that gets called regardless whether the window is in focus or not.

Why this feature would be useful: 1) there are times when I'm busy working on something and don't switch to the conversation window immediately. Without a flashing reminder, I occasionally forget to reply. 2) If I go grab a snack, any libnotify popups that appeared in the meantime would have long since disappeared.

Does anyone have any ideas for workarounds?

Last edited by splicer (2009-11-05 11:52:00)

Offline

#13 2009-11-05 13:47:44

SamC
Member
From: Calgary
Registered: 2008-05-13
Posts: 611
Website

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

splicer: Pidgin can set urgency hints with the "Message Notification" plugin, which can be used to make taskbar windows flash.

Offline

#14 2009-11-05 15:05:39

ilembitov
Member
Registered: 2008-10-07
Posts: 124

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

I believe, since you're targeting DWM/WMII users, C would be much appreciated. And please, add some screenshots! Thanks for your great work, btw smile

Last edited by ilembitov (2009-11-05 15:08:14)

Offline

#15 2009-11-05 17:08:52

splicer
Member
Registered: 2009-10-30
Posts: 11

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

SamC: but dwm has no taskbars tongue (at least, not a conventional one.)

Though I suppose I could poke inside the source of that plugin, hmmm.

Last edited by splicer (2009-11-05 17:09:30)

Offline

#16 2009-11-05 19:45:13

SamC
Member
From: Calgary
Registered: 2008-05-13
Posts: 611
Website

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

Splicer: DWM will hilight the tage name if it has an urgent window on it.

Offline

#17 2010-01-22 18:49:12

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

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

This is awesome! I'm going to try this in a couple tiling window managers.


How's my programming? Call 1-800-DEV-NULL

Offline

#18 2010-02-08 09:16:27

cf8
Member
From: Russia
Registered: 2008-10-21
Posts: 83

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

Realy nice peace of code. Btw does anybody have an idea on how to make it work in wmii? smile

Offline

#19 2010-02-11 11:24:50

Zom
Member
From: Sweden
Registered: 2007-10-27
Posts: 430

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

I'm curious about this. Could we get a few screenshots showing it off?

Offline

#20 2010-02-11 17:05:06

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

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

Much thanks!  I've been hacking together something similar (but dumber) for cross WM notification, but your's is much nicer.  I find the always-on conky/awesome status meters to be really annoying and prefer to have notifications pop up when battery gets low, OOM approaches, etc.

Any chance it could also have a means of generating a system beep or sound play?

Offline

#21 2010-02-11 17:07:36

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

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

Zom wrote:

I'm curious about this. Could we get a few screenshots showing it off?

I use it in combination with dzen and i3, (statnot is providing everything in the bottom right of the bar)

tM2lzaA
Battery, currently playing artist/song, date and time.

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

I use a modified version of the code which doesn't use .statusline.sh and instead does all the text formatting and calling of dzen within statnot itself.  You can see it here.


@keenerd: I'm not too familiar with shell scripting, but couldn't you make your .statusline.sh check if the notification argument exists, and then call aplay or beep or something similar?

Last edited by BetterLeftUnsaid (2010-03-30 00:29:34)

Offline

#22 2010-02-12 04:30:52

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

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

I'm attempting to find the best possible way to make this work for xmonad with xmobar. My first idea was to have the update_text function write text to a file and then have xmobar cat the file when it needs to. I'm sure there's a better way to do this even if it involves making statnot not run in a loop and just run when called by xmobar. Any ideas?


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

Offline

#23 2010-02-12 11:56:31

kaptenen
Member
Registered: 2009-12-06
Posts: 287
Website

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

Looks very interesting, can it work in fluxbox in any way?

Offline

#24 2010-02-12 18:33:15

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

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

I ended up getting it work the way I described above. update_text opens a ~/.stat.txt and writes text to it. Then xmobar reads that file with:
', Run Com "cat" ["~/.stat.txt"] "stat" 10'. Awesome job halhen!


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

Offline

#25 2010-02-14 03:13:32

sdellysse
Member
Registered: 2009-12-15
Posts: 33

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

wow, I was actually about to try writing the same thing, except in ruby.

I haven't had a chance to try statnot yet, but glancing over it it looks very nice way of implementing notifications on dwm and the rest.

My only suggestion is the '.statusline.sh'. how would about '~/.config/statnot/statusline.sh'? i'm trying to get away from the polluted dotfile home directory, and while i realize that i can configure it that way, how about a bit saner default?

Offline

Board footer

Powered by FluxBB