Browse Source

added WmClass

Nicole Portas 2 weeks ago
parent
commit
83c9ca067c
2 changed files with 20 additions and 4 deletions
  1. BIN
      logo500.png
  2. 20 4
      main.cpp

BIN
logo500.png


+ 20 - 4
main.cpp

@@ -1,3 +1,8 @@
+/*
+ * GnomeSettingsVault - A high-integrity GNOME configuration backup utility.
+ * Copyright (C) 2026 Nicole Portas, nicole@equalmass.com
+ */
+
 #include "MainWindow.hpp"
 #include <gtkmm/application.h>
 #include <gtk/gtk.h>
@@ -8,13 +13,18 @@
 
 int main(int argc, char *argv[]) {
     // --- Environment Hijack for Fontconfig ---
+    // This prevents font cache collisions in restricted environments
     const char* user = std::getenv("USER");
     std::string safe_cache_dir = std::string("/tmp/gnome-vault-cache-") + (user ? user : "default");
     mkdir(safe_cache_dir.c_str(), 0777);
     setenv("XDG_CACHE_HOME", safe_cache_dir.c_str(), 1);
 
-    // Set Program Name for WmClass / Task Bar
-    g_set_prgname("gnomesettingsvault");
+    // --- Identity Setup ---
+    // IMPORTANT: This string MUST match the 'StartupWMClass' in your .desktop file
+    // and ideally the 'Exec' binary name to ensure the icon pins correctly.
+    const std::string app_id = "gnome-vault"; 
+    
+    g_set_prgname(app_id.c_str());
     g_set_application_name("GnomeSettingsVault");
 
     if (!gtk_init_check(&argc, &argv)) {
@@ -23,9 +33,15 @@ int main(int argc, char *argv[]) {
     }
 
     try {
-        // Application ID also helps define the WmClass
-        auto app = Gtk::Application::create(argc, argv, "org.gnome.settingsvault");
+        // We use a reverse-DNS style ID for the Application object, 
+        // but the WMClass is handled by the prgname set above.
+        auto app = Gtk::Application::create(argc, argv, "com.equalmass.gnomevault");
+        
         MainWindow window;
+        
+        // Final hammer blow to ensure the window is identified correctly
+        window.set_wmclass(app_id, "GnomeSettingsVault");
+
         return app->run(window);
     } catch (const Glib::Error& ex) {
         std::cerr << "GTK Error: " << ex.what() << std::endl;