diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index cd7e650f33..5d1efd3ca2 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -490,7 +490,7 @@ fn initActions(self: *Window) void { .{ "paste", >kActionPaste }, .{ "reset", >kActionReset }, .{ "clear", >kActionClear }, - .{ "prompt_title", >kActionPromptTitle }, + .{ "prompt-title", >kActionPromptTitle }, }; inline for (actions) |entry| { diff --git a/src/apprt/gtk/gresource.zig b/src/apprt/gtk/gresource.zig index 83978c337e..4bd08ed0a5 100644 --- a/src/apprt/gtk/gresource.zig +++ b/src/apprt/gtk/gresource.zig @@ -53,10 +53,7 @@ const icons = [_]struct { }, }; -pub const ui_files = [_][]const u8{ - "menu-window-titlebar_menu", - "menu-surface-context_menu", -}; +pub const ui_files = [_][]const u8{}; pub const VersionedBlueprint = struct { major: u16, @@ -67,6 +64,8 @@ pub const VersionedBlueprint = struct { pub const blueprint_files = [_]VersionedBlueprint{ .{ .major = 1, .minor = 5, .micro = 0, .name = "prompt-title-dialog" }, + .{ .major = 1, .minor = 0, .micro = 0, .name = "menu-surface-context_menu" }, + .{ .major = 1, .minor = 0, .micro = 0, .name = "menu-window-titlebar_menu" }, }; pub fn main() !void { diff --git a/src/apprt/gtk/menu.zig b/src/apprt/gtk/menu.zig index 92b6362806..ef70df1b74 100644 --- a/src/apprt/gtk/menu.zig +++ b/src/apprt/gtk/menu.zig @@ -41,7 +41,7 @@ pub fn Menu( else => unreachable, }; - var builder = Builder.init("menu-" ++ object_type ++ "-" ++ menu_name, .ui); + var builder = Builder.init("menu-" ++ object_type ++ "-" ++ menu_name, .blp); defer builder.deinit(); const menu_model = builder.getObject(gio.MenuModel, "menu").?; diff --git a/src/apprt/gtk/ui/menu-surface-context_menu.blp b/src/apprt/gtk/ui/menu-surface-context_menu.blp new file mode 100644 index 0000000000..ab48552db5 --- /dev/null +++ b/src/apprt/gtk/ui/menu-surface-context_menu.blp @@ -0,0 +1,102 @@ +using Gtk 4.0; + +menu menu { + section { + item { + label: _("Copy"); + action: "win.copy"; + } + + item { + label: _("Paste"); + action: "win.paste"; + } + } + + section { + item { + label: _("Clear"); + action: "win.clear"; + } + + item { + label: _("Reset"); + action: "win.reset"; + } + } + + section { + submenu { + label: _("Split"); + + item { + label: _("Change Title…"); + action: "win.prompt-title"; + } + + item { + label: _("Split Up"); + action: "win.split-up"; + } + + item { + label: _("Split Down"); + action: "win.split-down"; + } + + item { + label: _("Split Left"); + action: "win.split-left"; + } + + item { + label: _("Split Right"); + action: "win.split-right"; + } + } + + submenu { + label: _("Tab"); + + item { + label: _("New Tab"); + action: "win.new-tab"; + } + + item { + label: _("Close Tab"); + action: "win.close-tab"; + } + } + + submenu { + label: _("Window"); + + item { + label: _("New Window"); + action: "win.new-window"; + } + + item { + label: _("Close Window"); + action: "win.close"; + } + } + } + + section { + submenu { + label: _("Config"); + + item { + label: _("Open Configuration"); + action: "app.open-config"; + } + + item { + label: _("Reload Configuration"); + action: "app.reload-config"; + } + } + } +} diff --git a/src/apprt/gtk/ui/menu-surface-context_menu.ui b/src/apprt/gtk/ui/menu-surface-context_menu.ui deleted file mode 100644 index b5bf55cef7..0000000000 --- a/src/apprt/gtk/ui/menu-surface-context_menu.ui +++ /dev/null @@ -1,90 +0,0 @@ - - - - -
- - Copy - win.copy - - - Paste - win.paste - -
-
- - Clear - win.clear - - - Reset - win.reset - -
-
- - Split -
- - Split Up - win.split-up - - - Split Down - win.split-down - - - Split Left - win.split-left - - - Split Right - win.split-right - -
-
- - Tab -
- - New Tab - win.new-tab - - - Close Tab - win.close-tab - -
-
- - Window -
- - New Window - win.new-window - - - Close Window - win.close - -
-
-
-
- - Config -
- - Open Configuration - app.open-config - - - Reload Configuration - app.reload-config - -
-
-
-
-
diff --git a/src/apprt/gtk/ui/menu-window-titlebar_menu.blp b/src/apprt/gtk/ui/menu-window-titlebar_menu.blp new file mode 100644 index 0000000000..71e7d060cd --- /dev/null +++ b/src/apprt/gtk/ui/menu-window-titlebar_menu.blp @@ -0,0 +1,111 @@ +using Gtk 4.0; + +menu menu { + section { + item { + label: _("Copy"); + action: "win.copy"; + } + + item { + label: _("Paste"); + action: "win.paste"; + } + } + + section { + item { + label: _("New Window"); + action: "win.new-window"; + } + + item { + label: _("Close Window"); + action: "win.close"; + } + } + + section { + item { + label: _("New Tab"); + action: "win.new-tab"; + } + + item { + label: _("Close Tab"); + action: "win.close-tab"; + } + } + + section { + submenu { + label: _("Split"); + + item { + label: _("Change Title…"); + action: "win.prompt-title"; + } + + item { + label: _("Split Up"); + action: "win.split-up"; + } + + item { + label: _("Split Down"); + action: "win.split-down"; + } + + item { + label: _("Split Left"); + action: "win.split-left"; + } + + item { + label: _("Split Right"); + action: "win.split-right"; + } + } + } + + section { + item { + label: _("Clear"); + action: "win.clear"; + } + + item { + label: _("Reset"); + action: "win.reset"; + } + } + + section { + item { + label: _("Terminal Inspector"); + action: "win.toggle-inspector"; + } + + item { + label: _("Open Configuration"); + action: "app.open-config"; + } + + item { + label: _("Reload Configuration"); + action: "app.reload-config"; + } + } + + section { + item { + label: _("About Ghostty"); + action: "win.about"; + } + + item { + label: _("Quit"); + action: "app.quit"; + } + } +} diff --git a/src/apprt/gtk/ui/menu-window-titlebar_menu.ui b/src/apprt/gtk/ui/menu-window-titlebar_menu.ui deleted file mode 100644 index 6359b993c0..0000000000 --- a/src/apprt/gtk/ui/menu-window-titlebar_menu.ui +++ /dev/null @@ -1,93 +0,0 @@ - - - - -
- - Copy - win.copy - - - Paste - win.paste - -
-
- - New Window - win.new-window - - - Close Window - win.close - -
-
- - New Tab - win.new-tab - - - Close Tab - win.close-tab - -
-
- - Split -
- - Split Up - win.split-up - - - Split Down - win.split-down - - - Split Left - win.split-left - - - Split Right - win.split-right - -
-
-
-
- - Clear - win.clear - - - Reset - win.reset - -
-
- - Terminal Inspector - win.toggle-inspector - - - Open Configuration - app.open-config - - - Reload Configuration - app.reload-config - -
-
- - About Ghostty - win.about - - - Quit - app.quit - -
-
-