about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-01-18T22·47+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-18T22·47+0000
commit77d46eb5e1ef27f111012adbe966b82238d38fec (patch)
treeb497e8ce80236500cd282883e8fdf52e3af65b75
parent068a648736c14a8670097dc4c715bc76dbcfe6e6 (diff)
Debug failed initialization of keybindings
Some more pains of weening off of Dropbox is that my Emacs initialization is
sensitive to dependencies and missing require statements. I'm still debugging
everything.

Some modules called `exwm-input-set-key` before the `window-manager` module
loaded, which itself requires EXWM. This broke initialization. To get around
this I could've called `(require 'exwm)` in each of those modules. I chose to
define a `keybindings.el` module to whitelist some of my EXWM keybindings. I'm
not sure if this is the best way forward, but it is *some* way forward.
-rw-r--r--configs/shared/.emacs.d/wpc/clipboard.el3
-rw-r--r--configs/shared/.emacs.d/wpc/keybindings.el35
-rw-r--r--configs/shared/.emacs.d/wpc/pulse-audio.el13
-rw-r--r--configs/shared/.emacs.d/wpc/screen-brightness.el9
4 files changed, 35 insertions, 25 deletions
diff --git a/configs/shared/.emacs.d/wpc/clipboard.el b/configs/shared/.emacs.d/wpc/clipboard.el
index 8955261cdc73..0688c9d87fe0 100644
--- a/configs/shared/.emacs.d/wpc/clipboard.el
+++ b/configs/shared/.emacs.d/wpc/clipboard.el
@@ -40,8 +40,5 @@
   "Return the contents of the clipboard as a string."
   (substring-no-properties (current-kill 0)))
 
-(exwm-input-set-key
- (kbd "C-M-v") #'ivy-clipmenu/copy)
-
 (provide 'clipboard)
 ;;; clipboard.el ends here
diff --git a/configs/shared/.emacs.d/wpc/keybindings.el b/configs/shared/.emacs.d/wpc/keybindings.el
new file mode 100644
index 000000000000..62505d965266
--- /dev/null
+++ b/configs/shared/.emacs.d/wpc/keybindings.el
@@ -0,0 +1,35 @@
+;;; keybindings.el --- Centralizing my keybindings -*- lexical-binding: t -*-
+;; Author: William Carroll <wpcarro@gmail.com>
+
+;;; Commentary:
+;; Attempting to centralize my keybindings to simplify my configuration.
+
+;;; Code:
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Dependencies
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(require 'clipboard)
+(require 'screen-brightness)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Configuration
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defmacro keybinding/exwm (c fn)
+  "Bind C to FN using `exwm-input-set-key' with `kbd' applied to C."
+  `(exwm-input-set-key (kbd ,c) ,fn))
+
+(keybinding/exwm "C-M-v" #'ivy-clipmenu/copy)
+
+(keybinding/exwm "<XF86MonBrightnessUp>" #'screen-brightness/increase)
+(keybinding/exwm "<XF86MonBrightnessDown>" #'screen-brightness/decrease)
+
+(keybindings/exwm "<XF86AudioMute>" #'pulse-audio/toggle-mute)
+(keybindings/exwm "<XF86AudioLowerVolume>" #'pulse-audio/decrease-volume)
+(keybindings/exwm "<XF86AudioRaiseVolume>" #'pulse-audio/increase-volume)
+(keybindings/exwm "<XF86AudioMicMute>" #'pulse-audio/toggle-microphone)
+
+(provide 'keybindings)
+;;; keybindings.el ends here
diff --git a/configs/shared/.emacs.d/wpc/pulse-audio.el b/configs/shared/.emacs.d/wpc/pulse-audio.el
index b81f88c1b098..dba4151a9e3d 100644
--- a/configs/shared/.emacs.d/wpc/pulse-audio.el
+++ b/configs/shared/.emacs.d/wpc/pulse-audio.el
@@ -20,9 +20,6 @@
 (defconst pulse-audio/step-size 5
   "The size by which to increase or decrease the volume.")
 
-(defconst pulse-audio/install-kbds? t
-  "When t, install keybindings defined herein.")
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Library
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -65,15 +62,5 @@
                            pulse-audio/step-size))
   (pulse-audio/message "Volume increased."))
 
-(when pulse-audio/install-kbds?
-  (exwm-input-set-key
-   (kbd "<XF86AudioMute>") #'pulse-audio/toggle-mute)
-  (exwm-input-set-key
-   (kbd "<XF86AudioLowerVolume>") #'pulse-audio/decrease-volume)
-  (exwm-input-set-key
-   (kbd "<XF86AudioRaiseVolume>") #'pulse-audio/increase-volume)
-  (exwm-input-set-key
-   (kbd "<XF86AudioMicMute>") #'pulse-audio/toggle-microphone))
-
 (provide 'pulse-audio)
 ;;; pulse-audio.el ends here
diff --git a/configs/shared/.emacs.d/wpc/screen-brightness.el b/configs/shared/.emacs.d/wpc/screen-brightness.el
index 715fc7baee35..ad51e7578cca 100644
--- a/configs/shared/.emacs.d/wpc/screen-brightness.el
+++ b/configs/shared/.emacs.d/wpc/screen-brightness.el
@@ -21,9 +21,6 @@
 (defconst screen-brightness/step-size 15
   "The size of the increment or decrement step for the screen's brightness.")
 
-(defcustom screen-brightness/install-kbds? t
-  "If t, install the keybindings to control screen brightness.")
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Library
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -44,11 +41,5 @@
    :command (string/format "xbacklight -dec %s" screen-brightness/step-size))
   (message "[screen-brightness.el] Decreased screen brightness."))
 
-(when screen-brightness/install-kbds?
-  (exwm-input-set-key
-   (kbd "<XF86MonBrightnessUp>") #'screen-brightness/increase)
-  (exwm-input-set-key
-   (kbd "<XF86MonBrightnessDown>") #'screen-brightness/decrease))
-
 (provide 'screen-brightness)
 ;;; screen-brightness.el ends here