From f4b3f325d1322931570b0f363135a48a9a63b76e Mon Sep 17 00:00:00 2001 From: jfreegman Date: Sat, 3 Feb 2024 00:06:10 -0500 Subject: [PATCH] Add Ctrl-Q hotkey to quit the program --- src/gui.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui.cpp b/src/gui.cpp index a368e6b..d918447 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -189,6 +189,11 @@ static gboolean on_special_key_press(GtkWidget *widget, GdkEventKey *event, gpoi return TRUE; } + if ((event->state & GDK_CONTROL_MASK) && event->keyval == 'q') { + on_quit(NULL, data); + return TRUE; + } + return FALSE; } @@ -1244,7 +1249,7 @@ static void show_tray_menu(GdkEventButton *event, struct Callback_Data *cb_data) GtkWidget *menuQuit = gtk_menu_item_new_with_label("Quit"); g_signal_connect(menuAbout, "activate", G_CALLBACK(on_menuAbout_activate), cb_data); - g_signal_connect(menuQuit, "activate", G_CALLBACK(on_quit), NULL); + g_signal_connect(menuQuit, "activate", G_CALLBACK(on_quit), cb_data); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuAbout); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuQuit);