implement urgent on beep
This commit is contained in:
parent
8a37b88957
commit
e398fcb7d2
2
config.h
2
config.h
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define URGENT_ON_BEEP
|
||||
|
||||
static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*";
|
||||
static const char *url_command = "/usr/bin/firefox";
|
||||
|
||||
|
|
19
term.c
19
term.c
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
# define __attribute__(x)
|
||||
#endif
|
||||
|
||||
enum search_direction {
|
||||
search_forward,
|
||||
search_backward
|
||||
|
@ -123,6 +127,15 @@ static gboolean button_press_cb(VteTerminal *vte, GdkEventButton *event) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef URGENT_ON_BEEP
|
||||
static void beep_handler(__attribute__((unused)) VteTerminal *vte, GtkWidget *window) {
|
||||
GtkWindow *gwin = GTK_WINDOW(window);
|
||||
if (!gtk_window_is_active(gwin)) {
|
||||
gtk_window_set_urgency_hint(gwin, TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
GError *error = NULL;
|
||||
|
||||
|
@ -203,6 +216,12 @@ int main(int argc, char **argv) {
|
|||
g_signal_connect(vte, "button-press-event", G_CALLBACK(button_press_cb), NULL);
|
||||
g_signal_connect(vte, "key-press-event", G_CALLBACK(key_press_cb), NULL);
|
||||
|
||||
#ifdef URGENT_ON_BEEP
|
||||
if (g_signal_lookup("beep", G_TYPE_FROM_INSTANCE(G_OBJECT(vte)))) {
|
||||
g_signal_connect(vte, "beep", G_CALLBACK(beep_handler), window);
|
||||
}
|
||||
#endif
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
gtk_main();
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue