Skip to content

Instantly share code, notes, and snippets.

@Consolatis
Last active February 8, 2023 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Consolatis/12e51b3766f552297b1a9b976a79e4ea to your computer and use it in GitHub Desktop.
Save Consolatis/12e51b3766f552297b1a9b976a79e4ea to your computer and use it in GitHub Desktop.
diff --git a/notify.c b/notify.c
index 8180477d..7e316268 100644
--- a/notify.c
+++ b/notify.c
@@ -48,7 +48,10 @@ notify_notify(const struct terminal *term, const char *title, const char *body)
/* Redirect stdin to /dev/null, but ignore failure to open */
int devnull = open("/dev/null", O_RDONLY);
+
+ setenv("FOOT_PTY", ptsname(term->ptmx), 1);
spawn(term->reaper, NULL, argv, devnull, -1, -1, NULL);
+ unsetenv("FOOT_PTY");
if (devnull >= 0)
close(devnull);
diff --git a/osc.c b/osc.c
index 55cfcf84..c4ef406b 100644
--- a/osc.c
+++ b/osc.c
@@ -907,6 +907,10 @@ osc_dispatch(struct terminal *term)
osc_flash(term);
break;
+ case 568:
+ xdg_activation_v1_activate(term->wl->xdg_activation, string, term->window->surface);
+ break;
+
case 777: {
/*
* OSC 777 is an URxvt generic escape used to send commands to
#!/bin/bash
send_notification() {
G_MESSAGES_DEBUG=all notify-send \
--action=default="Activate Foot" "$@" \
| sed -n '/Activation Token/ s/^.*Activation Token: \(.*\)$/\1/ p'
}
token=$(send_notification "$@")
if test -n "$token" && test -n "$FOOT_PTY"; then
printf "\e]568;%s\e" "$token" > "$FOOT_PTY"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment