1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prezto/modules/notify/functions/should_load_notify_module

35 lines
729 B

12 years ago
# Check if it makes sense to load the notify module.
#
# Checks for requirements, that it is an xsession, etc.
#
# Authors:
# Alex Reece <awreece@gmail.com>
#
function should_load_notify_module {
case "$OSTYPE" in
(darwin*)
# For now, always enable on mac osx.
# TODO(awreece) Disable if ssh with no windows?
return 0
;;
(linux-gnu*)
# Disable if don't have X.
if [[ -z $XAUTHORITY ]]; then
return 1
fi
# We need both of these functions to operate.
if (( ! $+commands[notify-send] || ! $+commands[xprop] )); then
return 1
fi
return 0
;;
(*)
# If we don't know, then just disable.
return 1
;;
esac
}