diff --git a/Documents/bin/notify b/Documents/bin/notify
index c2ce2d3b47d868cd0680dad302bbdfd07bed9ff9..07d3cdcd5ffb7badc65c7ce61b404450a59f9b65 100755
--- a/Documents/bin/notify
+++ b/Documents/bin/notify
@@ -32,8 +32,8 @@ else
     hostname="$(sysctl -a 2>/dev/null | awk -F '=' '/^kern[a-z]*\.hostname/ {print $2}')"
 fi
 
-# Get the host' hostname in case
-if [ "$hostname" = 'toolbox' ]
+# Get the host' hostname in case it's a toolbox container.
+if [ "$hostname" = 'toolbox' ] && [ -x /usr/libexec/flatpak-xdg-utils/flatpak-spawn ]
 then
     hostname="$(/usr/libexec/flatpak-xdg-utils/flatpak-spawn --host hostname)"
 fi