Posted to tcl by emiliano at Fri Mar 04 12:11:59 GMT 2022view pretty

/* https://core.tcl-lang.org/tk/file?ci=tip&name=unix/tkUnixSysNotify.c&ln=135-143 */

enc = Tcl_GetEncoding(NULL, "utf-8");
    /*
    Tcl_ExternalToUtfDString(enc, title, -1, &dst);
    Tcl_ExternalToUtfDString(enc, message, -1, &dsm);
    */
    Tcl_UtfToExternalDString(enc, title, -1, &dst);
    Tcl_UtfToExternalDString(enc, message, -1, &dsm);
    notify_init("Wish");
    /*
    notif = notify_notification_new(title, message, icon, NULL);
    */
    notif = notify_notification_new(Tcl_DStringValue(&dst), Tcl_DStringValue(&dsm), icon, NULL);
    notify_notification_show(notif, NULL);
    Tcl_DStringFree(&dsm);
    Tcl_DStringFree(&dst);
    Tcl_FreeEncoding(enc);