chad [2022-11-29 19:41:11] wrote: > On Tue, Nov 29, 2022 at 1:11 PM Max Nikulin <manikulin@gmail.com> wrote: >> [...] >> Add to user notes content of X selection when emacs is started as >> daemong with no frames and the user prefers to avoid distraction due to >> creation of a new frame. > In general, you seem to assume that there's no way for emacs to create a > new X11 frame object without it being immediately visible to the user. In > my experience, that's only true in the limited subset of cases where the > user has chosen a window manager that enforces that choice. Further, that > wasn't the default when I last looked -- but that was quite some time ago, > and I don't know about the current options/defaults for common X11-based > display systems of today. Can anyone shed some light on this? `xclip.el` (from GNU ELPA) uses: (defun xclip--hidden-frame () (or xclip--hidden-frame (setq xclip--hidden-frame (make-frame-on-display (getenv "DISPLAY") '((visibility . nil) (user-position . t) (left . 0) (top . 0) (no-other-frame . t)))))) I haven't heard of a problem with that yet, but it probably hasn't been widely tested (and it is specific to X11). > This is a fundamentally different case from "the user wants to use a > non-graphical X11-based mechanism that emacs normally doesn't enable until > emacs actually connects to a working X11 display", and I think it should be > possible to get emacs to make that connection without necessarily popping > up a window that the user doesn't want. server.el also does something similar to xclip-mode, tho with simpler code: (defun server-select-display (display) ;; If the current frame is on `display' we're all set. ;; Similarly if we are unable to open frames on other displays, there's ;; nothing more we can do. (unless (or (not (fboundp 'make-frame-on-display)) (server--on-display-p (selected-frame) display)) ;; Otherwise, look for an existing frame there and select it. (dolist (frame (frame-list)) (when (server--on-display-p frame display) (select-frame frame))) ;; If there's no frame on that display yet, create and select one. (unless (server--on-display-p (selected-frame) display) (let* ((buffer (generate-new-buffer " *server-dummy*")) (frame (make-frame-on-display display ;; Make it display (and remember) some dummy buffer, so ;; we can detect later if the frame is in use or not. `((server-dummy-buffer . ,buffer) ;; This frame may be deleted later (see ;; server-unselect-display) so we want it to be as ;; unobtrusive as possible. (visibility . nil))))) (select-frame frame) (set-window-buffer (selected-window) buffer) frame)))) This code has been used a lot more widely, but in many/most cases we end up making that frame visible soon after, so there might be cases where it is not 100% unobtrusive but users don't notice it. Stefan
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4