From 96a4b36b9feca559a512fe26cb7359178f1577cc Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Mon, 8 Apr 2024 12:23:57 -0400 Subject: window: Parse _BAMF_DESKTOP_FILE property In systems with bamfdaemon running, windows get this property for finding the dekstop spec file of an application. This can be used to find the defined icon for any application window that reports this attribute and provider much better icon matching. --- src/core/window-props.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/core/window-props.c') diff --git a/src/core/window-props.c b/src/core/window-props.c index fd08d33f..4d9600c2 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -1627,6 +1627,29 @@ reload_gtk_application_id (MetaWindow *window, } } +static void +reload_bamf_desktop_file (MetaWindow *window, + MetaPropValue *value, + gboolean initial) +{ + char *requested = NULL; + char *current = window->bamf_desktop_file; + + if (value->type != META_PROP_VALUE_INVALID) + { + requested = value->v.str; + meta_verbose ("Requested _BAMF_DESKTOP_FILE \"%s\" for window %s.\n", + requested, window->desc); + } + + if (g_strcmp0 (requested, current) != 0) + { + g_free (current); + + window->bamf_desktop_file = g_strdup (requested); + } +} + /** * Initialises the property hooks system. Each row in the table named "hooks" * represents an action to take when a property is found on a newly-created @@ -1677,6 +1700,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) { display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, }, { display->atom__GTK_FRAME_EXTENTS, META_PROP_VALUE_CARDINAL_LIST, reload_gtk_frame_extents }, { display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_gtk_application_id }, + { display->atom__BAMF_DESKTOP_FILE, META_PROP_VALUE_STRING, reload_bamf_desktop_file }, { 0 }, }; -- cgit v1.2.1