Linux desktop: optimized release build, installer, Linux gaps
Build: split Dart debug info out of libapp.so (13.96 -> 11.27 MB, symbols kept in the cache) and fix icon tree shaking, which Flutter 3.44's Linux CMake backend silently disables by quoting the define; the build image patches its SDK copy (MaterialIcons 1.6 MB -> 25 KB). Impeller cannot be enabled in a Linux release build and was slower in a profile-build bench. Install: `./install --linux --install` installs the bundle into <prefix>/lib/app-linux with com.pipelines.app.desktop (the GTK/Wayland app id), its icon and a ~/.local/bin/pipelines-app link, through scripts/install-linux-app.sh. Linux gaps: notifications through the freedesktop daemon; HTML artifacts explain the missing web view instead of throwing; no Share for files; a GTK clipboard reader for pasting files and screenshots (Ctrl+V and Omarchy's Super+V); GTK header bar only on GNOME; window icon. Bench: native fixture frame log, wheel/mark steps and tool/perf/linux_desktop_bench.py (private Xvfb); results in app/notes/linux-desktop-optimized.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
|
||||
#include "clipboard_files.h"
|
||||
#include "flutter/generated_plugin_registrant.h"
|
||||
|
||||
struct _MyApplication {
|
||||
@@ -14,6 +15,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)));
|
||||
@@ -25,21 +38,18 @@ static void my_application_activate(GApplication* application) {
|
||||
GtkWindow* window =
|
||||
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
||||
|
||||
// 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) {
|
||||
@@ -51,6 +61,7 @@ static void my_application_activate(GApplication* application) {
|
||||
} else {
|
||||
gtk_window_set_title(window, "Pipelines");
|
||||
}
|
||||
set_window_icon(window);
|
||||
|
||||
gtk_window_set_default_size(window, 1280, 720);
|
||||
|
||||
@@ -74,6 +85,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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user