]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new command image-dired-set-wallpaper
authorStefan Kangas <stefankangas@gmail.com>
Tue, 13 Sep 2022 15:56:22 +0000 (17:56 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Tue, 13 Sep 2022 16:25:21 +0000 (18:25 +0200)
* lisp/image/image-dired.el (wallpaper): Require.
(image-dired-set-wallpaper): New command.
(image-dired-thumbnail-mode-map): Bind above new command to "W".

etc/NEWS
lisp/image/image-dired.el

index db3fcf19e59cfd7416b6febe5dd7824ee4348f12..dde340627b88ba6e3a722a920c41cf5c3e92defb 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2052,6 +2052,11 @@ If 'image-dired-thumb-mark' is non-nil (the default), this face is
 used for images that are flagged for deletion in the Dired buffer
 associated with Image-Dired.
 
+---
+*** New command 'image-dired-wallpaper-set'.
+This command sets the wallpaper to the image at point in the thumbnail
+buffer.  It is bound to 'W' by default.
+
 ---
 *** 'image-dired-slideshow-start' is now bound to 'S'.
 It is bound in both the thumbnail and display buffer.
index 65844863c64fe0436196824294a7f825d51a312a..f1074247e924bf569f2aacc541ec0224b71772b9 100644 (file)
@@ -55,7 +55,6 @@
 ;;
 ;; file-name-non-directory;comment:comment-text;tag1;tag2;tag3;...;tagN
 ;;
-;;
 ;; PREREQUISITES
 ;; =============
 ;;
 ;; * From thumbs.el: Add an option for clean-up/max-size functionality
 ;;   for thumbnail directory.
 ;;
-;; * From thumbs.el: Add setroot function.
-;;
 ;; * Add `image-dired-display-thumbs-ring' and functions to cycle that.  Find out
 ;;   which is best, saving old batch just before inserting new, or
 ;;   saving the current batch in the ring when inserting it.  Adding
 
 (require 'dired)
 (require 'image-mode)
+(require 'wallpaper)
 (require 'widget)
 (require 'xdg)
 
@@ -861,6 +859,7 @@ You probably want to use this together with
   "SPC"        #'image-dired-display-next-thumbnail-original
   "DEL"        #'image-dired-display-previous-thumbnail-original
   "c"          #'image-dired-comment-thumbnail
+  "W"          #'image-dired-wallpaper-set
 
   ;; Mouse
   "<mouse-2>"        #'image-dired-mouse-display-image
@@ -1152,6 +1151,12 @@ With prefix ARG, move that many thumbnails."
   (interactive "p" image-dired-thumbnail-mode image-dired-display-image-mode)
   (image-dired-display-next-thumbnail-original (- arg)))
 
+(defun image-dired-wallpaper-set (file)
+  "Set the wallpaper to FILE in a graphical environment."
+  (interactive (list (image-dired-original-file-name))
+               image-dired-thumbnail-mode)
+  (wallpaper-set file))
+
 \f
 ;;; Image Comments