aboutsummaryrefslogtreecommitdiff
path: root/input_field.c
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2025-10-23 13:58:43 -0400
committerJack Jamison <jackqjamison@gmail.com>2025-10-23 13:58:43 -0400
commit6933f5438f303cd90346ae779af141f910a4a1b1 (patch)
treeedd477d1d42f35bdcbc13e5dc0aef9b1c44899e6 /input_field.c
parent9d8db4146d025e3a967700414a9fc68fa186045e (diff)
clipboard with wl-paste
Diffstat (limited to 'input_field.c')
-rw-r--r--input_field.c18
1 files changed, 3 insertions, 15 deletions
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;
}