about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/screen-brightness.el23
-rw-r--r--users/wpcarro/nixos/marcus/default.nix10
2 files changed, 24 insertions, 9 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/screen-brightness.el b/users/wpcarro/emacs/.emacs.d/wpc/screen-brightness.el
index 30973607bb03..48aa5d637fb6 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/screen-brightness.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/screen-brightness.el
@@ -6,12 +6,10 @@
 ;; Package-Requires: ((emacs "24"))
 
 ;;; Commentary:
-;; Mainly just Elisp wrappers around `xbacklight`.
+;; Control your laptop's screen brightness.
 
 ;;; Code:
 
-;; TODO: Define some isomorphisms. E.g. int->string, string->int.
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Dependencies
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -22,8 +20,19 @@
 ;; Constants
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defconst screen-brightness-step-size 15
-  "The size of the increment or decrement step for the screen's brightness.")
+(defgroup screen-brightness nil "Configuration for screen-brightness.")
+
+(defcustom screen-brightness-increase-cmd
+  "light -A 3"
+  "The shell command to run to increase screen brightness."
+  :group 'screen-brightness
+  :type 'string)
+
+(defcustom screen-brightness-decrease-cmd
+  "light -U 3"
+  "The shell command to run to decrease screen brightness."
+  :group 'screen-brightness
+  :type 'string)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Library
@@ -34,7 +43,7 @@
   (interactive)
   (prelude-start-process
    :name "screen-brightness-increase"
-   :command (string-format "xbacklight -inc %s" screen-brightness-step-size))
+   :command screen-brightness-increase-cmd)
   (message "[screen-brightness.el] Increased screen brightness."))
 
 (defun screen-brightness-decrease ()
@@ -42,7 +51,7 @@
   (interactive)
   (prelude-start-process
    :name "screen-brightness-decrease"
-   :command (string-format "xbacklight -dec %s" screen-brightness-step-size))
+   :command screen-brightness-decrease-cmd)
   (message "[screen-brightness.el] Decreased screen brightness."))
 
 (provide 'screen-brightness)
diff --git a/users/wpcarro/nixos/marcus/default.nix b/users/wpcarro/nixos/marcus/default.nix
index bfbc392c21e8..f3c76f16c547 100644
--- a/users/wpcarro/nixos/marcus/default.nix
+++ b/users/wpcarro/nixos/marcus/default.nix
@@ -67,7 +67,10 @@ in {
   users.mutableUsers = true;
   users.users.wpcarro = {
     isNormalUser = true;
-    extraGroups = [ "wheel" ];
+    extraGroups = [
+      "wheel"
+      "video" # needed to control the screen brightness
+    ];
     shell = pkgs.fish;
   };
 
@@ -83,7 +86,10 @@ in {
     };
   };
 
-  programs.fish.enable = true;
+  programs = {
+    fish.enable = true;
+    light.enable = true;
+  };
 
   environment.systemPackages = with pkgs; [
     alacritty