You are not logged in.
Is there a way to have more recent notifications override older notifications of the same urgency? For example, I use a little script bound to my volume keys to adjust volume, and have a notification sent for each press. So if I press 5 or 6 times, I get notified for each. Is there a way to just see the most recent one?
Thanks!
Scott
Last edited by firecat53 (2010-11-03 20:36:53)
Offline
I think it is best use a programming language for this.
There is examples of doing this with notify-osd:
https://wiki.ubuntu.com/NotificationDev … Guidelines
They are also in source of notify-osd.
What I did for showing bars with oss:
Bash script I call, if not showing bars, shows it.
oss_control
#!/bin/sh
SERVICE='oss_vol'
if ps -A | grep -v grep | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, do nothing"
else
echo "$SERVICE is not running!" | oss_vol
fi
Python Script for manipulating bars:
oss_vol
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
import time
import datetime
import pynotify
import procname
procname.setprocname('oss_vol')
class Bars(object):
def __init__(self):
self.num_bars = self.get_num_bars()
self.last_update = datetime.datetime.now()
def __str__(self):
return self.get_bars()
def get_num_bars(self):
vol = os.popen('ossmix vmix0-outvol').read()
vol = vol.split(' ')
vol = vol[-2]
vol = int(float(vol))
return (vol*17)/25
def get_bars(self):
if self.num_bars != self.get_num_bars():
self.num_bars = self.get_num_bars()
self.last_update = datetime.datetime.now()
return '❚'* self.get_num_bars() + '➤'
pynotify.init("oss_vol")
bars = Bars()
n = pynotify.Notification(str(bars))
n.show()
while True:
if (datetime.datetime.now() - bars.last_update) > datetime.timedelta(0,1):
break
n.update(str(bars))
n.show()
Call thought xmonad:
"ossvol -i && oss_control" to increase sound.
"ossvol -d && oss_control" to decrease sound.
Not best solution, the script could be a lot better, and faster.
Offline
Hmm, I'll have to give that a try when I get a chance. I was trying to just use libnotify and statnot to minimize the number of different notification scripts that I needed to run. I do recognize that some functionality may not be available this way, which was the purpose of my original question -- trying to squeeze the max function out of minimalist programs
Thanks for the input!
Scott
Edit: Solved, sort of. The statnot author released an update that allows notifications to __not__ be queued like normal. This basically gets the result I want.
Last edited by firecat53 (2010-11-03 20:36:29)
Offline