foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

commit 0fe98fa4606e2b84e62764ee459d25df7d2105d0
parent 8bb2a94fbb8b86a52b80781c4f666e0376389f74
Author: Miles Sandlar <miles.sandlar@gmail.com>
Date:   Sun, 17 Jun 2012 20:27:52 -0400

changeWorkspace() function & call from FIFO
Fully working using syntax: workspace [0-9]

Diffstat:
Mfifo-wm.c | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/fifo-wm.c b/fifo-wm.c @@ -46,9 +46,29 @@ void handleCommand(char* request) { } else if (!strcmp(tokens[0], "workspace")) { int workspace = atoi(tokens[1]); fprintf(stderr, "Switchin to workspace %d", workspace); + changeWorkspace(workspace); } } +int changeWorkspace(int workspace) { + + fprintf(stderr, "Running change workspace to %d", workspace); + if (workspace == currentWorkspace) { return False; } + + Client *client; + for (client=workspaces[workspace].last; client; client = client -> previous) { + XMapWindow(display, client -> window); + } + + for (client=workspaces[currentWorkspace].last; client; client = client -> previous) { + XUnmapWindow(display, client -> window); + } + + currentWorkspace = workspace; + return True; +} + + /* ==================== * Handling of X Events * ==================== */ @@ -57,6 +77,7 @@ void xMapRequest(XEvent *event) { newClient = malloc(sizeof(Client)); newClient -> window = event -> xmaprequest.window; newClient -> previous = workspaces[currentWorkspace].last; + workspaces[currentWorkspace].last = newClient; XMapWindow(display, newClient -> window); } @@ -115,6 +136,8 @@ int main() { display = XOpenDisplay(NULL); assert(display); + memset(&workspaces, 0x00, sizeof(Workspace)*10); + root = RootWindow(display, activeScreen); activeScreen = DefaultScreen(display);