unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34516: Multi-monitor frame sets
@ 2019-02-17 19:34 Juri Linkov
  2019-02-18 10:47 ` Robert Pluim
                   ` (3 more replies)
  0 siblings, 4 replies; 42+ messages in thread
From: Juri Linkov @ 2019-02-17 19:34 UTC (permalink / raw)
  To: 34516

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Shouldn't frame.el provide a command like make-frame-on-display,
but to make a frame on the specified monitor instead of display?

Isn't the following patch the right way to do this?
(It also adds completion for the existing command):


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: make-frame-on-monitor.patch --]
[-- Type: text/x-diff, Size: 1958 bytes --]

diff --git a/lisp/frame.el b/lisp/frame.el
index dc81302939..38f2653905 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -644,9 +644,33 @@ window-system-for-display
 (defun make-frame-on-display (display &optional parameters)
   "Make a frame on display DISPLAY.
 The optional argument PARAMETERS specifies additional frame parameters."
-  (interactive "sMake frame on display: ")
+  (interactive (list (completing-read
+                      (format "Make frame on display: ")
+                      (delete-dups
+                       (mapcar (lambda (frame)
+                                 (frame-parameter frame 'display))
+                               (frame-list))))))
   (make-frame (cons (cons 'display display) parameters)))
 
+(defun make-frame-on-monitor (monitor &optional parameters)
+  "Make a frame on monitor MONITOR.
+The optional argument PARAMETERS specifies additional frame parameters."
+  (interactive (list (completing-read
+                      (format "Make frame on monitor: ")
+                      (mapcar (lambda (a)
+                                (cdr (assq 'name a)))
+                              (display-monitor-attributes-list)))))
+  (let ((geometry (car (delq nil (mapcar (lambda (a)
+                                           (when (equal (cdr (assq 'name a)) monitor)
+                                             (cdr (assq 'geometry a))))
+                                         (display-monitor-attributes-list))))))
+    (make-frame (append (x-parse-geometry (format "%dx%d+%d+%d"
+                                                  (nth 2 geometry)
+                                                  (nth 3 geometry)
+                                                  (nth 0 geometry)
+                                                  (nth 1 geometry)))
+                        parameters))))
+
 (declare-function x-close-connection "xfns.c" (terminal))
 
 (defun close-display-connection (display)

^ permalink raw reply related	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2019-04-01 11:29 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-17 19:34 bug#34516: Multi-monitor frame sets Juri Linkov
2019-02-18 10:47 ` Robert Pluim
2019-02-18 21:03   ` Juri Linkov
2019-02-19  9:17     ` Robert Pluim
2019-02-23 20:43       ` Juri Linkov
2019-02-24 12:56         ` Robert Pluim
2019-02-24 21:08           ` Juri Linkov
2019-02-24 22:11             ` Andy Moreton
2019-02-25 21:11               ` Juri Linkov
2019-03-02 20:54           ` Alan Third
2019-03-02 23:57             ` Andy Moreton
2019-03-03 11:43               ` Alan Third
2019-03-04  9:52                 ` Robert Pluim
2019-03-04 13:56                   ` Andy Moreton
2019-03-04 16:10                     ` Robert Pluim
2019-03-04 19:20                       ` Alan Third
2019-03-04 20:18                         ` Robert Pluim
2019-03-19 21:33                           ` Juri Linkov
2019-03-26  7:24                             ` Robert Pluim
2019-03-26  7:26                               ` Robert Pluim
2019-03-27 21:46                                 ` Juri Linkov
2019-03-28  7:56                                   ` Robert Pluim
2019-03-28 21:57                                     ` Juri Linkov
2019-02-18 16:48 ` Eli Zaretskii
2019-02-18 21:16   ` Juri Linkov
2019-02-19  3:32     ` Eli Zaretskii
2019-02-19 21:37       ` Juri Linkov
2019-02-19 10:40     ` Andy Moreton
2019-02-19 21:31       ` Juri Linkov
2019-02-19 23:29         ` Andy Moreton
2019-02-20 21:20           ` Juri Linkov
2019-02-20 21:38             ` Andy Moreton
2019-02-23 20:48               ` Juri Linkov
2019-02-24  8:44                 ` martin rudalics
2019-02-24 21:08                   ` Juri Linkov
2019-02-24 22:13                   ` Andy Moreton
2019-02-25 10:13                     ` martin rudalics
2019-02-25 15:00                       ` Andy Moreton
2019-03-05  0:44 ` Andy Moreton
2019-03-29  8:16 ` Robert Pluim
2019-03-30 21:47   ` Juri Linkov
2019-04-01 11:29     ` Robert Pluim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).