From ca6e59412b13b385f3d875635725e40ab06104e4 Mon Sep 17 00:00:00 2001 From: Adam Higerd Date: Tue, 13 Feb 2024 08:50:28 -0600 Subject: [PATCH] Add "applyDefaultIcon" setting Some applications don't provide their own icons. By default, Openbox sets a generic icon for these applications. Other environments, such as GNOME, instead supply an icon from /usr/share/pixmaps or the icon theme. Openbox's behavior is appropriate when it is running on its own, but when it being used as the window manager in a broader desktop environment, the presence of the default icon prevents the environment from noticing that it needs to provide an icon. This change adds an `` configuration option that defaults to `yes` to preserve the standard Openbox behavior. By setting this option to `no`, Openbox will cede responsibility for setting default icons to the desktop environment. Resolves issue #21 --- openbox/client.c | 2 +- openbox/config.c | 4 ++++ openbox/config.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openbox/client.c b/openbox/client.c index 3ff278ae6..fae932414 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2306,7 +2306,7 @@ void client_update_icons(ObClient *self) /* if the client has no icon at all, then we set a default icon onto it. but, if it has parents, then one of them will have an icon already */ - if (!self->icon_set && !self->parents) { + if (!self->icon_set && !self->parents && config_apply_default_icon) { RrPixel32 *icon = ob_rr_theme->def_win_icon; gulong *ldata; /* use a long here to satisfy OBT_PROP_SETA32 */ diff --git a/openbox/config.c b/openbox/config.c index dad5d1bf9..de7d0ec4f 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -50,6 +50,7 @@ gboolean config_theme_keepborder; guint config_theme_window_list_icon_size; gchar *config_title_layout; +gboolean config_apply_default_icon; gboolean config_animate_iconify; @@ -712,6 +713,8 @@ static void parse_theme(xmlNodePtr node, gpointer d) config_theme_keepborder = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "animateIconify"))) config_animate_iconify = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "applyDefaultIcon"))) + config_apply_default_icon = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "windowListIconSize"))) { config_theme_window_list_icon_size = obt_xml_node_int(n); if (config_theme_window_list_icon_size < 16) @@ -1098,6 +1101,7 @@ void config_startup(ObtXmlInst *i) config_title_layout = g_strdup("NLIMC"); config_theme_keepborder = TRUE; config_theme_window_list_icon_size = 36; + config_apply_default_icon = TRUE; config_font_activewindow = NULL; config_font_inactivewindow = NULL; diff --git a/openbox/config.h b/openbox/config.h index 96a66cf1e..8f24fa63d 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -152,6 +152,8 @@ extern gchar *config_title_layout; extern gboolean config_animate_iconify; /*! Size of icons in focus switching dialogs */ extern guint config_theme_window_list_icon_size; +/*! Set a default icon for windows that lack one */ +extern gboolean config_apply_default_icon; /*! The font for the active window's title */ extern RrFont *config_font_activewindow;