       ;; Add monitor callback in input change hook.
       (other-window 1)
       (add-hook 'after-change-functions 'snails-monitor-input nil t)
+      (add-hook 'focus-out-hook 'snails-quit)
       )
 
     ;; Set active flag, use for advice-add detect.

                (process-live-p process))
       (kill-process process)))
   snails-backend-subprocess-hash))

(defun snails-try-raise ()
  "When snails is frame is live, try to raise snails frame.
This function hook in `focus-in-hook' on default frame of Emacs."
  (when (and snails-frame
             (frame-live-p snails-frame))
    (raise-frame snails-frame)
    (select-frame-set-input-focus snails-frame)))

(defun snails-create-input-buffer ()
  "Create input buffer."

;; Maintainer: Andy Stewart <lazycat.manatee@gmail.com>
;; Copyright (C) 2019, Andy Stewart, all rights reserved.
;; Created: 2019-05-16 21:26:09
;; Version: 3.3
;; Last-Updated: 2019-07-25 18:14:31
;;           By: Andy Stewart
;; URL: http://www.emacswiki.org/emacs/download/snails-core.el
;; Keywords:
