surf-notifications-20201223-7dcce9e1.diff (3324B)
1 diff --git a/config.def.h b/config.def.h 2 index be168ab..3e9f40e 100644 3 --- a/config.def.h 4 +++ b/config.def.h 5 @@ -41,6 +41,7 @@ static Parameter defconfig[ParameterLast] = { 6 [KioskMode] = { { .i = 0 }, }, 7 [LoadImages] = { { .i = 1 }, }, 8 [MediaManualPlay] = { { .i = 1 }, }, 9 + [Notifications] = { { .i = 0 }, }, 10 [Plugins] = { { .i = 1 }, }, 11 [PreferredLanguages] = { { .v = (char *[]){ NULL } }, }, 12 [RunInFullscreen] = { { .i = 0 }, }, 13 @@ -182,6 +183,7 @@ static Key keys[] = { 14 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } }, 15 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } }, 16 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } }, 17 + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_l, toggle, { .i = Notifications } }, 18 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } }, 19 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } }, 20 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } }, 21 diff --git a/surf.c b/surf.c 22 index ac832ff..2f2632b 100644 23 --- a/surf.c 24 +++ b/surf.c 25 @@ -72,6 +72,7 @@ typedef enum { 26 KioskMode, 27 LoadImages, 28 MediaManualPlay, 29 + Notifications, 30 Plugins, 31 PreferredLanguages, 32 RunInFullscreen, 33 @@ -677,7 +678,8 @@ gettogglestats(Client *c) 34 togglestats[8] = curconfig[FrameFlattening].val.i ? 'F' : 'f'; 35 togglestats[9] = curconfig[Certificate].val.i ? 'X' : 'x'; 36 togglestats[10] = curconfig[StrictTLS].val.i ? 'T' : 't'; 37 - togglestats[11] = '\0'; 38 + togglestats[11] = curconfig[Notifications].val.i ? 'L' : 'l'; 39 + togglestats[12] = '\0'; 40 } 41 42 void 43 @@ -825,6 +827,9 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a) 44 case MediaManualPlay: 45 webkit_settings_set_media_playback_requires_user_gesture(s, a->i); 46 break; 47 + case Notifications: 48 + refresh = 0; 49 + return; 50 case Plugins: 51 webkit_settings_set_enable_plugins(s, a->i); 52 break; 53 @@ -1028,6 +1033,7 @@ newwindow(Client *c, const Arg *a, int noembed) 54 cmd[i++] = curconfig[Geolocation].val.i ? "-G" : "-g" ; 55 cmd[i++] = curconfig[LoadImages].val.i ? "-I" : "-i" ; 56 cmd[i++] = curconfig[KioskMode].val.i ? "-K" : "-k" ; 57 + cmd[i++] = curconfig[Notifications].val.i ? "-L" : "-l" ; 58 cmd[i++] = curconfig[Style].val.i ? "-M" : "-m" ; 59 cmd[i++] = curconfig[Inspector].val.i ? "-N" : "-n" ; 60 cmd[i++] = curconfig[Plugins].val.i ? "-P" : "-p" ; 61 @@ -1610,6 +1616,8 @@ permissionrequested(WebKitWebView *v, WebKitPermissionRequest *r, Client *c) 62 else if (webkit_user_media_permission_is_for_video_device( 63 WEBKIT_USER_MEDIA_PERMISSION_REQUEST(r))) 64 param = AccessWebcam; 65 + } else if (WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(r)) { 66 + param = Notifications; 67 } else { 68 return FALSE; 69 } 70 @@ -2074,6 +2082,14 @@ main(int argc, char *argv[]) 71 defconfig[KioskMode].val.i = 1; 72 defconfig[KioskMode].prio = 2; 73 break; 74 + case 'l': 75 + defconfig[Notifications].val.i = 0; 76 + defconfig[Notifications].prio = 2; 77 + break; 78 + case 'L': 79 + defconfig[Notifications].val.i = 1; 80 + defconfig[Notifications].prio = 2; 81 + break; 82 case 'm': 83 defconfig[Style].val.i = 0; 84 defconfig[Style].prio = 2;