about summary refs log tree commit diff
path: root/configs/shared/.emacs.d/wpc/display.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2019-10-09T11·13+0100
committerWilliam Carroll <wpcarro@gmail.com>2019-12-24T15·21+0000
commit6b456c1b7a4f6899f063a6e65355af51901d9c7a (patch)
treecfc70d74818ae9fabdbbfb0cf16cce092e4c1a09 /configs/shared/.emacs.d/wpc/display.el
parenta7c72adb2ebec1e497fc040eaf3551d564d61a5b (diff)
Massive configuration overhaul
Currently paying the price of months of non-diligent git usage.

Here's what has changed.

- Theming support in Gvcci and wpgtk
- Dropping support for i3
- Supporting EXWM
- Many Elisp modules
- Collapsed redundant directories in ./configs
Diffstat (limited to 'configs/shared/.emacs.d/wpc/display.el')
-rw-r--r--configs/shared/.emacs.d/wpc/display.el47
1 files changed, 47 insertions, 0 deletions
diff --git a/configs/shared/.emacs.d/wpc/display.el b/configs/shared/.emacs.d/wpc/display.el
new file mode 100644
index 000000000000..716f3e5f5742
--- /dev/null
+++ b/configs/shared/.emacs.d/wpc/display.el
@@ -0,0 +1,47 @@
+;;; display.el --- Working with single or multiple displays -*- lexical-binding: t -*-
+;; Author: William Carroll <wpcarro@gmail.com>
+
+;;; Commentary:
+;; Mostly wrappers around xrandr.
+;;
+;; TODO: Look into autorandr to see if it could be useful.
+;;
+;; Troubleshooting:
+;; The following commands help me when I (infrequently) interact with xrandr.
+;; - xrandr --listmonitors
+;; - xrandr --query
+
+;;; Code:
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Constants
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; TODO: Consider if this logic should be conditioned by `device/work-laptop?'.
+(defconst display/primary "eDP-1"
+  "The xrandr identifier for my primary screen (on work laptop).")
+
+(defconst display/4k "HDMI-1"
+  "The xrandr identifer for my 4K monitor.")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Library
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun display/enable-4k ()
+  "Attempt to connect to my 4K monitor."
+  (interactive)
+  (shell-command
+   (string/format "xrandr --output %s --dpi 144 --auto --right-of %s"
+                  display/4k
+                  display/primary)))
+
+(defun display/disable-4k ()
+  "Disconnect from the 4K monitor."
+  (interactive)
+  (shell-command
+   (string/format "xrandr --output %s --off"
+                  display/4k)))
+
+(provide 'display)
+;;; display.el ends here