gimp but for windows: a wayland compositor
git clone https://github.com/m-col/wimp
Files | Refs | Readme

Commit 4f209b64b5ce30a8d36567d524faba1e4c36e430
Parent: a3db1001b57a3a58cb887ec2664e1728af5e358d
Author: mcol <mcol@posteo.net>
Date: 2021-01-30 01:30:42 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-01-30 01:30:42 +0000

add action to move window to other desk

src/desk.h Modified

@@ -5,5 +5,6 @@
 
 void add_desk();
 void set_desk(struct desk *desk);
+void view_to_desk(struct view *view, int index);
 
 #endif

src/desk.c Modified

@@ -40,3 +40,19 @@
 	focus_view(view, view->surface->surface);
     }
 }
+
+
+void view_to_desk(struct view *view, int index) {
+    struct desk *desk;
+    wl_list_for_each(desk, &wimp.desks, link) {
+	if (desk->index == index) {
+	    wl_list_remove(&view->link);
+	    if (desk == wimp.current_desk) {
+		map_view(view);
+	    } else {
+		unmap_view(view);
+	    }
+	    wl_list_insert(&desk->views, &view->link);
+	}
+    }
+}

src/config.c Modified

@@ -150,6 +150,7 @@
     { "toggle_fullscreen", &toggle_fullscreen, NULL },
     { "halfimize", &halfimize, &dir_handler },
     { "reload_config", &reload_config, NULL },
+    { "send_to_desk", &send_to_desk, &str_handler },
 };
 
 static const int num_actions = sizeof(action_map) / sizeof(action_map[0]);

src/action.h Modified

@@ -22,5 +22,6 @@
 void toggle_fullscreen(void *data);
 void halfimize(void *data);
 void reload_config(void *data);
+void send_to_desk(void *data);
 
 #endif

src/action.c Modified

@@ -331,3 +331,10 @@
 void reload_config(void *data) {
     load_config();
 }
+
+
+void send_to_desk(void *data) {
+    struct view *view = wl_container_of(wimp.current_desk->views.next, view, link);
+    int index = *(int*)data;
+    view_to_desk(view, index);
+}