Skip to content

Commit

Permalink
Handle WM_CHANGE_STATE, unhide windows on focus
Browse files Browse the repository at this point in the history
  • Loading branch information
nwwdles committed Aug 6, 2020
1 parent 5298a91 commit 87ae795
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/bspwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ motion_recorder_t motion_recorder;
xcb_atom_t WM_STATE;
xcb_atom_t WM_TAKE_FOCUS;
xcb_atom_t WM_DELETE_WINDOW;
xcb_atom_t WM_CHANGE_STATE;
int exit_status;

bool auto_raise;
Expand Down Expand Up @@ -394,6 +395,7 @@ void setup(void)
GETATOM(WM_STATE)
GETATOM(WM_DELETE_WINDOW)
GETATOM(WM_TAKE_FOCUS)
GETATOM(WM_CHANGE_STATE)
#undef GETATOM

const xcb_query_extension_reply_t *qep = xcb_get_extension_data(dpy, &xcb_randr_id);
Expand Down
1 change: 1 addition & 0 deletions src/bspwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ extern motion_recorder_t motion_recorder;
extern xcb_atom_t WM_STATE;
extern xcb_atom_t WM_TAKE_FOCUS;
extern xcb_atom_t WM_DELETE_WINDOW;
extern xcb_atom_t WM_CHANGE_STATE;
extern int exit_status;

extern bool auto_raise;
Expand Down
6 changes: 6 additions & 0 deletions src/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ void client_message(xcb_generic_event_t *evt)
loc.node == mon->desk->focus) {
return;
}
set_hidden(loc.monitor, loc.desktop, loc.node, false);
arrange(loc.monitor, loc.desktop);
focus_node(loc.monitor, loc.desktop, loc.node);
} else if (e->type == ewmh->_NET_WM_DESKTOP) {
coordinates_t dloc;
Expand All @@ -337,6 +339,10 @@ void client_message(xcb_generic_event_t *evt)
}
} else if (e->type == ewmh->_NET_CLOSE_WINDOW) {
close_node(loc.node);
} else if (e->type == WM_CHANGE_STATE) {
set_hidden(loc.monitor, loc.desktop, loc.node,
e->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC || e->data.data32[0] == XCB_ICCCM_WM_STATE_WITHDRAWN);
arrange(loc.monitor, loc.desktop);
}
}

Expand Down

0 comments on commit 87ae795

Please sign in to comment.