From 535adb96f6c1be7f43ba5d1b04b3d00e1c94b626 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 13 Sep 2022 17:56:22 +0200 Subject: [PATCH] Add new command image-dired-set-wallpaper * 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 | 5 +++++ lisp/image/image-dired.el | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index db3fcf19e59..dde340627b8 100644 --- 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. diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 65844863c64..f1074247e92 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -55,7 +55,6 @@ ;; ;; file-name-non-directory;comment:comment-text;tag1;tag2;tag3;...;tagN ;; -;; ;; PREREQUISITES ;; ============= ;; @@ -109,8 +108,6 @@ ;; * 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 @@ -135,6 +132,7 @@ (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 "" #'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)) + ;;; Image Comments -- 2.39.2