[client] Add support for hide/unhide
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
816b5d16bc
commit
ac1517bacb
30
client.c
30
client.c
|
@ -126,7 +126,7 @@ client_isvisible_anyscreen(client_t *c)
|
|||
workspace_t *ws;
|
||||
int screen;
|
||||
|
||||
if(c)
|
||||
if(c && !c->ishidden)
|
||||
{
|
||||
ws = workspace_client_get(c);
|
||||
for(screen = 0; screen < globalconf.screens_info->nscreen; screen++)
|
||||
|
@ -146,7 +146,7 @@ client_isvisible_anyscreen(client_t *c)
|
|||
bool
|
||||
client_isvisible(client_t *c, int screen)
|
||||
{
|
||||
if(c)
|
||||
if(c && !c->ishidden)
|
||||
return (workspace_client_get(c) == globalconf.screens[screen].workspace);
|
||||
return false;
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ luaA_client_visible_get(lua_State *L)
|
|||
lua_newtable(L);
|
||||
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(!c->skip && client_isvisible(c, screen))
|
||||
if(!c->skip && !c->ishidden && client_isvisible(c, screen))
|
||||
{
|
||||
luaA_client_userdata_new(c);
|
||||
lua_rawseti(L, -2, i++);
|
||||
|
@ -1169,6 +1169,28 @@ luaA_client_unmanage(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Hide a client.
|
||||
*/
|
||||
static int
|
||||
luaA_client_hide(lua_State *L)
|
||||
{
|
||||
client_t **c = luaA_checkudata(L, 1, "client");
|
||||
(*c)->ishidden = true;
|
||||
workspace_client_get(*c)->need_arrange = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Unhide a client.
|
||||
*/
|
||||
static int
|
||||
luaA_client_unhide(lua_State *L)
|
||||
{
|
||||
client_t **c = luaA_checkudata(L, 1, "client");
|
||||
(*c)->ishidden = false;
|
||||
workspace_client_get(*c)->need_arrange = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
luaA_client_userdata_new(client_t *c)
|
||||
{
|
||||
|
@ -1209,6 +1231,8 @@ const struct luaL_reg awesome_client_meta[] =
|
|||
{ "mouse_resize", luaA_client_mouse_resize },
|
||||
{ "mouse_move", luaA_client_mouse_move },
|
||||
{ "unmanage", luaA_client_unmanage },
|
||||
{ "hide", luaA_client_hide },
|
||||
{ "unhide", luaA_client_unhide },
|
||||
{ "__eq", luaA_client_eq },
|
||||
{ "__tostring", luaA_client_tostring },
|
||||
{ NULL, NULL }
|
||||
|
|
2
focus.c
2
focus.c
|
@ -67,7 +67,7 @@ focus_get_latest_client_for_workspace(workspace_t *ws, int nindex)
|
|||
int i = 0;
|
||||
|
||||
for(node = globalconf.focus; node; node = node->next)
|
||||
if(node->client && !node->client->skip)
|
||||
if(node->client && !node->client->skip && !node->client->ishidden)
|
||||
if(workspace_client_get(node->client) == ws)
|
||||
if(i-- == nindex)
|
||||
return node->client;
|
||||
|
|
4
layout.c
4
layout.c
|
@ -49,13 +49,13 @@ arrange(workspace_t *ws)
|
|||
workspace_t *cws;
|
||||
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if((cws = workspace_client_get(c)) == ws)
|
||||
if((cws = workspace_client_get(c)) == ws && !c->ishidden)
|
||||
{
|
||||
screen_client_moveto(c, screen);
|
||||
client_unban(c);
|
||||
}
|
||||
/* we don't touch other screens windows */
|
||||
else if(workspace_screen_get(cws) == -1)
|
||||
else if(c->ishidden || workspace_screen_get(cws) == -1)
|
||||
client_ban(c);
|
||||
|
||||
qp_c = xcb_query_pointer_unchecked(globalconf.connection,
|
||||
|
|
|
@ -274,10 +274,10 @@ struct client_t
|
|||
bool skip;
|
||||
/** true if the client is moving */
|
||||
bool ismoving;
|
||||
/** True if the client is hidden */
|
||||
bool ishidden;
|
||||
/** true if the client must be skipped from task bar client list */
|
||||
bool skiptb;
|
||||
/** Next and previous clients */
|
||||
client_t *prev, *next;
|
||||
/** Window of the client */
|
||||
xcb_window_t win;
|
||||
/** Client physical screen */
|
||||
|
@ -288,6 +288,8 @@ struct client_t
|
|||
char *icon_path;
|
||||
/** Titlebar */
|
||||
titlebar_t *titlebar;
|
||||
/** Next and previous clients */
|
||||
client_t *prev, *next;
|
||||
};
|
||||
|
||||
struct client_node_t
|
||||
|
|
Loading…
Reference in New Issue