Prefer start-process to shell-command

Without doing any benchmarking (break this naughty habit), I'm preferring to
call `start-process` instead of `shell-command` in my `wallpaper/set`
function. I noticed that the `shell-command` call was unnecessarily polluting my
`pstree` call when I debugging my randomly changing wallpaper bug.

I'm mostly likely going to change a few more `shell-command` calls to prefer
`start-process`.
This commit is contained in:
William Carroll 2019-12-23 11:33:15 +00:00
parent 4e454f0466
commit 5fbe860b95

View file

@ -31,8 +31,15 @@
"My preferred computer wallpapers.") "My preferred computer wallpapers.")
(defun wallpaper/set (path) (defun wallpaper/set (path)
"Set computer wallpaper to image at `PATH' using `feh` under-the-hood." "Set computer wallpaper to image at `PATH' using `feh` under-the-hood.
(shell-command (string/format "feh --bg-scale --no-fehbg %s" path))) `PATH' can be absolute or relative since `f-expand' is called in the function
body to ensure feh can resolve the path."
(start-process "*feh<wallpaper/set>*"
nil
"feh"
"--bg-scale"
"--no-feh-bg"
(f-expand path)))
(defun wallpaper/whitelist-set (wallpaper) (defun wallpaper/whitelist-set (wallpaper)
"Focuses the WALLPAPER in the `wallpaper/whitelist' cycle." "Focuses the WALLPAPER in the `wallpaper/whitelist' cycle."