Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open frame when running in emacs --daemon #48

Open
sheijk opened this issue Oct 22, 2019 · 3 comments
Open

Can't open frame when running in emacs --daemon #48

sheijk opened this issue Oct 22, 2019 · 3 comments

Comments

@sheijk
Copy link

sheijk commented Oct 22, 2019

Reproduction steps:

  1. Make sure no Emacs instance is running
  2. (setq atomic-chrome-buffer-open-style 'frame)
  3. Start 'emacs --daemon'
  4. Close Emacs frame (C-x 5 0)
  5. In Chrome edit text and click Atomic Chrome button

This will create the editing buffer in Emacs but will not show up a new frame. If step 3 is omitted and a frame is open everything works fine.

One issue seems to be that (getenv "DISPLAY") will return nil if the Emacs daemon has no open windows (happening in atomic-chrome-show-edit-buffer). Also the attempts to bring the current frame to front after that will fail if no frame is open. So this won't work with split/full, either.

The cause of the original problem in issue #2 seems to be the same (although that hasn't been addressed)

@sheijk
Copy link
Author

sheijk commented Oct 22, 2019

Work-around: call emacsclient -e '(setenv "DISPLAY" ":0")' after starting emacs daemon

@CRTified
Copy link

I was not able to make it work with your workaround. I'm suspecting the following section causes the problem: https://github.com/alpha22jp/atomic-chrome/blob/master/atomic-chrome.el#L186-L198

When no frame is active, window-system is nil, dropping through all cases down to the simple (make-frame frame-params).

Note that your workaround probably worked at its time, as in 2019 there was no check for wayland.

@CRTified
Copy link

My workaround now is a bit hacky, but it works now without opening some frame at all:

(setq window-system 'x)
(setq x-display-name (getenv "DISPLAY"))

DISPLAY is set in the systemd unit that I'm using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants