aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-22 17:10:15 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-22 17:10:15 +0000
commit61409d40e290e8eff75fe567942b4ba5438d23a0 (patch)
treee8a7df644e3c9bd23f93d0eb86a55abc37fc5be1
parentcsi: implement CSI 3J - erase scroll back (diff)
flash: convert our own 'flash' from a CSI to an OSC
-rw-r--r--csi.c16
-rw-r--r--foot.info2
-rw-r--r--osc.c24
3 files changed, 25 insertions, 17 deletions
diff --git a/csi.c b/csi.c
index 275d5657..cc23617a 100644
--- a/csi.c
+++ b/csi.c
@@ -5,8 +5,6 @@
#include <unistd.h>
#include <assert.h>
-#include <sys/timerfd.h>
-
#if defined(_DEBUG)
#include <stdio.h>
#endif
@@ -598,20 +596,6 @@ csi_dispatch(struct terminal *term, uint8_t final)
}
case 1001: {
- /* Our own private - flash */
- unsigned duration_ms = vt_param_get(term, 1, 100);
- LOG_DBG("FLASH for %ums", duration_ms);
-
- struct itimerspec alarm = {
- .it_value = {.tv_sec = 0, .tv_nsec = duration_ms * 1000000},
- };
-
- if (timerfd_settime(term->flash_timer_fd, 0, &alarm, NULL) < 0)
- LOG_ERRNO("failed to arm flash timer");
- else {
- term->flash_active = true;
- }
- break;
}
default:
diff --git a/foot.info b/foot.info
index ed292dda..4388df77 100644
--- a/foot.info
+++ b/foot.info
@@ -51,7 +51,7 @@ foot+base|foot base fragment,
ed=\E[J,
el=\E[K,
el1=\E[1K,
- flash=\E[1001;100t,
+ flash=\E]555\007,
home=\E[H,
hpa=\E[%i%p1%dG,
ht=^I,
diff --git a/osc.c b/osc.c
index 9ec73ac2..2845ab96 100644
--- a/osc.c
+++ b/osc.c
@@ -3,6 +3,8 @@
#include <string.h>
#include <ctype.h>
+#include <sys/timerfd.h>
+
#define LOG_MODULE "osc"
#define LOG_ENABLE_DBG 0
#include "log.h"
@@ -200,6 +202,24 @@ osc_selection(struct terminal *term, char *string)
osc_to_clipboard(term, string, p);
}
+static void
+osc_flash(struct terminal *term)
+{
+ /* Our own private - flash */
+ unsigned duration_ms = vt_param_get(term, 1, 100);
+ LOG_DBG("FLASH for %ums", duration_ms);
+
+ struct itimerspec alarm = {
+ .it_value = {.tv_sec = 0, .tv_nsec = duration_ms * 1000000},
+ };
+
+ if (timerfd_settime(term->flash_timer_fd, 0, &alarm, NULL) < 0)
+ LOG_ERRNO("failed to arm flash timer");
+ else {
+ term->flash_active = true;
+ }
+}
+
void
osc_dispatch(struct terminal *term)
{
@@ -244,6 +264,10 @@ osc_dispatch(struct terminal *term)
case 112: /* Reset text cursor color */
break;
+ case 555:
+ osc_flash(term);
+ break;
+
default:
LOG_ERR("unimplemented: OSC: %.*s",
(int)term->vt.osc.idx, term->vt.osc.data);