Merge branch 'worktree-agent-ae3af4174afca7f4d'

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 12:59:07 +00:00
26 changed files with 722 additions and 60 deletions
+23 -11
View File
@@ -6,6 +6,7 @@
#include <gdk/gdkx.h>
#endif
#include "clipboard_files.h"
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
@@ -15,6 +16,18 @@ struct _MyApplication {
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// The bundle's icon (data/app_icon.png beside the executable) for X11 window
// managers and task bars. Wayland compositors take the icon from the desktop
// entry named by the application id instead.
static void set_window_icon(GtkWindow* window) {
g_autofree gchar* executable = g_file_read_link("/proc/self/exe", nullptr);
if (executable == nullptr) return;
g_autofree gchar* directory = g_path_get_dirname(executable);
g_autofree gchar* icon =
g_build_filename(directory, "data", "app_icon.png", nullptr);
gtk_window_set_icon_from_file(window, icon, nullptr);
}
// Called when first Flutter frame received.
static void first_frame_cb(MyApplication* self, FlView* view) {
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
@@ -33,21 +46,18 @@ static void my_application_activate(GApplication* application) {
? detached_title
: "Pipelines";
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
// A GTK header bar only on GNOME, whose shell expects client-side title
// bars. Elsewhere (Hyprland, Sway, KDE, any X11 window manager) the window
// takes the compositor's own decorations, or none on a tiling compositor,
// instead of drawing a second title bar inside the tile.
const gchar* desktop = g_getenv("XDG_CURRENT_DESKTOP");
gboolean use_header_bar =
desktop != nullptr && g_strrstr(desktop, "GNOME") != nullptr;
#ifdef GDK_WINDOWING_X11
GdkScreen* screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
use_header_bar = g_strcmp0(wm_name, "GNOME Shell") == 0;
}
#endif
if (use_header_bar) {
@@ -59,6 +69,7 @@ static void my_application_activate(GApplication* application) {
} else {
gtk_window_set_title(window, title);
}
set_window_icon(window);
gint width = 1280, height = 720;
const gchar* detached_size = g_getenv("PIPELINES_WINDOW_SIZE");
@@ -91,6 +102,7 @@ static void my_application_activate(GApplication* application) {
gtk_widget_realize(GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
clipboard_files_register(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}