From 6933f5438f303cd90346ae779af141f910a4a1b1 Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Thu, 23 Oct 2025 13:58:43 -0400 Subject: clipboard with wl-paste --- input_field.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'input_field.c') diff --git a/input_field.c b/input_field.c index a0d5cc6..6b34b1f 100644 --- a/input_field.c +++ b/input_field.c @@ -123,26 +123,14 @@ bool type_key(client_state* state, xkb_keysym_t keysym) { // paste if (keysym == XKB_KEY_v && ctrl) { - FILE* fp = popen("wl-paste --no-newline --type text/plain 2>/dev/null", "r"); - if (!fp) return false; - char* buffer = NULL; - size_t size = 0; - ssize_t len = getdelim(&buffer, &size, '\0', fp); - int status = pclose(fp); - - if (status != 0 || len <= 0) { - free(buffer); - return false; - } - - for (size_t i = 0; i < len; ++i) { - array_add(state->input_buffer, buffer[i]); + for (size_t i = 0; i < state->clipboard_size; ++i) { + array_insert(state->input_buffer, state->cursor_index, state->clipboard[i]); + ++state->cursor_index; } update_text_buffer(state); - free(buffer); return true; } -- cgit v1.2.3