Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

sowm: Add existing clients #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions sowm.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ void input_grab(Window root) {
XFreeModifiermap(modmap);
}

void win_init(void) {
Window *child;
unsigned int i, n_child;

XQueryTree(d, RootWindow(d, DefaultScreen(d)),
&(Window){0}, &(Window){0}, &child, &n_child);

for (i = 0; i < n_child; i++) {
XSelectInput(d, child[i], StructureNotifyMask|EnterWindowMask);
XMapWindow(d, child[i]);
win_add(child[i]);
}
}

int main(void) {
XEvent ev;

Expand All @@ -271,6 +285,7 @@ int main(void) {
XSelectInput(d, root, SubstructureRedirectMask);
XDefineCursor(d, root, XCreateFontCursor(d, 68));
input_grab(root);
win_init();

while (1 && !XNextEvent(d, &ev))
if (events[ev.type]) events[ev.type](&ev);
Expand Down
1 change: 1 addition & 0 deletions sowm.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void win_focus(client *c);
void win_kill(const Arg arg);
void win_prev(const Arg arg);
void win_next(const Arg arg);
void win_init(void);
void win_to_ws(const Arg arg);
void ws_go(const Arg arg);

Expand Down