diff --git a/README.md b/README.md index 62728ca..f3b55cd 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the ### Changelog: +2020-08-08 - Re-added the visualbell patch + 2020-06-26 - Added the single drawable buffer patch as per the FAQ in order to get w3m images to display 2020-06-25 - Upgrade to 0.8.4 (367803, 2020-06-19) @@ -135,8 +137,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the - [vertcenter](https://st.suckless.org/patches/vertcenter/) - vertically center lines in the space available if you have set a larger chscale in config.h - - [~visualbell~](https://st.suckless.org/patches/visualbell/) - - ~adds visual indicators for the terminal bell event~ + - [visualbell](https://st.suckless.org/patches/visualbell/) + - adds visual indicators for the terminal bell event - [w3m](https://st.suckless.org/patches/w3m/) - adds support for w3m images diff --git a/patches.def.h b/patches.def.h index d1ff317..07b7deb 100644 --- a/patches.def.h +++ b/patches.def.h @@ -210,6 +210,11 @@ */ #define VERTCENTER_PATCH 0 +/* Briefly inverts window content on terminal bell event. + * https://st.suckless.org/patches/visualbell/ + */ +#define VISUALBELL_1_PATCH 0 + /* Adds support for w3m images. * https://st.suckless.org/patches/w3m/ */ diff --git a/x.c b/x.c index 6ea6c44..5f99b3d 100644 --- a/x.c +++ b/x.c @@ -289,6 +289,9 @@ static char *opt_dir = NULL; #endif // WORKINGDIR_PATCH static int oldbutton = 3; /* button event on startup: 3 = release */ +#if VISUALBELL_1_PATCH +static int bellon = 0; /* visual bell status */ +#endif // VISUALBELL_1_PATCH #include "patch/x_include.c" @@ -2103,6 +2106,10 @@ xbell(void) xseturgency(1); if (bellvolume) XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); + #if VISUALBELL_1_PATCH + if (!bellon) /* turn visual bell on */ + bellon = 1; + #endif // VISUALBELL_1_PATCH } void @@ -2387,7 +2394,18 @@ run(void) } } + #if VISUALBELL_1_PATCH + if (bellon) { + bellon++; + bellon %= 3; + MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); + redraw(); + } + else + draw(); + #else draw(); + #endif // VISUALBELL_1_PATCH XFlush(xw.dpy); drawing = 0; }