Hi all,
I want i3 to switch the workspace when I move the mouse pointer at the
border of the screen. It should then get to the next/prev workspace, warp the
pointer to the "oposit x" position and set the container beneath active.
Here is some sloppy code to show you what I mean:
diff --git a/src/handlers.c b/src/handlers.c
index 6b79ed4..87bca5b 100644
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -259,6 +259,20 @@ static int
handle_motion_notify(xcb_motion_notify_event_t *event) {
return 1;
}
+ /* see if we need to switch the workspace */
+ if (0 == event->root_x) {
+ workspace_prev();
+ xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0,
root_screen->width_in_pixels-2, event->root_y);
+ }
+
+ if (root_screen->width_in_pixels-1 <= event->root_x) {
+ workspace_next();
+ xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, 1,
event->root_y);
+ }
+
+ /* refresh the screen */
+ tree_render();
+
return 1;
}
This code of course does not set the container active and has some more
disadvantages. I can only test the behaviour on a single screen computer
because I do not own one with two screens. So if you have a dual screen
set up it might drive you crazy ;)
Can you give me some advice on how to implement this feature best. It
might also be a good idea to make it an option. How should I call that
option?
Best regards,
Bernhard