[client] Add support for hide/unhide

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-09 18:24:12 +02:00
parent 816b5d16bc
commit ac1517bacb
4 changed files with 34 additions and 8 deletions

View File

@ -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 }

View File

@ -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;

View File

@ -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,

View File

@ -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