From 797b4dc01895b9936c68aad9f8b4e8b7b24502ab 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 83f1de3d..4383100f 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -1626,6 +1626,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 @@ -1676,6 +1699,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