Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/apprt/gtk/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const Window = @import("Window.zig");
const ConfigErrorsDialog = @import("ConfigErrorsDialog.zig");
const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig");
const CloseDialog = @import("CloseDialog.zig");
const GlobalShortcuts = @import("GlobalShortcuts.zig");
const Split = @import("Split.zig");
const inspector = @import("inspector.zig");
const key = @import("key.zig");
Expand Down Expand Up @@ -95,6 +96,8 @@ css_provider: *gtk.CssProvider,
/// Providers for loading custom stylesheets defined by user
custom_css_providers: std.ArrayListUnmanaged(*gtk.CssProvider) = .{},

global_shortcuts: ?GlobalShortcuts,

/// The timer used to quit the application after the last window is closed.
quit_timer: union(enum) {
off: void,
Expand Down Expand Up @@ -422,6 +425,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
// our "activate" call above will open a window.
.running = gio_app.getIsRemote() == 0,
.css_provider = css_provider,
.global_shortcuts = .init(core_app.alloc, gio_app),
};
}

Expand All @@ -443,6 +447,8 @@ pub fn terminate(self: *App) void {

self.winproto.deinit(self.core_app.alloc);

if (self.global_shortcuts) |*shortcuts| shortcuts.deinit();

self.config.deinit();
}

Expand Down Expand Up @@ -1012,6 +1018,12 @@ fn syncConfigChanges(self: *App, window: ?*Window) !void {
ConfigErrorsDialog.maybePresent(self, window);
try self.syncActionAccelerators();

if (self.global_shortcuts) |*shortcuts| {
shortcuts.refreshSession(self) catch |err| {
log.warn("failed to refresh global shortcuts={}", .{err});
};
}

// Load our runtime and custom CSS. If this fails then our window is just stuck
// with the old CSS but we don't want to fail the entire sync operation.
self.loadRuntimeCss() catch |err| switch (err) {
Expand Down
Loading