You are not logged in.
Noteo 0.1.0 - a notifications system
Get it while it's hot: http://aur.archlinux.org/packages.php?ID=15952
or googlecode url: http://noteo.googlecode.com
I've finally recoded noteo, and now present version 0.1.0. It's now much nicer internally, and uses an event based system rather than relying on gtk timers.
Noteo can poll/check/monitor multiple things, and message you when something happens in multiple ways. This is done through multiple modules, which can be enabled/disabled/configured independently.
Modules are really easy to code - noteo is written in python, and making a new module is just a matter of subclassing NoteoModule. I hope some of you'll contribute your own modules.
Current modules include:
GmailCheck: checks (multiple) gmail accounts for new messages
Notify: acts as a replacement for notification-daemon, allowing noteo to receive all libnotify messages (i.e. from notify-send)
StatusIcon: provides a system tray icon and a menu (modules can designate actions to be added to a menu)
BatteryCheck: checks a laptop battery and warns when the battery reaches certain percentages.
Dmesg: polls for dmesgs
MPD: notifies of song changes, with artist - song title
Xmms2: notifies of song changes, with artist - song title
DirectoryWatcher: watches multiple directories, and notifies when files are added/removed
Awesome: outputs notifications to the awesome status bar
Popup: notifies you in the form of a popup-balloon-type thing. This can be in any screen corner.
Configuration:
After being run once, each module writes a default config file to ~/.config/noteo/[module-name]
Edit these config files and restart noteo for the changes to take effect.
Making new modules:
example of a module - Dmesg
important parts:
class Dmesg(NoteoModule)
...
...
module = Dmesg
Creates the module named Dmesg by extending from NoteoModule, then allows the module to be used, by setting the global variable module.
config_spec = {
'pollInterval': 'float(default=10)',
}
Noteo modules use configobj for configuration. Specify each config option in the config_spec. Config files will be automatically loaded/parsed, and config options made available as a dictionary - e.g. self.config['pollInterval']
The init() method is called automatically after the module has been loaded/configured etc. Put initialisation code here.
Events:
NotificationEvent(
self.noteo, #always pass the noteo instance - the main class
0, #the time before the notification is due - i.e. if you want a notification to appear in 10 seconds time - set to 10
"New Dmesg", #summary
message, #the message body - can contain pango markup (though I haven't yet decided exactly what markup should be allowed
'dialog-warning' #the icon to use - can be a gtk icon name, a file path or a gtk pixbuf
)
Another event seen in the code is the RecurringFunctionCallEvent which does what it says in the name - calls a function every so many seconds.
For other events look in the main Noteo.py code, though these two are the most important for 'input' modules.
I'll add how to make output modules (those which give output to the user) at some other time, or just take a look at the Popup or Awesome modules.
import commands
from Noteo import *
class Dmesg(NoteoModule):
config_spec = {
'pollInterval': 'float(default=10)',
}
def init(self):
self.data = self.get_items()
self.check_event = RecurringFunctionCallEvent(self.noteo,
self.check,
self.config['pollInterval']
)
self.noteo.add_event_to_queue(self.check_event)
def get_items(self):
return commands.getoutput("dmesg | tail").split("\n")
def check(self):
messages = self.get_items()
notifications = []
for message in messages:
if message not in self.data:
notifications.append(NotificationEvent(
self.noteo,
0,
"New Dmesg",
message,
'dialog-warning'
))
self.noteo.add_events_to_queue(notifications)
self.data = messages
return True
module = Dmesg
Last edited by bavardage (2008-12-12 19:56:53)
blog - github - facebook - google profile
Offline
Can we have a module for new archbooks additions?
[git] | [AURpkgs] | [arch-games]
Offline
Har har har.
Sure Daenyth sure... just as soon as I get round to making archbooks.
blog - github - facebook - google profile
Offline
why not use libnotify, i think it will look better
Offline
If someone writes a general purpose imap checker (not gmail specific), he'll get a beer
Mortuus in anima, curam gero cutis
Offline
If someone writes a general purpose imap checker (not gmail specific), he'll get a beer
hi,
i've written an imap checker as an openbox pipe-menu some time ago.
one can take the imap check function and use it for noteo. perhaps i'll rewrite it myself when i have more time.
here it is: http://www.nakamura-gebiet.de/scripts/checkmail.tar.bz2
vlad
Offline
@jarryson: you mean "why not use notification daemon which will probably look better", since notification-daemon is the program that actually produces the pop-ups, but gets the events from libnotify, as does noteo.
Although I admit the popups created by notification-daemon look better in some respects, firstly: noteo's appearance can be improved (e.g. I plan to add options for transparency - this can be done very trivially) and noteo enables you to get output from libnotify in multiple ways (again, at the moment it's only popups and another way if you use awesome window manager but I plan to add options for output to file (to be displayed in whatever way you want with top), output to stdout and am open to suggestions for new ways of output)
@DonVla: I'll take a look at your script this evening.
blog - github - facebook - google profile
Offline
Updates:
- have bodged together an IMAPChecker module, though didn't understand DonVla's script enough to add output of subjects of new messages, only that new messages exist
- have added the option of transparency for popups, have tested this under awesome+xcompmgr, but have no idea about other setups.
Screenshot of transparency:
blog - github - facebook - google profile
Offline
- have added the option of transparency for popups, have tested this under awesome+xcompmgr, but have no idea about other setups.
Works with openbox+xcompmgr.
I prefer noteo to the two notification-daemons, as noteo actually obeys the chosen gtk theme. However, the popup sizes are not necessarily uniform, so I changed the "popup.set_default_size(200, 50)" value in Popup.py to 300. But I guess if the message goes over that, the popup will end up too wide again.
Gnome:
1. A legendary being.
2. A never ending quest to make unix friendly to people who don't want unix and excruciating for those that do.
Offline
Yeah I know that's an issue. I'm not honestly sure how to fix this, so any suggestions welcome.
Maybe I'll manage to fix it tonight or saturday, but if not, it'll have to wait till thursday, since I'm at a university interview from sunday till wednesday...
blog - github - facebook - google profile
Offline
Well I have some ideas on that front. Have it configurable so that a user can choose between:
- Notification is totally fixed size. If the message is larger, show the start and a '...', and have clicking on the notification bring up a new window with the full message.
- Fixed width. Lines are wrapped and the notification expands vertically.
- Fixed hight. Notification expands horizontally. Possibly stripping \n characters.
FWIW, I would use fixed width if you went with only one.
[git] | [AURpkgs] | [arch-games]
Offline
I seem to have achieved fixed width, so expect AUR update soon.
blog - github - facebook - google profile
Offline
I'm now away till thursday (university interviews aaaaahh) so any queries/problems will have to wait till then.
blog - github - facebook - google profile
Offline
Hi,
after the update I can't use noteo. I noticed that there is a new config file now. Mine looks like this:
localmodules = "",
threadGTK = True
modules = StatusIcon, Popup, BatteryCheck
debugLevel = 30
I only need noteo for the battery status and when I start it from terminal I get the icon but only have the option to close noteo. The ouptput says:
logging initialised for debug level 30
ERROR:root:Errors occured when importing the module
ERROR:root:The error were: (<type 'exceptions.ValueError'>, ValueError('Empty module name',), <traceback object at 0x9993784>)
What do I have to adjust for the new version?
Thanks
Offline
Think of this not as exactly an update, but more of a new program that does pretty much what the old one does.
The errors you see are unimportant - they are just telling you that there is no module without a name (it's trying to load all localmodules specified in the config, of which there are none) but this doesn't hurt at all (although I'll fix this pointless error message at some point).
What do you mean by you "can't use noteo" - it should still report when the battery is low/critical, it's just there is no longer a menu item for showing current status. Perhaps I should add a menu option to do this? (It would be trivial) Perhaps a module which instead of reporting when battery is low or critical, just tells you the %age remaining every [specified interval].
To check that it's working as it is, pull out the AC power, leave it for a minute or two, then plug it back in - in a short while (perhaps as long as a minute - depending on what you set pollInterval to in ~/.config/noteo/BatteryCheck) you should see a notification saying something along the lines of "AC power is plugged in"
blog - github - facebook - google profile
Offline
Hi bavardage,
thanks for your explanation. I had the "old" version in mind with that I could take a look at the current battery status all the time.
Additional to the remaining % it would be nice if it could tell me the estimated time left.
Offline
Ooh nice idea. I'll try and implement that.
Also, I have now added the menu option to report current battery status. How about a feature that reports the battery status every x minutes or something.
blog - github - facebook - google profile
Offline
Hi bavardage,
What is the advantage of noteo against notify-send?
I'm looking for a notification program to my acpi-eeepc-generic (http://code.google.com/p/acpi-eeepc-generic/) ACPI events scripts for the Asus EeePC line.
Right now the default is to use notify-send. I have an option for knotify, dzen2 or none, but on my machine I only use notify-send. And sometimes it just stop responding...
How fast is noteo? Does it need dbus? I want the fastest possible OSD... I suspect the multiple intermediates of libnotify to slow things down here.
Offline
Using Noteo purely as a libnotify client (although it does a lot more than this - libnotify functionality is only one part) and using the Popup output module (again, it can output in other ways) the main difference would be that the popups will follow your gtk theme. Performance wise - not sure - I've never compared.
In short, Noteo can act as a libnotify client (i.e. a replacement for notification daemon) through using the Notify module. Since libnotify uses dbus, to receive these events, noteo also uses dbus. Since noteo is modular however, depending on your level of python-fu, you could probably write a noteo module to interface with the acpi-eeepc-generic script..
In short, I'm not really sure what the advantages are. I'd just try it out.
blog - github - facebook - google profile
Offline
Ok thanx
I want to bypass any dependencies for an OSD: no dbus, instant on OSD. So what I want is basically what notification-daemon does (the osd) but being able to call it directly, without passing through a client, like notify-send.
I just found out that the OSD does not work when an application is fullscreen, even if you are working on another workspace... grrr I lost an hour on that :S
Maybe I'll check if I can interface noteo in acpi-eeepc-generic latter. It's not difficult. Here is what I did for libnotfy:
function eeepc_notify {
if [ "$NOTIFY" == "libnotify" ]; then
send_libnotify "$1" "$2" "$3"
elif [ "$NOTIFY" == "kdialog" ]; then
send_kdialog "$1" "$2" "$3"
elif [ "$NOTIFY" == "dzen" ]; then
send_dzen "$1" "$2" "$3"
fi
logger "EeePC $EEEPC_MODEL: $1 ($2)"
}
function send_libnotify() {
if [ ! -e /usr/bin/notify-send ]; then
logger "To use libnotify's OSD, please install 'notification-daemon'"
echo "To use libnotify's OSD, please install 'notification-daemon'"
return 1
fi
duration=$3
[ "x$duration" == "x" ] && duration="1500"
cmd="/usr/bin/notify-send -i $2 -t $duration \"EeePC $EEEPC_MODEL\" \"$1\""
send_generic "${cmd}"
}
function send_generic() {
if [ "x$UID" == "x0" ]; then
/bin/su $user --login -c "${@}"
else
bash -c "${@}"
fi
}
Offline
Hello.
Have installed Noteo. What is needed to get the battery notification to work?
My Noteo file:
localmodules = "",
modules = BatteryCheck, Popup
debugLevel = 30
My BatteryCheck file:
criticalPercentage = 10
lowPercentage = 5
pollInterval = 60.0
Is this all?
Getting the following output when I run noteo
# noteo
running noteo...
logging initialised for debug level 30
WARNING:root:The low percentage is lower than critical percentage - swapping
ERROR:root:Errors occured when importing the module BatteryCheck
ERROR:root:The error were: (<type 'exceptions.AttributeError'>, AttributeError("NoteoConfig instance has no attribute '__setitem__'",), <traceback object at 0xbee200>)
Last edited by orjanp (2009-03-25 11:34:46)
Ørjan Pettersen
Offline
Low percentage should be higher than critical percentage.
The program is supposed to cope with this and swap them around, but there's a bug there. Putting:
criticalPercentage = 5
lowPercentage = 10
should sort it out.
blog - github - facebook - google profile
Offline
Yes I discovered it. But I don't get any warning. Do I need some kind of tray running?
Ørjan Pettersen
Offline
more info on running this please? say I want to set it up to run the gmail plugin - what do I do?
You can like linux without becoming a fanatic!
Offline