mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added configure checks to enable desktop notifications on OSX
This commit is contained in:
parent
3f73a55cb0
commit
b5171cb054
37
configure.ac
37
configure.ac
@ -23,7 +23,13 @@ AC_PROG_CC
|
|||||||
|
|
||||||
### Get canonical host
|
### Get canonical host
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AS_IF([test "x$host_os" = xcygwin],
|
PLATFORM="unknown"
|
||||||
|
AS_CASE([$host_os],
|
||||||
|
[darwin*], [PLATFORM="osx"],
|
||||||
|
[cygwin], [PLATFORM="cygwin"],
|
||||||
|
[PLATFORM="nix"])
|
||||||
|
|
||||||
|
AS_IF([test "x$PLATFORM" = xcygwin],
|
||||||
[AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])])
|
[AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])])
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
@ -111,12 +117,28 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
|
|||||||
[AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
|
[AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
|
||||||
PKG_CHECK_MODULES([curl], [libcurl], [],
|
PKG_CHECK_MODULES([curl], [libcurl], [],
|
||||||
[AC_MSG_ERROR([libcurl is required for profanity])])
|
[AC_MSG_ERROR([libcurl is required for profanity])])
|
||||||
AS_IF([test "x$enable_notifications" != xno],
|
|
||||||
[PKG_CHECK_MODULES([libnotify], [libnotify],
|
### Check for desktop notification support
|
||||||
[AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])],
|
### Linux requires libnotify
|
||||||
[AS_IF([test "x$enable_notifications" = xyes],
|
### Windows uses native OS calls
|
||||||
[AC_MSG_ERROR([libnotify is required but does not exist])],
|
### OSX requires terminal-notifier
|
||||||
[AC_MSG_NOTICE([libnotify support will be disabled])])])])
|
|
||||||
|
AS_IF([test "x$PLATFORM" = xosx],
|
||||||
|
[AS_IF([test "x$enable_notifications" != xno],
|
||||||
|
[NOTIFIER_PATH="no"
|
||||||
|
AC_PATH_PROG(NOTIFIER_PATH, terminal-notifier, no)
|
||||||
|
AS_IF([test "x$NOTIFIER_PATH" = xno],
|
||||||
|
[AS_IF([test "x$enable_notifications" = xyes],
|
||||||
|
[AC_MSG_ERROR([terminal-notifier not found, required for desktop notifications.])],
|
||||||
|
[AC_MSG_NOTICE([Desktop notifications not supported.])])],
|
||||||
|
[AC_DEFINE([HAVE_OSXNOTIFY], [1], [terminal notifier])])])],
|
||||||
|
[test "x$PLATFORM" = xnix],
|
||||||
|
[AS_IF([test "x$enable_notifications" != xno],
|
||||||
|
[PKG_CHECK_MODULES([libnotify], [libnotify],
|
||||||
|
[AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])],
|
||||||
|
[AS_IF([test "x$enable_notifications" = xyes],
|
||||||
|
[AC_MSG_ERROR([libnotify is required but does not exist])],
|
||||||
|
[AC_MSG_NOTICE([libnotify support will be disabled])])])])])
|
||||||
|
|
||||||
# TODO: rewrite this
|
# TODO: rewrite this
|
||||||
if test "x$with_xscreensaver" = xyes; then
|
if test "x$with_xscreensaver" = xyes; then
|
||||||
@ -193,6 +215,7 @@ AC_CONFIG_FILES([Makefile])
|
|||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "PLATFORM : $host_os"
|
||||||
echo "PACKAGE_STATUS : $PACKAGE_STATUS"
|
echo "PACKAGE_STATUS : $PACKAGE_STATUS"
|
||||||
echo "AM_CFLAGS : $AM_CFLAGS"
|
echo "AM_CFLAGS : $AM_CFLAGS"
|
||||||
echo "AM_CPPFLAGS : $AM_CPPFLAGS"
|
echo "AM_CPPFLAGS : $AM_CPPFLAGS"
|
||||||
|
@ -206,6 +206,7 @@ _notify(const char * const message, int timeout,
|
|||||||
|
|
||||||
Shell_NotifyIcon(NIM_MODIFY, &nid);
|
Shell_NotifyIcon(NIM_MODIFY, &nid);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_OSXNOTIFY
|
||||||
GString *notify_command = g_string_new("terminal-notifier -title 'Profanity' -message '");
|
GString *notify_command = g_string_new("terminal-notifier -title 'Profanity' -message '");
|
||||||
g_string_append(notify_command, message);
|
g_string_append(notify_command, message);
|
||||||
g_string_append(notify_command, "'");
|
g_string_append(notify_command, "'");
|
||||||
@ -229,6 +230,7 @@ _notify(const char * const message, int timeout,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_string_free(notify_command, TRUE);
|
g_string_free(notify_command, TRUE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user