Skip to content

Commit

Permalink
[sawfish] Remember path to set-bg script in a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mina86 committed Jun 2, 2024
1 parent 90cea3c commit d8358c5
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions sawfishrc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d8358c5

Please sign in to comment.