naughty.notify leaves a trailing newline

i have in my awesomerc

awful.spawn.easy_async_with_shell("cat ~/file | tr -d '\n'", function(out)
	brightness_id = naughty.notify({text=out, replaces_id=brightness_id}).
end)

the ~/file file literally only has "notification" in it. no trailing newlines whatsoever. but naughty.notify produces
image
even though i made sure to tr -d '\n', it still gives the ugly newline at the end…

is there any way to not have this happen?

OS: Manjaro Linux x86_64 
Kernel: 5.2.11-1-MANJARO 
WM: awesome 

Can you check if you have any of the width or height related theme variable set in your theme or your config? : https://awesomewm.org/doc/api/libraries/naughty.html

You can also test naughty with notify-send or by using the lua-interpreter of awesome awesome-client You can just send a string "notification" to test naughty

Sending a regular string doesn't make the newline. Only doing it from out makes it. (I souldve said that in the question)

Hm, seems to me like the newline gets added after the command line got executed. I see two possible ways to work around this:

  1. Use the lua string functions to delete the linebreak (string.gsub). Something like:
awful.spawn.easy_async_with_shell("cat ~/file", function(out)
	brightness_id = naughty.notify({text=string.gsub(out,"\n",""), replaces_id=brightness_id}).
end)
  1. Write a shell script to output the notification via notify-send But I do not know how to set the ID there (if you need that)
1 Like

i needed the replaces_id cuz i was making a notification for when the brightness changes, but i didnt want a gazillion notifications if u press it a couple of times, so with replaces_id it just replaces the notification with the new brightness value!

Try dunstify, it has that functionality over notift-send

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by