Skip to content

several things... #15

@bkw777

Description

@bkw777

I had a few problems with this script, and ended up resolving them, and in the process did a complete re-write, or refactor more exactly.

I don't think you want my stylistic chnages (but I do) so I don't have a pull-request, however, I re-created a fresh git commit history in a fork where I tried to do most of the stylistic stuff in the first couple commits and then the rest of the commits show the functional changes more clearly.

You may or may not be interested, but here is the fork with a commit history that should be more or less readable so you can see how I got rid of all the seds and other unneeded external tools like bc and dc etc, and resolved my main problem which was background processes that just accumulated forever because of not really handling the conditions that can happen with notifications.

I tried to make each commit add one conceptual change. Not always perfectly but pretty close mostly.
You could also just look at the final/current version and probably get it.
https://github.com/bkw777/notify-send.sh

This version is now working well and bulletproof for me.

Two things I did which I want in my copy that you may not want are,
1 - I execute the action command directly, not with "bash -c". If I really need to execute a command that needs bash interpretation, like redirection, I'll just run bash as the command, and bonus, it doesn't have to be bash. Otherwise, the 99% common case is running a binary or script with args, and I'd rather optimize for that, no unnecessary extra shell process.
2 - I removed the use of printf %q on the action command in send.sh. I haven't missed it, and I think it was the cause of a cosmetic ugliness where the -d command or any -o command with empty button label, produced a button that looked like [ ' ' ] (I undertstand that could be dependat on the particular notification daemon, still, I no longer have that problem. Now if I specify and emty label, I get a clean blank button.) However, I haven't tried every crazy possible command string, just some basics that do include spaces and embedded escaped quotes etc, and they all worked. It's possible that without the %q there are command strings that used to work that now don't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions