diff --git a/client.c b/client.c index b3defc72f..a9a8879f0 100644 --- a/client.c +++ b/client.c @@ -1112,6 +1112,18 @@ luaA_client_tostring(lua_State *L) return 1; } +static int +luaA_client_icon_set(lua_State *L) +{ + client_t **c = luaL_checkudata(L, 1, "client"); + const char *icon = luaL_optstring(L, 2, NULL); + + p_delete(&(*c)->icon_path); + (*c)->icon_path = a_strdup(icon); + + return 0; +} + const struct luaL_reg awesome_client_methods[] = { { "get", luaA_client_get }, @@ -1137,6 +1149,7 @@ const struct luaL_reg awesome_client_meta[] = { "redraw", luaA_client_redraw }, { "floating_set", luaA_client_floating_set }, { "floating_get", luaA_client_floating_get }, + { "icon_set", luaA_client_icon_set }, { "__eq", luaA_client_eq }, { "__tostring", luaA_client_tostring }, { NULL, NULL } diff --git a/structs.h b/structs.h index b7ac2bd26..de35b5b73 100644 --- a/structs.h +++ b/structs.h @@ -268,6 +268,8 @@ struct client_t position_t titlebar_oldposition; /** Layer in the stacking order */ layer_t layer, oldlayer; + /** Path to an icon */ + char *icon_path; }; typedef struct client_node_t client_node_t; diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 0cd44dda0..1854fc5db 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -116,9 +116,9 @@ tasklist_draw(widget_node_t *w, statusbar_t *statusbar, int offset, int used) draw_rectangle(statusbar->ctx, area, 1.0, true, statusbar->colors.bg); - if(0) + if(c->icon_path) { -// area = draw_get_image_size(r->icon); + area = draw_get_image_size(c->icon_path); if(area.width > 0 && area.height > 0) { icon_width = ((double) statusbar->height / (double) area.height) * area.width; @@ -126,8 +126,7 @@ tasklist_draw(widget_node_t *w, statusbar_t *statusbar, int offset, int used) w->area.x + box_width * i, w->area.y, statusbar->height, - NULL); -// r->icon); + c->icon_path); } }