diff --git a/client.c b/client.c index 447eb743..cd33b2e6 100644 --- a/client.c +++ b/client.c @@ -251,6 +251,7 @@ client_focus(client_t *c) /* stop hiding c */ c->ishidden = false; + c->isminimized = false; /* unban the client before focusing or it will fail */ client_unban(c); @@ -1302,6 +1303,15 @@ luaA_client_newindex(lua_State *L) client_need_arrange(*c); } break; + case A_TK_MINIMIZE: + b = luaA_checkboolean(L, 3); + if(b != (*c)->isminimized) + { + client_need_arrange(*c); + (*c)->isminimized = b; + client_need_arrange(*c); + } + break; case A_TK_FULLSCREEN: client_setfullscreen(*c, luaA_checkboolean(L, 3)); break; @@ -1393,7 +1403,11 @@ luaA_client_newindex(lua_State *L) * \lfield machine The machine client is running on. * \lfield icon_name The client name when iconified. * \lfield screen Client screen number. - * \lfield hide Define if the client must be hidden, i.e. never mapped. + * \lfield hide Define if the client must be hidden, i.e. never mapped, not + * visible in taskbar. + * invisible in taskbar. + * \lfield minimize Define it the client must be iconify, i.e. only visible in + * taskbar. * \lfield icon_path Path to the icon used to identify. * \lfield floating True always floating. * \lfield honorsizehints Honor size hints, i.e. respect size ratio. @@ -1508,6 +1522,9 @@ luaA_client_index(lua_State *L) case A_TK_HIDE: lua_pushboolean(L, (*c)->ishidden); break; + case A_TK_MINIMIZE: + lua_pushboolean(L, (*c)->isminimized); + break; case A_TK_FULLSCREEN: lua_pushboolean(L, (*c)->isfullscreen); break; diff --git a/client.h b/client.h index 0b183239..2936fa38 100644 --- a/client.h +++ b/client.h @@ -108,7 +108,7 @@ client_isfloating(client_t *c) static inline bool client_isvisible(client_t *c, int screen) { - return (!c->ishidden && client_maybevisible(c, screen)); + return (!c->ishidden && !c->isminimized && client_maybevisible(c, screen)); } /** Check if a client has strut information. diff --git a/common/tokenize.gperf b/common/tokenize.gperf index 8e504e9a..b3d73d45 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -34,6 +34,7 @@ layout left line machine +minimize mouse_enter mouse_leave mwfact diff --git a/event.c b/event.c index 40c17929..6f3a62f5 100644 --- a/event.c +++ b/event.c @@ -579,9 +579,10 @@ event_handle_maprequest(void *data __attribute__ ((unused)), } else if((c = client_getbywin(ev->window))) { - if(client_maybevisible(c, c->screen)) + /* Check that it may be visible, but not asked to be hidden */ + if(client_maybevisible(c, c->screen) && !c->ishidden) { - c->ishidden = false; + c->isminimized = false; globalconf.screens[c->screen].need_arrange = true; xcb_map_window(globalconf.connection, ev->window); /* it will be raised, so just update ourself */ @@ -760,7 +761,7 @@ event_handle_clientmessage(void *data __attribute__ ((unused)), && ev->data.data32[0] == XCB_WM_STATE_ICONIC) { client_need_arrange(c); - c->ishidden = true; + c->isminimized = true; } } else if(ev->type == _XEMBED) diff --git a/ewmh.c b/ewmh.c index e4d00389..d6bb4e4e 100644 --- a/ewmh.c +++ b/ewmh.c @@ -296,12 +296,14 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set) if(set == _NET_WM_STATE_REMOVE) { client_need_arrange(c); - c->ishidden = false; + c->isminimized = false; + client_need_arrange(c); } else if(set == _NET_WM_STATE_ADD) { client_need_arrange(c); - c->ishidden = true; + c->isminimized = true; + client_need_arrange(c); } } else if(state == _NET_WM_STATE_DEMANDS_ATTENTION) diff --git a/structs.h b/structs.h index 805d816d..096f0070 100644 --- a/structs.h +++ b/structs.h @@ -306,6 +306,8 @@ struct client_t bool ismoving; /** True if the client is hidden */ bool ishidden; + /** True if the client is minimized */ + bool isminimized; /** True if the client is fullscreen */ bool isfullscreen; /** True if the client is above others */ diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 2aa78db1..caea9db3 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -216,6 +216,7 @@ tasklist_draw(draw_context_t *ctx, int screen, for(c = globalconf.clients; c; c = c->next) if(!c->skiptb + && !c->ishidden && c->type != WINDOW_TYPE_SPLASH && c->type != WINDOW_TYPE_DOCK && c->type != WINDOW_TYPE_DESKTOP)