Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This already exists. It's called noti. It's cross-platform, supports most of the same backends, and can send Slack notifications (which ntfy can't). It also has an awesome API. You can put `noti` at the start of a command or `;noti` at the end, which is what I always do. I never remember to set the notification until after I've typed the command. If you forget to set the notification and the command is already running, you can call `noti -pwatch <pid>` and set notifications after the fact. It's very well thought out.

https://github.com/variadico/noti



Bash tip: you can schedule an arbitrary command to run when the current command completes by suspending it with CTRL-Z, and then typing "fg; <CMD>".

(This doesn't seem to be documented specifically anywhwere, but it's implicit in the way bash's job control works.)


Which is identical to write "cmd; nextCommand"

E.g. sleep 2; echo it works


I think the point of the tip was to show how it is done when process is already running and you forgot to add a command to be run immediately after


Apart the fact that you sound like an advertisement for another software it takes just a few seconds to see that noti doesn't work on windows or with telegram for example. Not supporting a major OS is a big deal.


I'm adding very basic Windows 10 (because notifications are ~50 lines there, many many more on older platforms) support.

Writing my first Go code was easier than packaging ntfy for Windows, FWIW.


Telegram is dangerous snake oil, and its use should be discouraged.


Why? Lately my paranoia calmed down somehow, and I'm even considering to install it (I need to have some messenger, after all, and it doesn't make me feel as naked, as skype or whatsapp would). Care to make me reconsider?


Only if you are using that major platform.


I don't use Windows, but Linux.


You might also mention that it's Go instead of Python, which makes it a lot more friendly to users. I've stopped using anything written in Python since previous trips down that path have all seemed to result in pain and Google searches related to the runtime environment.


For this kind of tool, where performances are definitely not important, I'll pick Python, Ruby and Node all the time. I assume that pip, bundle and npm already did their job and installed everything I need. Then I'm able to look at the code, change a few lines and run it again with only a text editor. The extra steps to download the source code and go through a compiler are not worth the trouble.


On the other hand, a language & tooling that by default compiles to a static executable, such as Go, means no dependency trouble or installation steps at all, now or in the future. Just copy 1 file to all your machines and you have that command available.

If the software is open source, you can still change anything with your text editor and recompile the executable, usually with a single command (go build, IIRC.) Additionally, you can keep all the executables for all your versions and modifications.

Try to do that with Python, when the change you need is somewhere deep inside a library. At best you'll spend hours setting up multiple Virtualenvs; at worst it will just be impossible. Case in point, you can't use a Virtualenv for ntfy on OS X of you want desktop notifications (for whatever reason.)


Today I dumped a not-insignificant amount of time into trying to package ntfy into a single exe on Windows (using PyInstaller. It sort-of works, but was way way more painful than it needed to be. Python packaging still sucks in 2016. Go is way ahead of Python in that regard, but comes with its own quirks (GitHub by default, always uses the HEAD version of libraries, GOPATH)


I'm not familiar with PyInstaller but I wouldn't do anything similar with scripting languages. They are meant to be distributed as scripts so I'm not surprised it took you all that time. Why didn't you use pip to install on (I suppose) those other Windows machines?

There are similar problems with Ruby when people want to distribute executables. I remember I googled a solution that made a friend of mine happy (he had to deploy on multiple Windows machines, I don't remember what I suggested him to do) but still it's the wrong way to go. If creating a single executable is a hard requirement then yes, they are the wrong languages to solve your problem.


I didn't use pip because the normal way to distribute applications on Windows is to use an exe, possibly with an installer.

Packaging Python on Windows has always been tricky.

https://github.com/larsch/ocra is the Ruby equivalent.


No way! A static binary is infinitely easier to deploy, patch, and maintain. Especially across systems.

Python, Ruby, and Node are becoming less popular for a reason.


This the first I've heard of noti, looks cool tho.

Ntfy does many of these things too, for example A coworker had suggested the PID option so it has that too :)

I mostly use the shell-integration that automatically sends notifications for commands taking longer than 10 seconds (if the terminal isn't focused).


I have to agree that Noti is way better.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: