Skip to content

Instantly share code, notes, and snippets.

@trygveaa
Created October 10, 2022 12:31
Show Gist options
  • Save trygveaa/e304621f53c62c792864faeedfddb86b to your computer and use it in GitHub Desktop.
Save trygveaa/e304621f53c62c792864faeedfddb86b to your computer and use it in GitHub Desktop.
#!/bin/bash
title="$1"
body="${2/&/&}"
body="${body/</&lt;}"
body="${body/>/&gt;}"
if [ -n "$TMUX" ]; then
printf '\ePtmux;\e\e]99;i=1:d=0;%s\e\e\\\e\\' "$title" >/dev/tty
printf '\ePtmux;\e\e]99;i=1:d=1:p=body;%s\e\e\\\e\\' "$body" >/dev/tty
else
printf '\e]99;i=1:d=0;%s\e\\' "$title" >/dev/tty
printf '\e]99;i=1:d=1:p=body;%s\e\\' "$body" >/dev/tty
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment