Repository navigation
feat!: use toast if disable-notification is set - #711
Conversation
|
I must admit that I like toasts - I even prefer them in comparison to notifications as they occur where I am looking anyway. Adding log_warn() and log_error() would allow us to automatically prepend an |
yes, that's a good point. |
|
Changed to draft, will probably take a few more days. |
72a9618 to
5ad00d6
Compare
|
Almost done IMO, I think a second pass to levels and (perhaps) severities can be done whenever anyone sees fit.
|
|
Right, so i tossed out the native-dialog again. We would have had to add zenity to the flatpak. Flatpak is arguably one of the worst places where you could rely on errors just showing up on stderr. But adding such a package to it creates a moving target, because we need to include it by download url and hash. So instead, I added a helper binary which just spawns a gtk dialog, which can be used before config is read and before gtk is initialized. With epoxy and config errors and gl and all that there are some errors that might just be swallowed silently. For anyone who's annoyed by the extra popup because they read the terminal anyway, this is behind a feature that can be disabled. I think I still need to test if the flatpak still works. |
robertwidfen
left a comment
There was a problem hiding this comment.
IMHO config reading error is the only one where we actually would need the extra binary satty-fatal-error-dialog, but IMHO we should not abort here, but just report it and use the defaults. If GTK fails also satty-fatal-error-dialog will fail.
That way we could avoid having an external binary. 🤔
|
Wow - started small and grew larger than initially thought 🤣 It is a big improvement and we should get this merged soon as it touches so many places. |
Well, it's the case where a user passes an explicit named config, skipping processing of any defaults. My expectation from a user perspective would be a hard error if the file cannot be read. Re GTK, that is true. But we also load epoxy in satty main binary, and read the image before the GUI is started. |
|
I am sure I wrote a comment, but cannot find it anymore 🙃 - maybe lost in closed tabs.
I still think it should not fail hard if config is not found unless started from the terminal. Let's assume I have hyprland binding where for some purpose I start satty with a different config and pip the screenshot to it and at some time I cleanup configs, forgot about this and later in a online meeting take a screenshot - then it will be lost without being able to rewind.
I am not deeply into this epoxy stuff - but if the helper app can start and we can catch the error why can we not make the dialog within satty. I clauded something here but do not know how to test it 🙃 |
I was not saying we cannot. We either have to start a separate main loop within logging. That was actually in my code yesterday, and that's what your claude attempt does, but that's messy so I decided to toss it out. However, we can do it as part of error handling within main.rs. That's something I'd like to try. And I actually wrote it somewhere above that I was going to. |
I think the easiest way to test would be to change the expected library name in epoxy.rs temporarily. |
Adding 1 or 2 missing things above: Should we place the early fatal dialog behind a feature so people who don't want it can remove it from their build individually? |
|
additional todo: fill out changelog |
robertwidfen
left a comment
There was a problem hiding this comment.
Will take a closer look on Wednesday ... ;-)
This is a different approach to what #664 solves. Uses adwaita toast if notifications are disabled. Separate main loop is used display message for severe errors which happen before GTK is initialized. I believe this is better because it does not ignore disable-notifications.
eprintln!s, but for this to work we need to do something useful if notifications are disabled and gtk has not been initialized yetLogSeverity::Urgentis currently unusedflatpak tested, but this required some change of the metadata (launchable, categories), otherwise my local flatpak-build would failhelper removed againnix develop .. tested at some point, but not with the last stuffhelper removed again--profile-startupis now behind debug log level, we can make that an alias for loglevel debug and simplify the code slightlyThis should open the possibility for a log buffer and potential dialog to display it on demand (#704) but I'm not doing that here.
I'm also removing draft now because the remaining stuff would not be a lot anymore.
updated disclaimer on AI generated code
I had claude help me with the satty-fatal-error-dialog helper binary main function because I felt like outsourcing that part. The idea as such was my own after dealing with zenity.helper removed againBreaking Section
Introduces a new feature, "fatal-error-dialog" which is activated by default. This installs a helper binary (satty-fatal-error-dialog) which can be used to display error messages before satty's config has been read or satty's own gtk has been initialized. satty-fatal-error-dialog does not depend on gl or epoxy so should work in more scenarios.However, if you always read the terminal then this might be annoying, so the behaviour can be disabled by turning default-features off.--profile-startupwas changed so it sets level debug. The logging as such is no longer conditional. This way it'll always be available via log viewer (#785).