From 9bc702695df94f15f9d4382349a3c0e28b1db3e4 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Mon, 16 Oct 2023 06:34:10 +0300 Subject: emacs:(aesthetics) Rewrite wallpaper functions --- .emacs.d/modules/thanos-aesthetics.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to '.emacs.d/modules/thanos-aesthetics.el') diff --git a/.emacs.d/modules/thanos-aesthetics.el b/.emacs.d/modules/thanos-aesthetics.el index 99def17..fb28f64 100644 --- a/.emacs.d/modules/thanos-aesthetics.el +++ b/.emacs.d/modules/thanos-aesthetics.el @@ -251,14 +251,24 @@ ;; wallpapers (defvar wallpapers-dir "~/wallpapers/") -(defun thanos/set-wallpaper () +(defun thanos/wallpaper-set (image) + "Set IMAGE as wallpaper, using feh." + (call-process-shell-command + (concat "feh --bg-scale " wallpapers-dir image) nil 0)) + +(defun thanos/wallpaper-random () + "Set random wallpaper." + (interactive) + (let ((wallpapers (directory-files "~/wallpapers" nil "^[^.].*"))) + (thanos/wallpaper-set (nth (random (length wallpapers)) wallpapers)))) + +(defun thanos/wallpaper-select () "Set wallpaper." (interactive) (let ((wallpaper (completing-read "Choose wallpaper: " (directory-files wallpapers-dir nil "^[^.].*")))) - (call-process-shell-command - (concat "feh --bg-scale " wallpapers-dir wallpaper) nil 0))) + (thanos/wallpaper-set wallpaper))) -(define-key thanos/applications-map (kbd "w") 'thanos/set-wallpaper) +(define-key thanos/applications-map (kbd "w") 'thanos/wallpaper-select) ;; Symbols (add-hook 'emacs-lisp-mode-hook 'prettify-symbols-mode) -- cgit v1.2.3