From d8358c5f023f3df70584ec23ca0b2665453903cd Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Sun, 2 Jun 2024 02:06:00 +0200 Subject: [PATCH] [sawfish] Remember path to set-bg script in a variable --- sawfishrc | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sawfishrc b/sawfishrc index 01aed55..3c35f82 100644 --- a/sawfishrc +++ b/sawfishrc @@ -413,29 +413,29 @@ Windows are matched in most recently focused first order." ;; Desktop background -(when (file-exists-p (concat (getenv "HOME") "/.local/libexec/set-bg")) - (require 'rep.io.timers) - - (define set-bg--timer (make-timer (lambda (_) (set-bg)))) - - (define (set-bg--state-func proc) - (set-timer set-bg--timer (if (= (process-exit-value proc) 0) 900 10))) - - (define (set-bg) - (delete-timer set-bg--timer) - (start-process (let ((proc (make-process))) - (set-process-output-stream proc standard-output) - (set-process-error-stream proc standard-error) - (set-process-function proc set-bg--state-func) - (set-process-dir proc "/") - (set-process-prog proc (concat (getenv "HOME") - "/.local/libexec/set-bg")) - proc)) - ()) - - (set-bg) - (add-hook 'randr-change-notify-hook set-bg) - (bind-keys root-window-keymap "Button1-Click2" set-bg)) +(let ((set-bg-script (concat (getenv "HOME") "/.local/libexec/set-bg"))) + (when (file-exists-p set-bg-script) + (require 'rep.io.timers) + + (define set-bg--timer (make-timer (lambda (_) (set-bg)))) + + (define (set-bg--state-func proc) + (set-timer set-bg--timer (if (= (process-exit-value proc) 0) 900 10))) + + (define (set-bg) + (delete-timer set-bg--timer) + (start-process (let ((proc (make-process))) + (set-process-output-stream proc standard-output) + (set-process-error-stream proc standard-error) + (set-process-function proc set-bg--state-func) + (set-process-dir proc "/") + (set-process-prog proc set-bg-script) + proc)) + ()) + + (set-bg) + (set-hook 'randr-change-notify-hook set-bg) + (bind-keys root-window-keymap "Button1-Click2" set-bg))) ;;{{{ Matcher -- 2.11.4.GIT