[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dtache 94f207eeeb 149/158: Make dtache utilize notifica
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dtache 94f207eeeb 149/158: Make dtache utilize notifications library |
Date: |
Wed, 19 Jan 2022 18:58:09 -0500 (EST) |
branch: externals/dtache
commit 94f207eeeb57c2ca82598dd0434e3b9aa00c01b1
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Make dtache utilize notifications library
This patch implements a notification message function which relies on
the notifications library. This is made the default notifiction
function, users have possibility to change to the function that uses
the echo area instead. Or to use a custom function with alert, as
specified in the README.
---
CHANELOG.org | 1 +
README.org | 2 +-
dtache.el | 24 ++++++++++++++++++++----
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/CHANELOG.org b/CHANELOG.org
index 6829cf3f88..50eca3a1e9 100644
--- a/CHANELOG.org
+++ b/CHANELOG.org
@@ -4,6 +4,7 @@
* Development
+- =dtache= now uses =notifications= library to issue notifications by default.
- =dtache= now uses =filenotify= for notifications except on local macOS hosts.
* Version 0.3 (2022-01-15)
diff --git a/README.org b/README.org
index 1b2d678986..13383fadef 100644
--- a/README.org
+++ b/README.org
@@ -208,7 +208,7 @@ The user have the possibility to integrate =dtache= with
the package [[https://g
*** Alert
-By default =dtache= uses the echo area to notify the user when a session has
finished. An alternative is to utilize the
[[https://github.com/jwiegley/alert][alert]] package to get a system
notification instead.
+By default =dtache= uses the built in =notifications= library to issue a
notification. This solution uses =dbus= but if that doesn't work for the user
there is the possibility to set the =dtache-notification-function= to
=dtache-state-transitionion-echo-message= to use the echo area instead. If that
doesn't suffice there is the possibility to use the
[[https://github.com/jwiegley/alert][alert]] package to get a system
notification instead.
#+begin_src elisp :lexical t :results none
(defun my/dtache-state-transition-notification (session)
diff --git a/dtache.el b/dtache.el
index 398bb16bc0..874f889db9 100644
--- a/dtache.el
+++ b/dtache.el
@@ -43,6 +43,7 @@
;;;; Requirements
(require 'autorevert)
+(require 'notifications)
(require 'filenotify)
(require 'simple)
(require 'tramp)
@@ -119,7 +120,7 @@
:type '(repeat (regexp :format "%v"))
:group 'dtache)
-(defcustom dtache-notification-function #'dtache-state-transition-notification
+(defcustom dtache-notification-function
#'dtache-state-transition-notifications-message
"Variable to set which function to use to issue a notification."
:type 'function
:group 'dtache)
@@ -628,13 +629,28 @@ If session is not valid trigger an automatic cleanup on
SESSION's host."
'success
'failure))))
-(defun dtache-state-transition-notification (session)
- "Send a notification when SESSION transitions from active to inactive."
+(defun dtache-state-transitionion-echo-message (session)
+ "Issue a notification when SESSION transitions from active to inactive.
+This function uses the echo area."
(let ((status (pcase (dtache--session-status session)
('success "Dtache finished")
- ('failure "Dtache failed")) ))
+ ('failure "Dtache failed")
+ ('unknown "Dtache finished")) ))
(message "%s: %s" status (dtache--session-command session))))
+(defun dtache-state-transition-notifications-message (session)
+ "Issue a notification when SESSION transitions from active to inactive.
+This function uses the `notifications' library."
+ (let ((status (dtache--session-status session)))
+ (notifications-notify
+ :title (pcase status
+ ('success "Dtache finished!")
+ ('failure "Dtache failed!"))
+ :body (dtache--session-command session)
+ :urgency (pcase status
+ ('success 'normal)
+ ('failure 'critical)))))
+
(defun dtache-view-dwim (session)
"View SESSION in a do what I mean fashion."
(cond ((eq 'success (dtache--session-status session))
- [elpa] externals/dtache 34c7d23346 088/158: Make dtache-eshell compatible with recent changes, (continued)
- [elpa] externals/dtache 34c7d23346 088/158: Make dtache-eshell compatible with recent changes, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 2354197acb 096/158: Fix error in dtache-compile, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 5da693be75 100/158: Update CHANGELOG, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 0c8241a33d 107/158: Update actions from defvar to defcustom, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 848f3a943a 108/158: Update attach naming, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 52c82428ac 110/158: Remove documentation directory, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 9f948349a3 112/158: Rename dtache-detach to dtache-detach-dwim, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 4c47fa3ddb 122/158: Fix error in dtache-attach, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 71d7e3ad35 119/158: Update how duration is determined, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 5d78cfb3b3 142/158: Add attach command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 94f207eeeb 149/158: Make dtache utilize notifications library,
ELPA Syncer <=
- [elpa] externals/dtache 668f6aca83 157/158: Improve dtache-kill-session, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache e3af56003d 063/158: Remove unnecessary header declarations, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache dd9c2a0095 066/158: Add contributions section in README, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 59f2ac4ab5 084/158: Rename dtache--dtach-mode to dtache-session-mode, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 1cbeb7167e 136/158: Rename magic-command to dtache-command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 954b642659 074/158: Demote attach commands to functions, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 4778eda4df 085/158: Rename compile-session to post-compile-session, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 06cb91da1d 097/158: Make dtache-session-directory have a default value, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 4284951870 103/158: Make dtache-delete-sessions a command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache f34f5b8a24 105/158: Harmonize function names, ELPA Syncer, 2022/01/19