This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/119/head
in repository enlightenment.
View the commit online.
commit 344adeb7cb86ff5084792469eafa1588b9e9c6fc
Author: Swagtoy <m...@ow.swag.toys>
AuthorDate: Fri Jul 4 14:31:41 2025 -0400
Ibar: Show tasks for clients without FDO instances
For a long while, I used to think ibar not showing clients with .desktop files was a bug (in fact, i used to think that some clients simple didn't like showing up). Turns out that is intended.
This will now show those when dont_add_nonorder is false. More Notably, all of Enlightenment's builtin clients will now show (like config, popups, etc.) and stuff like Steam games.
---
src/modules/ibar/e_mod_main.c | 205 ++++++++++++++++++++++++++++++------------
1 file changed, 150 insertions(+), 55 deletions(-)
diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c
index 38581484a..339adb279 100644
--- a/src/modules/ibar/e_mod_main.c
+++ b/src/modules/ibar/e_mod_main.c
@@ -70,6 +70,7 @@ struct _IBar_Icon
Evas_Object *o_holder, *o_icon;
Evas_Object *o_holder2, *o_icon2;
Eina_List *client_objs;
+ E_Client *single_client;
Efreet_Desktop *app;
Ecore_Timer *reset_timer;
Ecore_Timer *timer;
@@ -105,8 +106,8 @@ static void _ibar_resize_handle(IBar *b);
static void _ibar_instance_drop_zone_recalc(Instance *inst);
static Config_Item *_ibar_config_item_get(const char *id);
static IBar_Icon *_ibar_icon_at_coord(IBar *b, Evas_Coord x, Evas_Coord y);
-static IBar_Icon *_ibar_icon_new(IBar *b, Efreet_Desktop *desktop, Eina_Bool notinorder);
-static IBar_Icon *_ibar_icon_notinorder_new(IBar *b, E_Exec_Instance *exe);
+static IBar_Icon *_ibar_icon_new(IBar *b, E_Client *ec, Efreet_Desktop *desktop, Eina_Bool notinorder);
+static IBar_Icon *_ibar_icon_notinorder_new(IBar *b, E_Exec_Instance *exe, E_Client *ec);
static void _ibar_icon_free(IBar_Icon *ic);
static void _ibar_icon_fill(IBar_Icon *ic);
static void _ibar_icon_empty(IBar_Icon *ic);
@@ -542,7 +543,7 @@ _ibar_fill(IBar *b)
EINA_LIST_FOREACH(b->io->eo->desktops, l, desktop)
{
const Eina_List *ll;
- ic = _ibar_icon_new(b, desktop, 0);
+ ic = _ibar_icon_new(b, NULL, desktop, 0);
ll = e_exec_desktop_instances_find(desktop);
if (ll)
{
@@ -556,18 +557,19 @@ _ibar_fill(IBar *b)
const Eina_Hash *execs = e_exec_instances_get();
Eina_Iterator *it;
const Eina_List *l, *ll;
+ const Eina_Inlist *il;
E_Exec_Instance *exe;
+ E_Client *ec;
it = eina_hash_iterator_data_new(execs);
EINA_ITERATOR_FOREACH(it, l)
{
EINA_LIST_FOREACH(l, ll, exe)
{
- E_Client *ec;
Eina_List *lll;
Eina_Bool skip = EINA_TRUE;
- if (!exe->desktop) continue;
+ //if (!exe->desktop) continue;
EINA_LIST_FOREACH(exe->clients, lll, ec)
if (!ec->netwm.state.skip_taskbar)
{
@@ -575,18 +577,30 @@ _ibar_fill(IBar *b)
break;
}
if (skip) continue;
- ic = eina_hash_find(b->icon_hash, _desktop_name_get(exe->desktop));
- if (ic)
+ if (exe->desktop)
{
- if (!eina_list_data_find(ic->exes, exe))
- ic->exes = eina_list_append(ic->exes, exe);
- continue;
+ ic = eina_hash_find(b->icon_hash, _desktop_name_get(exe->desktop));
+ if (ic)
+ {
+ if (!eina_list_data_find(ic->exes, exe))
+ ic->exes = eina_list_append(ic->exes, exe);
+ continue;
+ }
}
_ibar_sep_create(b);
- _ibar_icon_notinorder_new(b, exe);
+ _ibar_icon_notinorder_new(b, exe, NULL);
}
}
eina_iterator_free(it);
+ EINA_LIST_FOREACH(e_comp->clients, l, ec)
+ {
+ if ((!e_client_util_ignored_get(ec)) && (!e_object_is_del(E_OBJECT(ec))) &&
+ (!e_client_util_is_popup(ec)))
+ {
+ _ibar_sep_create(b);
+ _ibar_icon_notinorder_new(b, NULL, ec);
+ }
+ }
}
_ibar_empty_handle(b);
@@ -732,17 +746,17 @@ _ibar_config_update(Config_Item *ci)
{
case 0:
edje_object_part_text_set(ic->o_holder2, "e.text.label",
- ic->app->name);
+ ic->app ? ic->app->name : "");
break;
case 1:
edje_object_part_text_set(ic->o_holder2, "e.text.label",
- ic->app->comment);
+ ic->app ? ic->app->comment : "");
break;
case 2:
edje_object_part_text_set(ic->o_holder2, "e.text.label",
- ic->app->generic_name);
+ ic->app ? ic->app->generic_name : "");
break;
}
}
@@ -785,15 +799,18 @@ _ibar_icon_at_coord(IBar *b, Evas_Coord x, Evas_Coord y)
}
static IBar_Icon *
-_ibar_icon_new(IBar *b, Efreet_Desktop *desktop, Eina_Bool notinorder)
+_ibar_icon_new(IBar *b, E_Client *ec, Efreet_Desktop *desktop, Eina_Bool notinorder)
{
IBar_Icon *ic;
ic = E_NEW(IBar_Icon, 1);
ic->ibar = b;
ic->app = desktop;
- efreet_desktop_ref(desktop);
+ ic->single_client = ec;
+ if (desktop)
+ efreet_desktop_ref(desktop);
ic->o_holder = edje_object_add(evas_object_evas_get(b->o_box));
+
E_FILL(ic->o_holder);
e_theme_edje_object_set(ic->o_holder, "base/theme/modules/ibar",
"e/modules/ibar/icon");
@@ -825,17 +842,20 @@ _ibar_icon_new(IBar *b, Efreet_Desktop *desktop, Eina_Bool notinorder)
_ibar_icon_fill(ic);
b->icons = eina_inlist_append(b->icons, EINA_INLIST_GET(ic));
- if (eina_hash_find(b->icon_hash, _desktop_name_get(ic->app)))
+ if (ic->app)
{
- char buf[PATH_MAX];
+ if (eina_hash_find(b->icon_hash, _desktop_name_get(ic->app)))
+ {
+ char buf[PATH_MAX];
- ERR("Ibar - Unexpected: icon with same desktop path created twice");
- snprintf(buf, sizeof(buf), "%s::%1.20f",
- _desktop_name_get(ic->app), ecore_time_get());
- ic->hashname = eina_stringshare_add(buf);
+ ERR("Ibar - Unexpected: icon with same desktop path created twice");
+ snprintf(buf, sizeof(buf), "%s::%1.20f",
+ _desktop_name_get(ic->app), ecore_time_get());
+ ic->hashname = eina_stringshare_add(buf);
+ }
+ else ic->hashname = eina_stringshare_add(_desktop_name_get(ic->app));
+ eina_hash_add(b->icon_hash, ic->hashname, ic);
}
- else ic->hashname = eina_stringshare_add(_desktop_name_get(ic->app));
- eina_hash_add(b->icon_hash, ic->hashname, ic);
if (notinorder)
{
ic->not_in_order = 1;
@@ -848,12 +868,15 @@ _ibar_icon_new(IBar *b, Efreet_Desktop *desktop, Eina_Bool notinorder)
}
static IBar_Icon *
-_ibar_icon_notinorder_new(IBar *b, E_Exec_Instance *exe)
+_ibar_icon_notinorder_new(IBar *b, E_Exec_Instance *exe, E_Client *ec)
{
IBar_Icon *ic;
- ic = _ibar_icon_new(b, exe->desktop, 1);
- ic->exes = eina_list_append(ic->exes, exe);
+ ic = _ibar_icon_new(b, ec, exe ? exe->desktop : NULL, 1);
+ if (exe)
+ ic->exes = eina_list_append(ic->exes, exe);
+ //else
+ //ic->clients = eina_list_append(ic->clients, ec);
_ibar_icon_signal_emit(ic, "e,state,on", "e");
return ic;
}
@@ -942,29 +965,38 @@ static void
_ibar_icon_fill(IBar_Icon *ic)
{
if (ic->o_icon) evas_object_del(ic->o_icon);
- ic->o_icon = e_icon_add(evas_object_evas_get(ic->ibar->o_box));
- evas_object_name_set(ic->o_icon, "icon");
- e_icon_fdo_icon_set(ic->o_icon, ic->app->icon);
+ if (ic->o_icon2) evas_object_del(ic->o_icon2);
+ if (ic->single_client)
+ {
+ ic->o_icon = e_client_icon_add(ic->single_client, evas_object_evas_get(ic->ibar->o_box));
+ ic->o_icon2 = e_client_icon_add(ic->single_client, evas_object_evas_get(ic->ibar->o_box));
+ }
+ else
+ {
+ ic->o_icon = e_icon_add(evas_object_evas_get(ic->ibar->o_box));
+ ic->o_icon2 = e_icon_add(evas_object_evas_get(ic->ibar->o_box));
+ evas_object_name_set(ic->o_icon, "icon");
+ e_icon_fdo_icon_set(ic->o_icon, ic->app->icon);
+ e_icon_fdo_icon_set(ic->o_icon2, ic->app->icon);
+ }
edje_object_part_swallow(ic->o_holder, "e.swallow.content", ic->o_icon);
evas_object_show(ic->o_icon);
- if (ic->o_icon2) evas_object_del(ic->o_icon2);
- ic->o_icon2 = e_icon_add(evas_object_evas_get(ic->ibar->o_box));
- e_icon_fdo_icon_set(ic->o_icon2, ic->app->icon);
edje_object_part_swallow(ic->o_holder2, "e.swallow.content", ic->o_icon2);
evas_object_show(ic->o_icon2);
+ const char *single_client_str = e_client_util_name_get(ic->single_client);
switch (ic->ibar->inst->ci->eap_label)
{
case 0: /* Eap Name */
- edje_object_part_text_set(ic->o_holder2, "e.text.label", ic->app->name);
+ edje_object_part_text_set(ic->o_holder2, "e.text.label", ic->single_client ? single_client_str : ic->app->name);
break;
case 1: /* Eap Comment */
- edje_object_part_text_set(ic->o_holder2, "e.text.label", ic->app->comment);
+ edje_object_part_text_set(ic->o_holder2, "e.text.label", ic->single_client ? single_client_str : ic->app->comment);
break;
case 2: /* Eap Generic */
- edje_object_part_text_set(ic->o_holder2, "e.text.label", ic->app->generic_name);
+ edje_object_part_text_set(ic->o_holder2, "e.text.label", ic->single_client ? single_client_str : ic->app->generic_name);
break;
}
}
@@ -1058,7 +1090,8 @@ _ibar_cb_menu_icon_properties(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi
IBar_Icon *ic;
ic = data;
- e_desktop_edit(ic->app);
+ if (ic->app)
+ e_desktop_edit(ic->app);
}
static void
@@ -1066,8 +1099,11 @@ _ibar_cb_menu_icon_stick(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA
{
IBar_Icon *ic = data;
- e_order_append(ic->ibar->io->eo, ic->app);
- _ibar_icon_free(ic);
+ if (ic->app)
+ {
+ e_order_append(ic->ibar->io->eo, ic->app);
+ _ibar_icon_free(ic);
+ }
}
static void
@@ -1077,9 +1113,12 @@ _ibar_cb_menu_icon_remove(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EIN
IBar *i;
i = ic->ibar;
- e_order_remove(i->io->eo, ic->app);
- _ibar_icon_free(ic);
- _ibar_resize_handle(i);
+ if (ic->app)
+ {
+ e_order_remove(i->io->eo, ic->app);
+ _ibar_icon_free(ic);
+ _ibar_resize_handle(i);
+ }
}
static void
@@ -1385,7 +1424,7 @@ _ibar_icon_menu(IBar_Icon *ic, Eina_Bool grab)
Eina_Bool empty = EINA_TRUE;
E_Client *ec;
- if (!ic->exes) return; //FIXME
+ //if (!ic->exes) return; //FIXME
EINA_LIST_FREE(ic->menu_pending, ec)
evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_SHOW, _ibar_exec_new_client_show, ic);
ic->menu = e_gadcon_popup_new(ic->ibar->inst->gcc, 1);
@@ -1417,6 +1456,15 @@ _ibar_icon_menu(IBar_Icon *ic, Eina_Bool grab)
}
}
}
+ if (ic->single_client)
+ {
+ ec = e_client_stack_bottom_get(ic->single_client);
+ if (!_ibar_menu_client_have(ic, ec))
+ {
+ if (_ibar_icon_menu_client_add(ic, ec))
+ empty = EINA_FALSE;
+ }
+ }
if (empty)
{
/* something crazy happened */
@@ -1658,16 +1706,19 @@ _ibar_cb_icon_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
e_menu_item_callback_set(mi, _ibar_cb_menu_icon_remove, ic);
}
- mi = e_menu_item_new_relative(m, NULL);
- snprintf(buf, sizeof(buf), _("Icon %s"), ic->app->name);
- e_menu_item_label_set(mi, buf);
- e_util_desktop_menu_item_icon_add(ic->app,
- e_util_icon_size_normalize(96 * e_scale),
- mi);
- e_menu_item_submenu_set(mi, mo);
+ if (ic->app)
+ {
+ mi = e_menu_item_new_relative(m, NULL);
+ snprintf(buf, sizeof(buf), _("Icon %s"), ic->app->name);
+ e_menu_item_label_set(mi, buf);
+ e_util_desktop_menu_item_icon_add(ic->app,
+ e_util_icon_size_normalize(96 * e_scale),
+ mi);
+ e_menu_item_submenu_set(mi, mo);
+ }
e_object_unref(E_OBJECT(mo));
- if (ic->app->actions)
+ if (ic->app && ic->app->actions)
{
mi = NULL;
EINA_LIST_FOREACH(ic->app->actions, it, action)
@@ -1882,6 +1933,7 @@ _ibar_cb_icon_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
IBar_Icon *ic = data;
int dx, dy;
+ if (!ic->app) return;
E_FREE_FUNC(ic->timer, ecore_timer_del);
if (!ic->drag.start) return;
@@ -2675,7 +2727,7 @@ _ibar_cb_client_prop(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Prop
else if (!b->inst->ci->dont_add_nonorder)
{
_ibar_sep_create(b);
- _ibar_icon_notinorder_new(b, ec->exe_inst);
+ _ibar_icon_notinorder_new(b, ec->exe_inst, NULL);
_ibar_resize_handle(b);
}
}
@@ -2710,11 +2762,21 @@ _ibar_cb_client_del(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
E_Exec_Instance *exe;
int client_num = 0;
- if (!ev->ec->desktop) return ECORE_CALLBACK_RENEW; //can't do anything here :(
EINA_LIST_FOREACH(ibars, l, b)
{
IBar_Icon *ic;
+ if (!ev->ec->desktop)
+ {
+ EINA_INLIST_FOREACH(b->icons, ic)
+ if (ic->single_client && ic->single_client == ev->ec)
+ {
+ _ibar_icon_free(ic);
+ break;
+ }
+ continue;
+ }
+
ic = eina_hash_find(b->icon_hash, _desktop_name_get(ev->ec->desktop));
if (ic)
{
@@ -2809,7 +2871,7 @@ _ibar_cb_exec_new_client(void *d EINA_UNUSED, int t EINA_UNUSED, E_Exec_Instance
{
if (skip) continue;
_ibar_sep_create(b);
- _ibar_icon_notinorder_new(b, exe);
+ _ibar_icon_notinorder_new(b, exe, NULL);
_ibar_resize_handle(b);
}
}
@@ -2854,13 +2916,44 @@ _ibar_cb_exec_new(void *d EINA_UNUSED, int t EINA_UNUSED, E_Exec_Instance *exe)
{
if (skip) continue;
_ibar_sep_create(b);
- ic = _ibar_icon_notinorder_new(b, exe);
+ ic = _ibar_icon_notinorder_new(b, exe, NULL);
_ibar_resize_handle(b);
}
}
return ECORE_CALLBACK_RENEW;
}
+static Eina_Bool
+_ibar_cb_client_add(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
+{
+ IBar *b;
+ Eina_List *l;
+
+ if (!(ev && ibars)) return ECORE_CALLBACK_RENEW;
+ if (e_client_util_ignored_get(ev->ec) || e_object_is_del(E_OBJECT(ev->ec))) return ECORE_CALLBACK_RENEW;
+ if (e_client_util_is_popup(ev->ec)) return ECORE_CALLBACK_RENEW;
+ if (ev->ec->netwm.state.skip_taskbar) return ECORE_CALLBACK_RENEW;
+
+ EINA_LIST_FOREACH(ibars, l, b)
+ {
+ IBar_Icon *ic;
+
+ if (b->inst->ci->dont_add_nonorder)
+ continue;
+ // exe_inst check also applies to builtin popups :)
+ if (ev->ec->exe_inst && ev->ec->exe_inst->desktop)
+ {
+ ic = eina_hash_find(b->icon_hash, _desktop_name_get(ev->ec->exe_inst->desktop));
+ if (ic) continue;
+ }
+
+ _ibar_sep_create(b);
+ _ibar_icon_notinorder_new(b, ev->ec->exe_inst, ev->ec);
+ _ibar_resize_handle(b);
+ }
+ return EINA_TRUE;
+}
+
/* module setup */
E_API E_Module_Api e_modapi =
{
@@ -2917,6 +3010,8 @@ e_modapi_init(E_Module *m)
_ibar_cb_config_icons, NULL);
E_LIST_HANDLER_APPEND(ibar_config->handlers, EFREET_EVENT_ICON_CACHE_UPDATE,
_ibar_cb_config_icons, NULL);
+ E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_CLIENT_ADD,
+ _ibar_cb_client_add, NULL);
E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_EXEC_NEW,
_ibar_cb_exec_new, NULL);
E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_EXEC_NEW_CLIENT,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.