feat(swappy): copy to clipboard with CTRL+C

This commit is contained in:
Jeremy Attali 2019-12-23 16:56:12 -05:00
parent e946b241bf
commit b90500ed34
2 changed files with 8 additions and 0 deletions

View File

@ -208,6 +208,8 @@ static void keypress_handler(GtkWidget *widget, GdkEventKey *event,
switch_mode_to_arrow(state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state->popover->arrow),
true);
} else if (event->keyval == GDK_KEY_c && event->state & GDK_CONTROL_MASK) {
clipboard_copy_drawing_area_to_selection(state);
}
}

View File

@ -1,5 +1,7 @@
#include "clipboard.h"
#include "notification.h"
bool clipboard_copy_drawing_area_to_selection(struct swappy_state *state) {
g_debug("generating pixbuf from area");
GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
@ -10,5 +12,9 @@ bool clipboard_copy_drawing_area_to_selection(struct swappy_state *state) {
gtk_clipboard_set_image(clipboard, pixbuf);
char message[MAX_PATH];
snprintf(message, MAX_PATH, "Swappshot copied to clipboard\n");
notification_send("Swappy", message);
return true;
}