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

Commit c63b1ee08f1a9f9c2ab48edfd230b7bc467b16f9
Parent: a7e9608a050a0a483ef8c3ad2c078ffa056f5462
Author: mcol <mcol@posteo.net>
Date: 2020-11-24 13:15:43 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2020-11-24 13:15:43 +0000

add indicator to indicate set_mark or go_to_mark is waiting for a key

src/types.h Modified

@@ -24,6 +24,11 @@
 
 typedef void (*action)(struct server *server, void *data);
 
+struct mark_indicator {
+    float colour[4];
+    struct wlr_box box;
+};
+
 struct server {
     struct wl_display *display;
     struct wlr_backend *backend;
@@ -41,6 +46,7 @@
     bool can_steal_focus;
     struct wl_list marks;
     bool mark_waiting;
+    struct mark_indicator mark_indicator;
 
     struct wlr_cursor *cursor;
     struct wlr_xcursor_manager *cursor_manager;

src/output.c Modified

@@ -70,8 +70,9 @@
 
 void on_frame(struct wl_listener *listener, void *data) {
     struct output *output = wl_container_of(listener, output, frame_listener);
-    struct wlr_renderer *renderer = output->server->renderer;
-    struct desk *desk = output->server->current_desk;
+    struct server *server = output->server;
+    struct wlr_renderer *renderer = server->renderer;
+    struct desk *desk = server->current_desk;
 
     struct timespec now;
     clock_gettime(CLOCK_MONOTONIC, &now);
@@ -101,6 +102,7 @@
 	}
     }
 
+    // paint clients
     struct view *view;
     wl_list_for_each_reverse(view, &desk->views, link) {
 	struct render_data rdata = {
@@ -115,6 +117,16 @@
 	);
     }
 
+    // paint mark indicator
+    if (server->mark_waiting) {
+	struct wlr_box indicator = server->mark_indicator.box;
+	indicator.y = height - indicator.height;
+	wlr_render_rect(
+	    renderer, &indicator, server->mark_indicator.colour,
+	    output->wlr_output->transform_matrix
+	);
+    }
+
     wlr_output_render_software_cursors(output->wlr_output, NULL);  // no-op with HW cursors
     wlr_renderer_end(renderer);
     wlr_output_commit(output->wlr_output);

src/config.c Modified

@@ -233,6 +233,11 @@
 
     wl_list_init(&server->marks);
     server->mark_waiting = false;
+    assign_colour("#000000", server->mark_indicator.colour);
+    server->mark_indicator.box.width = 25;
+    server->mark_indicator.box.height = 25;
+    server->mark_indicator.box.x = 0;
+    server->mark_indicator.box.y = 0;
 }
 
 
@@ -316,6 +321,8 @@
 	    }
 	} else if (!strcasecmp(s, "bind")) {
 	    add_binding(server, strtok(NULL, ""), line);
+	} else if (!strcasecmp(s, "mark_indicator")) {
+	    assign_colour(strtok(NULL, " \t\n\r"), server->mark_indicator.colour);
 	} else if (!strcasecmp(s, "vt_switching")) {
 	    s = strtok(NULL, " \t\n\r");
 	    if (!strcasecmp(s, "off"))

deskwm.conf Modified

@@ -19,6 +19,9 @@
 #zoom_min 0.5
 #zoom_max 3
 
+# Set the colour for the mark setter/getter indicator
+#mark_indicator #000000
+
 # Whether to allow VT switching: on or off.
 #vt_switching on