From 79342277b8d13e2c26d961aece7b80c4031e4fa5 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 3 May 2026 22:12:05 +0200 Subject: [PATCH] fix desktop integration and rename Linux runner StartupWMClass now matches the GTK application ID (net.schweitz.clide) so the running window groups with the launcher icon. Desktop file installs as net.schweitz.clide.desktop per freedesktop convention. Renamed my_application.{cc,h} to clide_app.{cc,h} with matching GObject type (ClideApp / CLIDE_APP). Co-Authored-By: Claude --- .pql/pql-plan.json | 2 +- Makefile | 5 +- linux/clide.desktop | 2 +- linux/runner/CMakeLists.txt | 2 +- .../{my_application.cc => clide_app.cc} | 57 +++++++++---------- linux/runner/clide_app.h | 10 ++++ linux/runner/main.cc | 4 +- linux/runner/my_application.h | 21 ------- 8 files changed, 46 insertions(+), 57 deletions(-) rename linux/runner/{my_application.cc => clide_app.cc} (85%) create mode 100644 linux/runner/clide_app.h delete mode 100644 linux/runner/my_application.h diff --git a/.pql/pql-plan.json b/.pql/pql-plan.json index 935b789f..2a165d0b 100644 --- a/.pql/pql-plan.json +++ b/.pql/pql-plan.json @@ -1,5 +1,5 @@ { - "exported_at": "2026-05-03T20:06:31Z", + "exported_at": "2026-05-03T20:12:05Z", "decisions": [ { "id": "D-1", diff --git a/Makefile b/Makefile index 9438f094..b9132b7d 100644 --- a/Makefile +++ b/Makefile @@ -167,11 +167,11 @@ ifeq ($(FLUTTER_OS),linux) done @mkdir -p $(HOME)/.local/share/applications @sed 's|Exec=clide|Exec=$(INSTALL_PREFIX)/clide/clide|' linux/clide.desktop \ - > $(HOME)/.local/share/applications/clide.desktop + > $(HOME)/.local/share/applications/net.schweitz.clide.desktop @gtk-update-icon-cache -f -t $(HOME)/.local/share/icons/hicolor 2>/dev/null || true @update-desktop-database $(HOME)/.local/share/applications 2>/dev/null || true @echo "installed: $(INSTALL_DIR)/clide -> $(INSTALL_PREFIX)/clide/clide" - @echo "desktop: ~/.local/share/applications/clide.desktop" + @echo "desktop: ~/.local/share/applications/net.schweitz.clide.desktop" @echo "version: $(VERSION)" else ifeq ($(FLUTTER_OS),macos) @mkdir -p $(HOME)/Applications @@ -189,6 +189,7 @@ uninstall: ## Remove installed clide. ifeq ($(FLUTTER_OS),linux) rm -f $(INSTALL_DIR)/clide rm -rf $(INSTALL_PREFIX)/clide + rm -f $(HOME)/.local/share/applications/net.schweitz.clide.desktop rm -f $(HOME)/.local/share/applications/clide.desktop @for size in $(ICON_SIZES); do \ rm -f $(HOME)/.local/share/icons/hicolor/$${size}x$${size}/apps/clide.png; \ diff --git a/linux/clide.desktop b/linux/clide.desktop index f84cd919..25e862ed 100644 --- a/linux/clide.desktop +++ b/linux/clide.desktop @@ -7,5 +7,5 @@ Icon=clide Terminal=false Categories=Development;IDE;TextEditor; Keywords=code;editor;ide;claude;terminal; -StartupWMClass=clide +StartupWMClass=net.schweitz.clide MimeType=inode/directory; diff --git a/linux/runner/CMakeLists.txt b/linux/runner/CMakeLists.txt index 067ecfcc..b831f3cf 100644 --- a/linux/runner/CMakeLists.txt +++ b/linux/runner/CMakeLists.txt @@ -4,7 +4,7 @@ project(runner LANGUAGES C CXX) # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} "main.cc" - "my_application.cc" + "clide_app.cc" "protocols/server-decoration-protocol.c" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) diff --git a/linux/runner/my_application.cc b/linux/runner/clide_app.cc similarity index 85% rename from linux/runner/my_application.cc rename to linux/runner/clide_app.cc index 58e4b758..977de7ca 100644 --- a/linux/runner/my_application.cc +++ b/linux/runner/clide_app.cc @@ -1,4 +1,4 @@ -#include "my_application.h" +#include "clide_app.h" #include #ifdef GDK_WINDOWING_X11 @@ -13,12 +13,12 @@ #include "flutter/generated_plugin_registrant.h" -struct _MyApplication { +struct _ClideApp { GtkApplication parent_instance; char** dart_entrypoint_arguments; }; -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) +G_DEFINE_TYPE(ClideApp, clide_app, GTK_TYPE_APPLICATION) // D-057: KDE server-decoration protocol — request no decorations. #ifdef HAS_WAYLAND_CLIENT @@ -81,7 +81,6 @@ static void request_no_server_decorations(GtkWindow* window) { struct org_kde_kwin_server_decoration* deco = org_kde_kwin_server_decoration_manager_create(kde_deco_manager, surface); if (deco != nullptr) { - // Mode 0 = None (no decorations at all) org_kde_kwin_server_decoration_request_mode(deco, 0); wl_display_roundtrip(wl_dpy); } @@ -100,12 +99,12 @@ static void on_window_realize(GtkWidget* widget, gpointer data) { #endif } -static void first_frame_cb(MyApplication* self, FlView* view) { +static void first_frame_cb(ClideApp* self, FlView* view) { gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); } -static void my_application_activate(GApplication* application) { - MyApplication* self = MY_APPLICATION(application); +static void clide_app_activate(GApplication* application) { + ClideApp* self = CLIDE_APP(application); GtkWindow* window = GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); @@ -249,10 +248,10 @@ static void my_application_activate(GApplication* application) { gtk_widget_grab_focus(GTK_WIDGET(view)); } -static gboolean my_application_local_command_line(GApplication* application, - gchar*** arguments, - int* exit_status) { - MyApplication* self = MY_APPLICATION(application); +static gboolean clide_app_local_command_line(GApplication* application, + gchar*** arguments, + int* exit_status) { + ClideApp* self = CLIDE_APP(application); self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); g_autoptr(GError) error = nullptr; @@ -267,34 +266,34 @@ static gboolean my_application_local_command_line(GApplication* application, return TRUE; } -static void my_application_startup(GApplication* application) { - G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +static void clide_app_startup(GApplication* application) { + G_APPLICATION_CLASS(clide_app_parent_class)->startup(application); } -static void my_application_shutdown(GApplication* application) { - G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +static void clide_app_shutdown(GApplication* application) { + G_APPLICATION_CLASS(clide_app_parent_class)->shutdown(application); } -static void my_application_dispose(GObject* object) { - MyApplication* self = MY_APPLICATION(object); +static void clide_app_dispose(GObject* object) { + ClideApp* self = CLIDE_APP(object); g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); - G_OBJECT_CLASS(my_application_parent_class)->dispose(object); + G_OBJECT_CLASS(clide_app_parent_class)->dispose(object); } -static void my_application_class_init(MyApplicationClass* klass) { - G_APPLICATION_CLASS(klass)->activate = my_application_activate; +static void clide_app_class_init(ClideAppClass* klass) { + G_APPLICATION_CLASS(klass)->activate = clide_app_activate; G_APPLICATION_CLASS(klass)->local_command_line = - my_application_local_command_line; - G_APPLICATION_CLASS(klass)->startup = my_application_startup; - G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; - G_OBJECT_CLASS(klass)->dispose = my_application_dispose; + clide_app_local_command_line; + G_APPLICATION_CLASS(klass)->startup = clide_app_startup; + G_APPLICATION_CLASS(klass)->shutdown = clide_app_shutdown; + G_OBJECT_CLASS(klass)->dispose = clide_app_dispose; } -static void my_application_init(MyApplication* self) {} +static void clide_app_init(ClideApp* self) {} -MyApplication* my_application_new() { +ClideApp* clide_app_new() { g_set_prgname(APPLICATION_ID); - return MY_APPLICATION(g_object_new(my_application_get_type(), - "application-id", APPLICATION_ID, "flags", - G_APPLICATION_NON_UNIQUE, nullptr)); + return CLIDE_APP(g_object_new(clide_app_get_type(), + "application-id", APPLICATION_ID, "flags", + G_APPLICATION_NON_UNIQUE, nullptr)); } diff --git a/linux/runner/clide_app.h b/linux/runner/clide_app.h new file mode 100644 index 00000000..d64044cb --- /dev/null +++ b/linux/runner/clide_app.h @@ -0,0 +1,10 @@ +#ifndef CLIDE_APP_H_ +#define CLIDE_APP_H_ + +#include + +G_DECLARE_FINAL_TYPE(ClideApp, clide_app, CLIDE, APP, GtkApplication) + +ClideApp* clide_app_new(); + +#endif // CLIDE_APP_H_ diff --git a/linux/runner/main.cc b/linux/runner/main.cc index e7c5c543..4a877994 100644 --- a/linux/runner/main.cc +++ b/linux/runner/main.cc @@ -1,6 +1,6 @@ -#include "my_application.h" +#include "clide_app.h" int main(int argc, char** argv) { - g_autoptr(MyApplication) app = my_application_new(); + g_autoptr(ClideApp) app = clide_app_new(); return g_application_run(G_APPLICATION(app), argc, argv); } diff --git a/linux/runner/my_application.h b/linux/runner/my_application.h deleted file mode 100644 index db16367a..00000000 --- a/linux/runner/my_application.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef FLUTTER_MY_APPLICATION_H_ -#define FLUTTER_MY_APPLICATION_H_ - -#include - -G_DECLARE_FINAL_TYPE(MyApplication, - my_application, - MY, - APPLICATION, - GtkApplication) - -/** - * my_application_new: - * - * Creates a new Flutter-based application. - * - * Returns: a new #MyApplication. - */ -MyApplication* my_application_new(); - -#endif // FLUTTER_MY_APPLICATION_H_