Skip to content

Commit

Permalink
Add Ctrl-Q hotkey to quit the program
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Feb 3, 2024
1 parent 721d0e1 commit f4b3f32
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f4b3f32

Please sign in to comment.