Implement a command for hiding all floating windows (and showing them again)
This commit is contained in:
parent
5c48444b4e
commit
89c0caaec4
|
@ -163,6 +163,8 @@ struct Workspace {
|
|||
|
||||
/* Should clients on this workspace be automatically floating? */
|
||||
bool auto_float;
|
||||
/* Are the floating clients on this workspace currently hidden? */
|
||||
bool floating_hidden;
|
||||
|
||||
Client *fullscreen_client;
|
||||
|
||||
|
|
|
@ -52,4 +52,11 @@ void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused,
|
|||
*/
|
||||
void floating_move(xcb_connection_t *conn, Client *currently_focused, direction_t direction);
|
||||
|
||||
/**
|
||||
* Hides all floating clients (or show them if they are currently hidden) on
|
||||
* the specified workspace.
|
||||
*
|
||||
*/
|
||||
void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -625,12 +625,9 @@ void show_workspace(xcb_connection_t *conn, int workspace) {
|
|||
xcb_map_window(conn, client->frame);
|
||||
|
||||
/* Map all floating clients */
|
||||
SLIST_FOREACH(client, &(c_ws->focus_stack), focus_clients) {
|
||||
if (client->floating <= FLOATING_USER_OFF)
|
||||
continue;
|
||||
|
||||
xcb_map_window(conn, client->frame);
|
||||
}
|
||||
if (!c_ws->floating_hidden)
|
||||
TAILQ_FOREACH(client, &(c_ws->floating_clients), floating_clients)
|
||||
xcb_map_window(conn, client->frame);
|
||||
|
||||
/* Map all stack windows, if any */
|
||||
struct Stack_Window *stack_win;
|
||||
|
@ -854,6 +851,12 @@ void parse_command(xcb_connection_t *conn, const char *command) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (command[0] == 'H') {
|
||||
LOG("Hiding all floating windows\n");
|
||||
floating_toggle_hide(conn, c_ws);
|
||||
return;
|
||||
}
|
||||
|
||||
enum { WITH_WINDOW, WITH_CONTAINER, WITH_WORKSPACE } with = WITH_WINDOW;
|
||||
|
||||
/* Is it a <with>? */
|
||||
|
|
|
@ -355,3 +355,31 @@ void floating_move(xcb_connection_t *conn, Client *currently_focused, direction_
|
|||
fake_absolute_configure_notify(conn, currently_focused);
|
||||
/* fake_absolute_configure_notify flushes */
|
||||
}
|
||||
|
||||
/*
|
||||
* Hides all floating clients (or show them if they are currently hidden) on
|
||||
* the specified workspace.
|
||||
*
|
||||
*/
|
||||
void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace) {
|
||||
Client *client;
|
||||
|
||||
workspace->floating_hidden = !workspace->floating_hidden;
|
||||
LOG("floating_hidden is now: %d\n", workspace->floating_hidden);
|
||||
TAILQ_FOREACH(client, &(workspace->floating_clients), floating_clients) {
|
||||
if (workspace->floating_hidden)
|
||||
xcb_unmap_window(conn, client->frame);
|
||||
else xcb_map_window(conn, client->frame);
|
||||
}
|
||||
|
||||
/* If we just unmapped all floating windows we should ensure that the focus
|
||||
* is set correctly, that ist, to the first non-floating client in stack */
|
||||
if (workspace->floating_hidden)
|
||||
SLIST_FOREACH(client, &(workspace->focus_stack), focus_clients)
|
||||
if (client->floating <= FLOATING_USER_OFF) {
|
||||
set_focus(conn, client, true);
|
||||
return;
|
||||
}
|
||||
|
||||
xcb_flush(conn);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue