EXWM: Automate external screen toggling
parent
b9ca30d96a
commit
c1a96fc3f1
|
@ -217,4 +217,26 @@
|
|||
(,(kbd "M-<") . ,(kbd "<home>"))
|
||||
(,(kbd "M->") . ,(kbd "<end>")))))))
|
||||
|
||||
;; Function to automatically toggle between internal/external screens.
|
||||
(defun ambrevar/exwm-change-screen-hook ()
|
||||
(let ((xrandr-output-regexp "\n\\([^ ]+\\) connected ")
|
||||
default-output)
|
||||
(with-temp-buffer
|
||||
(call-process "xrandr" nil t nil)
|
||||
(goto-char (point-min))
|
||||
(re-search-forward xrandr-output-regexp nil 'noerror)
|
||||
(setq default-output (match-string 1))
|
||||
(forward-line)
|
||||
(if (not (re-search-forward xrandr-output-regexp nil 'noerror))
|
||||
(call-process "xrandr" nil nil nil "--output" default-output "--auto")
|
||||
(call-process
|
||||
"xrandr" nil nil nil
|
||||
"--output" (match-string 1) "--primary" "--auto"
|
||||
"--output" default-output "--off")
|
||||
(setq exwm-randr-workspace-output-plist (list 0 (match-string 1)))))))
|
||||
|
||||
(require 'exwm-randr)
|
||||
(add-hook 'exwm-randr-screen-change-hook 'ambrevar/exwm-change-screen-hook)
|
||||
(exwm-randr-enable)
|
||||
|
||||
(provide 'init-exwm)
|
||||
|
|
Loading…
Reference in New Issue