Created
July 7, 2010 00:13
-
-
Save jollm/466123 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; set up dual head if VGA1 is connected | |
(defcommand xrandr-on-vga1 () () | |
(let* ((xrandr-output (run-shell-command "xrandr" t)) | |
(vga1-dimensions | |
(let ((group-array | |
(nth-value 1 | |
(cl-ppcre:scan-to-strings | |
"(?<=VGA connected).*?(\\d+x\\d+) \\d+\\.\\d+ \\+" | |
(cl-ppcre:regex-replace-all "\\s+" xrandr-output " "))))) | |
(if (arrayp group-array) (aref group-array 0))))) | |
(if vga1-dimensions | |
(progn | |
(run-shell-command "xrandr --output LVDS --right-of VGA" t) | |
(run-shell-command "xrandr --output LVDS --mode \"1280x800\"" t) | |
(run-shell-command (concat "xrandr --output VGA --left-of LVDS --mode \"" vga1-dimensions "\"") t))))) | |
(defcommand xrandr-off-vga1 () () | |
(progn | |
(run-shell-command "xrandr --output LVDS --pos 0x0" t) | |
(run-shell-command "xrandr --output VGA --off" t))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment