diff options
author | William Carroll <wpcarro@gmail.com> | 2019-12-23T11·43+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-01-06T15·25+0000 |
commit | 7ec4dca723d8f217d1a85d7669a1e3c4f9842cd4 (patch) | |
tree | bea475d3c8ef4c5e9f8cc692466b68ca9c3d0879 | |
parent | 5fbe860b9564be2f046821d0dfc6afb51370a430 (diff) |
Reduce latency of screen-brightness/{increase,decrease}
As promised in the previous commit, I'm refactoring usages of `shell-command` to prefer the faster alternative `start-process`. So far, I'm pleased with the results.
-rw-r--r-- | configs/shared/.emacs.d/wpc/screen-brightness.el | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/configs/shared/.emacs.d/wpc/screen-brightness.el b/configs/shared/.emacs.d/wpc/screen-brightness.el index 1b74ea34a953..8183196cccbc 100644 --- a/configs/shared/.emacs.d/wpc/screen-brightness.el +++ b/configs/shared/.emacs.d/wpc/screen-brightness.el @@ -9,13 +9,6 @@ ;; TODO: Define some isomorphisms. E.g. int->string, string->int. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Dependencies -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(require 'string) -(require 'dash) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -32,19 +25,23 @@ (defun screen-brightness/increase () "Increase the screen brightness." (interactive) - (->> screen-brightness/step-size - int-to-string - (string/concat "xbacklight -inc ") - shell-command) + (start-process + "*xbacklight<screen-brightness/increase>*" + nil + "xbacklight" + "-inc" + (int-to-string screen-brightness/step-size)) (message "[screen-brightness.el] Increased screen brightness.")) (defun screen-brightness/decrease () "Decrease the screen brightness." (interactive) - (->> screen-brightness/step-size - int-to-string - (string/concat "xbacklight -dec ") - shell-command) + (start-process + "*xbacklight<screen-brightness/decrease>*" + nil + "xbacklight" + "-dec" + (int-to-string screen-brightness/step-size)) (message "[screen-brightness.el] Decreased screen brightness.")) (when screen-brightness/install-kbds? |