all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [External] : Re: Is there a way to avoid clobbering minibuffer by messages?
Date: Thu, 30 Mar 2023 22:26:54 +0300	[thread overview]
Message-ID: <ZCXifmhWw5pzwrEN@protected.localdomain> (raw)
In-Reply-To: <83fs9m42pc.fsf@gnu.org>

* Eli Zaretskii <eliz@gnu.org> [2023-03-30 19:37]:
> Users can already choose between 1 and 2: see set-message-function.

I did this:

(setq set-message-function 'dunstify)

And now I get very visible message notifications on the desktop by
using program `dunst'. I can see much better what is going on in Emacs.

;;; Dunst

(defun rcd-pgrep-pid (program)
  "Return PID for PROGRAM by using system command `pgrep'."
  (let ((pgrep (executable-find "pgrep")))
    (rcd-unless pgrep
	"Can't find `pgrep' in $PATH"
      (let* ((pid (call-process-to-string pgrep nil nil "-x" program))
	     (pid (string-trim pid))
	     (pid (cond ((string= pid "") nil)
			(t (string-to-number pid)))))
	pid))))

 (defvar dunst-pid nil
  "Keep `dunst' PID.")

(defun dunst-launch ()
  "Launch `dunst' notification daemon."
  (interactive)
  (let ((pid (rcd-pgrep-pid "dunst")))
    (cond (pid (rcd-warning-message (format "`dunst' notification daemon already running with PID %s" pid)))
	  (t (setq dunst-pid pid)
	     (start-process "*dunst*" "*dunst*" "dunst")))))

(defun dunstify (title &optional text urgency timeout appname)
  ;; appname urgency hints action timeout icon raw-icon print-id replace-id block)
  "Dunstify TITLE with optional TEXT."
  (let* ((dunstify (executable-find "dunstify"))
	 (name (concat "*" dunstify "*"))
	 (buffer name)
	 (appname (cond (appname (list "-a" appname))
			(t nil)))
	 (timeout (cond (timeout (list "-t" (format "%s" timeout)))
			(t "10000")))
	 (urgency (cond (urgency (list "-u" (format "%s" urgency)))
			(t nil)))
	 (args (delq nil (append (list title) (flatten-list (list text appname timeout))))))
    (cond (dunstify 
	   (apply #'start-process name buffer dunstify args))
	  (t (rcd-warning-message "Program `dunstify' not found")))))

  ;; -u, --urgency=URG           The urgency of this notification
  ;; -h, --hints=HINT            User specified hints
  ;; -A, --action=ACTION         Actions the user can invoke
  ;; -i, --icon=ICON             An Icon that should be displayed with the notification
  ;; -I, --raw_icon=RAW_ICON     Path to the icon to be sent as raw image data
  ;; -p, --printid               Print id, which can be used to update/replace this notification
  ;; -r, --replace=ID            Set id of this notification.
  ;; -C, --close=ID              Close the notification with the specified ID
  ;; -b, --block                 Block until notification is closed and print close reason

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  parent reply	other threads:[~2023-03-30 19:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  7:57 Is there a way to avoid clobbering minibuffer by messages? Platon Pronko
2023-03-30  8:53 ` Eli Zaretskii
2023-03-30  9:40   ` Platon Pronko
2023-03-30 10:32     ` Eli Zaretskii
2023-03-30 15:05       ` Gregory Heytings
2023-03-30 16:28         ` [External] : " Drew Adams
2023-03-30 16:35           ` Eli Zaretskii
2023-03-30 16:49             ` Drew Adams
2023-03-30 17:27               ` Eli Zaretskii
2023-03-30 17:32             ` Gregory Heytings
2023-03-30 17:51               ` Eli Zaretskii
2023-03-30 18:14                 ` John Yates
2023-03-30 18:28                   ` Eli Zaretskii
2023-03-30 20:08                     ` John Yates
2023-03-31  6:32                       ` Yuri Khan
2023-03-30 18:16                 ` Gregory Heytings
2023-03-30 18:31                   ` Eli Zaretskii
2023-03-30 19:37                     ` Sergey Organov
2023-03-30 19:45                     ` Gregory Heytings
2023-03-30 20:02                       ` Gregory Heytings
2023-03-30 20:06                         ` Gregory Heytings
2023-03-30 19:26             ` Jean Louis [this message]
2023-03-31 10:40               ` Eric S Fraga
2023-03-30 19:22           ` Jean Louis
2023-03-31  6:24         ` Platon Pronko
2023-03-31  6:58           ` Gregory Heytings
2023-03-31  7:01             ` Gregory Heytings
2023-03-31  7:10               ` Platon Pronko
2023-03-31  7:17                 ` Gregory Heytings
2023-03-31  7:45                   ` Gregory Heytings
2023-03-31 11:04                     ` John Covici
2023-03-31 11:09                       ` Gregory Heytings
2023-03-31 12:46                         ` John Covici
2023-03-30  9:52 ` Gregory Heytings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZCXifmhWw5pzwrEN@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.