summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/bd--exwm-windowing.el
diff options
context:
space:
mode:
Diffstat (limited to '.config/emacs/modules/bd--exwm-windowing.el')
-rw-r--r--.config/emacs/modules/bd--exwm-windowing.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/emacs/modules/bd--exwm-windowing.el b/.config/emacs/modules/bd--exwm-windowing.el
index 7f52d2a..3b6532b 100644
--- a/.config/emacs/modules/bd--exwm-windowing.el
+++ b/.config/emacs/modules/bd--exwm-windowing.el
@@ -53,6 +53,26 @@
(interactive)
(bd/set-brightness "5%+"))
+(defun set-bg (&optional arg)
+ "Set the current wallpaper using feh.
+ARG can be one of the following:
+
+- nil: set the most recent wallpaper
+- directory: set a random image from the directory
+- file: set the specified file"
+ (interactive "f")
+ (let ((wall (expand-file-name "~/wf/wall/current")))
+ (and arg
+ (cond
+ ((file-regular-p arg) (copy-file arg wall t))
+ ((file-directory-p arg)
+ (let* ((images (f-files arg (lambda (f) (string-match-p "\\.jpeg\\'" f))))
+ (rfile (nth (random (length images)) images)))
+ (and rfile (copy-file rfile wall t))))))
+ (start-process "set wallpaper" nil "feh" "--bg-fill" wall)
+ (message "Set wallpaper.")))
+(set-bg)
+
(use-package exwm
:config