-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GTK: crash reports notice #4387
GTK: crash reports notice #4387
Conversation
682c088
to
fc24bcb
Compare
This looks pretty good to me. I'd like @jcollie or @tristan957 to review this. We're now disabling Sentry by default on Linux because its not providing useful information yet, but having this in for when its enabled would be good. |
I don't like that we seem to be controlling the line break. I'd rather let GTK/Pango handle that, so the text can just flow as needed. |
I tried that out and it doesn't look very good, plus it takes up a lot more vertical space because it's not packed very well. Unless we get fancier with the layout I think it's a good compromise. |
Fwiw on the macOS we manually control line breaking all over to be more aesthetically pleasing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code also needs to have zig fmt
run against it. I've made a few comments, but otherwise is looking good. prettier
also needs to be run to format the .css
files.
src/apprt/gtk/Window.zig
Outdated
self.app.core_app.alloc, | ||
\\ There are existing crash reports located at <a href="file://{s}">{s}</a>. | ||
\\ If possible, <a href="https://github.com/ghostty-org/ghostty?tab=readme-ov-file#crash-reports">report them to the developers</a> to help improve the application. | ||
, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's wonderful that clicking the links takes you someplace useful. I was thinking that we'd immediately be inundated with requests to get some kind of GUI to manage crash reports (and we may still need that eventually) but clicking the link brings up Gnome's file manager with the crash reports directory so it's pretty easy for users to manage their crash reports.
- extract the banner code into separate function - introduce a global variable used to check if the banner was dismissed - format code
b0ba5ab
to
d58458a
Compare
Hey @jcollie, just following up on this PR - I've addressed the requested changes and resolved the conflicts, I would appreciate a re-review. |
- propagate the banner dismissal to all windows - the dismissed flag is now a local field - avoid repetition in format string
- remove unnecessary Surface cast - drop support for non-Adwaita build
7db9367
to
ac80c4b
Compare
@@ -582,6 +582,13 @@ pub fn sendToast(self: *Window, title: [:0]const u8) void { | |||
} | |||
|
|||
fn displayCrashReportsNoticeIfNeeded(self: *Window, app: *App, parent_widget: *c.GtkWidget) !void { | |||
if (!((comptime adwaita.versionAtLeast(1, 3, 0)) and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's no longer necessary to have both a comptime and a non-comptime check for the Adwaita version. Because the function is inlined you can use a single check without the comptime keyword.
@@ -582,6 +582,13 @@ pub fn sendToast(self: *Window, title: [:0]const u8) void { | |||
} | |||
|
|||
fn displayCrashReportsNoticeIfNeeded(self: *Window, app: *App, parent_widget: *c.GtkWidget) !void { | |||
if (!((comptime adwaita.versionAtLeast(1, 3, 0)) and | |||
adwaita.enabled(&app.config) and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of this morning Adwaita is no longer optional so this function no longer exists.
for (self.app.core_app.surfaces.items) |surface| { | ||
const gtk_surface: *Surface = @ptrCast(surface); | ||
if (gtk_surface.container.window()) |window| { | ||
c.adw_banner_set_revealed(@ptrCast(window.crash_notice_widget), c.FALSE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though it probably doesn't matter to the GTK code, window.crash_notice_widget
should be checked for null
.
After some discussion on Discord, I'm going to close this PR. You've done some good work and have been responsive to all of our comments! Unfortunately displaying crash report banners on Linux is unnecessary at this point since Sentry is disabled on Linux by default right now. Since 99.9% of Linux users will never generate a crash report having the machinery to report them is extra code to maintain that's never used. Thanks again and I hope that you will continue to contribute to Ghostty! There's lots of work to be done yet! |
This pr implements the GUI notice informing about existing crash reports in the GTK application, and partially resolves #2183.
As proposed in #2183 (comment) I implemented a banner similiar to the debug mode notice.
The message embeds clickable links leading to the reports directory and reporting instructions.
gtk-adwaita=true
:gtk-adwaita=false
: