#!/bin/sh -e
#
# parrot - desktop notification with given MESSAGE and [TITLE] using OSC 777
# escape sequence, as defined by rxvt-unicode terminal extensions
#
# usage: parrot MESSAGE [TITLE]
#
# ---
# see: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands

esc="\033]777;notify;$2;$1\a"
test -n "${TMUX:-}" && esc="\033Ptmux;\033${esc}\033\\"
# shellcheck disable=SC2059
printf "${esc}"
