You are not logged in.

#1 2011-02-21 20:05:32

Cloudef
Member
Registered: 2010-10-12
Posts: 636

cow-notify - customizable notification daemon

vOHY4bQ

cow-notify, fork from dwmstatus

Notification daemon that runs on background and executes configured command (If there isn't any executes xsetroot -name)

parses following tags:
[summary] - Replace with summary
[body]    - Replace with body
[expire]  - Replace with expiritation time (milliseconds)

By default there is no config file, if you want to execute custom command, then create this file :
$XDG_CONFIG_HOME/cow-notify/config and type command eg. "xcowsay --image myimage.png '[summary]' '[body]'"

I suggest making the config file read only for everyone expect you, so other users can't go and change it to something more dangerous.

!IMPORTANT! Execution

   if(!(sh = getenv("SHELL"))) sh = "/bin/sh";
   execlp(sh, sh, "-c", parsed, (char*)NULL);

Since it exectues shell, all shell rules also apply.
So make sure your [body] and [summary] are enclosed with single quotes, otherwise notify events can execute commands.

cow-notify escapes all single quote characters inside [body] and [summary], so you don't have to worry about those. However if you have shell that does not use single quotes for strong quoting then you might want to edit the source.

Issues :
	* Fails to reply on some python programs (?)

https://github.com/Cloudef/cow-notify # Github
https://aur.archlinux.org/packages.php?ID=52751 # AUR, thanks synorgy

Last edited by Cloudef (2011-11-29 19:00:31)

Offline

#2 2011-02-23 06:38:07

geoisis
Member
From: greece
Registered: 2007-09-02
Posts: 100
Website

Re: cow-notify - customizable notification daemon

nice smile


Archlinux x86_64 | post-engineering | last.fm

Offline

#3 2011-05-31 13:27:01

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: cow-notify - customizable notification daemon

Added some string formatting, nothing big.

Using it nowadays with my macopix fork, which has some animation control (mascot dances when I'm listening music from deadbeef)
Might drop the xcowsay default and use some system generic stuff instead.

vOHY4bQ

Example notify file using macopix

macopix --message '<[summary]> [body]' --message-expire [expire]

E: Make sure to use single quotes, to prevent code execution

Last edited by Cloudef (2011-07-30 10:52:29)

Offline

#4 2011-05-31 15:29:15

ArchArael
Member
Registered: 2005-06-14
Posts: 504

Re: cow-notify - customizable notification daemon

Cloudef wrote:

Added some string formatting, nothing big.

Using it nowadays with my macopix fork, which has some animation control (mascot dances when I'm listening music from deadbeef)
Might drop the xcowsay default and use some system generic stuff instead.

http://ompldr.org/vOHY4bQ

Example notify file using macopix

macopix --message "<[summary]> [body]" --message-expire [expire]

That's really cute. ^______^

How do I proceed to enable the mascot?

OT: I like your avatar.

Offline

#5 2011-05-31 16:31:11

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: cow-notify - customizable notification daemon

ArchArael wrote:

That's really cute. ^______^

How do I proceed to enable the mascot?

OT: I like your avatar.

You can either grab the original macopix
Or fork I've made here with few bugs fixed and animation signaling added.

Then setup your macopix run at startup with --sockmsg option, and set cow-notify send messages to it like in my example.
cow-notify might fail on system startup sometimes for some reason, and this can be fixed with delay (sleep 50 && cow-notify) &

You can grab the dancing miku mascot from here
Also I suggest setting slight startup delay for macopix too if you autostart it. (sleep 20 && macopix) & is fine.

Some references which might help you further:
My openbox autostart.sh # See the cow-notify and macopix lines.
https://github.com/Cloudef/dotFiles/blo … tostart.sh

Cow-notify config:
https://github.com/Cloudef/dotFiles/blo … ify/config

Deadbeef conky script that also makes the miku dance :
https://github.com/Cloudef/dotFiles/blo … b-cover.sh

Offline

#6 2011-06-01 07:49:02

ArchArael
Member
Registered: 2005-06-14
Posts: 504

Re: cow-notify - customizable notification daemon

Cloudef wrote:

...

Thank you. smile

Offline

#7 2011-07-01 22:04:23

0mark
Member
From: earth
Registered: 2010-06-09
Posts: 162
Website

Re: cow-notify - customizable notification daemon

With this config

sudo -u $( who | egrep ' (tty|pts)' | egrep ' \(:(pts/)?0' | head -n 1 | cut -d ' ' -f 1 ) notify-send -t [expire] '[summary]' '[body]'

cow-notify could act as some kind of notify proxy. Great for deamons, cron jobs or stuff. The script just tries to find the "human" user, sudo's to this user and send the notification again.


Ceterum autem censeo Systemdinem esse delendam

Offline

#8 2011-07-02 06:40:22

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: cow-notify - customizable notification daemon

0mark wrote:

With this config

sudo -u $( who | egrep ' (tty|pts)' | egrep ' \(:(pts/)?0' | head -n 1 | cut -d ' ' -f 1 ) notify-send -t [expire] '[summary]' '[body]'

cow-notify could act as some kind of notify proxy. Great for deamons, cron jobs or stuff. The script just tries to find the "human" user, sudo's to this user and send the notification again.

Heh, that's clever. Never thought about throwing whole scripts to the config file.

Offline

#9 2011-07-03 09:45:01

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: cow-notify - customizable notification daemon

Updated it to strip some stuff such as ` and $ letters since you could remote execute these and cause bad stuff happen.
There might be more ways since the code just uses system(); call which can be quite dangerous.

E: bleh, I just read about single quotes.. They make this useless. I'll add warning about this on readme however

Last edited by Cloudef (2011-07-30 10:53:12)

Offline

#10 2011-08-24 12:35:08

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: cow-notify - customizable notification daemon

I've changed the execution method, and edited main post.

Offline

#11 2011-09-28 13:43:02

synorgy
Member
From: $HOME
Registered: 2005-07-11
Posts: 272
Website

Re: cow-notify - customizable notification daemon

Cloudef - As discussed a few days ago, I created and uploaded a PKGBUILD for cow-notify. Sorry it took so long. Real life intrudes on the fun stuff yet again. If you'll give it a read over (and maybe try installing...since I've only tested it on this machine). Let me know if you want any changes made. You can find it here: https://aur.archlinux.org/packages.php?ID=52751


"Unix is basically a simple operating system, but you have to be a genius to understand the simplicity." (Dennis Ritchie)

Offline

#12 2011-09-28 15:17:29

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: cow-notify - customizable notification daemon

synorgy wrote:

Cloudef - As discussed a few days ago, I created and uploaded a PKGBUILD for cow-notify. Sorry it took so long. Real life intrudes on the fun stuff yet again. If you'll give it a read over (and maybe try installing...since I've only tested it on this machine). Let me know if you want any changes made. You can find it here: https://aur.archlinux.org/packages.php?ID=52751

Hey,
I just checked the PKGBUILD and tested it, works great. Also the post message is nice.

Thank you.

Last edited by Cloudef (2011-09-28 15:17:41)

Offline

Board footer

Powered by FluxBB