Skip to content

Instantly share code, notes, and snippets.

@vdudouyt
Created January 19, 2016 07:22
Show Gist options
  • Save vdudouyt/e5ac51d0295e2264c463 to your computer and use it in GitHub Desktop.
Save vdudouyt/e5ac51d0295e2264c463 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <gtkhotkey.h>
void hotkey_activated_callback (GtkHotkeyInfo *hotkey, guint event_time, void *data)
{
g_message("activated");
}
int main(int argc, char **argv)
{
gtk_init (&argc, &argv);
GtkHotkeyInfo *hotkey = gtk_hotkey_info_new("clicks-emulator", "hotkey1", "<Control>F12", NULL);
GError *error = NULL;
gtk_hotkey_info_bind(hotkey, &error);
if (error)
{
g_critical ("Error binding hotkey: %s",
error->message);
}
g_signal_connect(hotkey, "activated", G_CALLBACK(hotkey_activated_callback), NULL);
gtk_main();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment