ch11ng / exwm

Emacs X Window Manager
2.85k stars 137 forks source link

Discord causes EXWM to call `(select window nil)`, which errors #877

Open LemonBreezes opened 1 year ago

LemonBreezes commented 1 year ago

Hello. For some reason, when I start Discord, I get a window-live-p nil error. I investigated by adding this advice:

(defun +exwm-select-window-a (oldfun window &rest args)
  (if window (apply oldfun window args)
    (backtrace)))
(advice-add #'select-window :around #'+exwm-select-window-a)

and here are some of the backtraces I've gotten

  backtrace()
  +exwm-select-window-a(#<subr select-window> nil nil)
  apply(+exwm-select-window-a #<subr select-window> (nil nil))
  #f(advice +exwm-select-window-a :around #<subr select-window>)(nil nil)
  ad-Advice-select-window(#f(advice +exwm-select-window-a :around #<subr select-window>) nil)
  apply(ad-Advice-select-window #f(advice +exwm-select-window-a :around #<subr select-window>) nil)
  #f(advice ad-Advice-select-window :around #f(advice +exwm-select-window-a :around #<subr select-window>))(nil)
  apply(#f(advice ad-Advice-select-window :around #f(advice +exwm-select-window-a :around #<subr select-window>)) nil)
  select-window(nil)
  exwm--on-ClientMessage([161 32 236 3 4 0 160 1 63 1 0 0 1 0 0 0 111 26 97 0 0 0 0 0 0 0 0 0 0 0 0 0] t)
  #f(compiled-function (conn) "Process cached events." #<bytecode -0x100f48496dbed8f9>)(#<xcb:connection xcb:connection-2ec26f6>)
  apply(#f(compiled-function (conn) "Process cached events." #<bytecode -0x100f48496dbed8f9>) #<xcb:connection xcb:connection-2ec26f6> nil)
  xcb:-process-events(#<xcb:connection xcb:connection-2ec26f6>)
  xcb:-connection-filter(#<process XELB> "\27\0\327\3\212\1\0\0\4\0\240\1\0\0\0\0\0\0\33\0\0\ni\5\0\0\3\0\0\0\0\0\27\0\327\3\212\1\0\0\4\0\240\1\0\0\0\0\0\0...")
  backtrace()
  (if window (apply oldfun window args) (backtrace))
  +exwm-select-window-a(#<subr select-window> nil nil)
  apply(+exwm-select-window-a #<subr select-window> (nil nil))
  #f(advice +exwm-select-window-a :around #<subr select-window>)(nil nil)
  ad-Advice-select-window(#f(advice +exwm-select-window-a :around #<subr select-window>) nil)
  apply(ad-Advice-select-window #f(advice +exwm-select-window-a :around #<subr select-window>) nil)
  #f(advice ad-Advice-select-window :around #f(advice +exwm-select-window-a :around #<subr select-window>))(nil)
  apply(#f(advice ad-Advice-select-window :around #f(advice +exwm-select-window-a :around #<subr select-window>)) nil)
  select-window(nil)
  exwm--on-ClientMessage([161 32 172 0 2 0 224 0 63 1 0 0 1 0 0 0 24 185 123 1 0 0 0 0 0 0 0 0 0 0 0 0] t)
  #f(compiled-function (conn) "Process cached events." #<bytecode 0x1139e679d51db704>)(#<xcb:connection xcb:connection-30c6b0e>)
  apply(#f(compiled-function (conn) "Process cached events." #<bytecode 0x1139e679d51db704>) #<xcb:connection xcb:connection-30c6b0e> nil)
  xcb:-process-events(#<xcb:connection xcb:connection-30c6b0e>)
  xcb:-connection-filter(#<process XELB> "\24\0\254\0\212\1\0\0\2\0\340\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\241 \254\0\2\0\340\0?\1\0\0\1\0\0\0\30\271...")
  accept-process-output(#<process vterm> 0.1)
  #f(compiled-function (&rest rest) "Teach subsequent commands to use current Emacs instance as editor.\n\nSet and export the environment variable ENVVAR, by default\n\"EDITOR\".  The value is automatically generated to teach\ncommands to use the current Emacs instance as \"the editor\".\n\nThis works in `shell-mode', `term-mode', `eshell-mode' and\n`vterm'." (interactive #f(compiled-function () #<bytecode 0x1dc07fb98bc1>)) #<bytecode 0x84163db50967da2>)()
  my-doom-shut-up-a(#f(compiled-function (&rest rest) "Teach subsequent commands to use current Emacs instance as editor.\n\nSet and export the environment variable ENVVAR, by default\n\"EDITOR\".  The value is automatically generated to teach\ncommands to use the current Emacs instance as \"the editor\".\n\nThis works in `shell-mode', `term-mode', `eshell-mode' and\n`vterm'." (interactive #f(compiled-function () #<bytecode 0x1dc07fb98bc1>)) #<bytecode 0x84163db50967da2>))
  apply(my-doom-shut-up-a #f(compiled-function (&rest rest) "Teach subsequent commands to use current Emacs instance as editor.\n\nSet and export the environment variable ENVVAR, by default\n\"EDITOR\".  The value is automatically generated to teach\ncommands to use the current Emacs instance as \"the editor\".\n\nThis works in `shell-mode', `term-mode', `eshell-mode' and\n`vterm'." (interactive #f(compiled-function () #<bytecode 0x1dc07fb98bc1>)) #<bytecode 0x84163db50967da2>) nil)
  with-editor-export-editor()
  run-hooks(change-major-mode-after-body-hook vterm-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook vterm-mode-hook))
  run-mode-hooks(vterm-mode-hook)
  vterm-mode()
  vterm--internal(ignore "*urbit*")
  startup/start-urbit()
  byte-code("\303\10\304\305\306\307\310\305&\7\210\311\312\313\"\210\314\11\315\316\307\316\307\n\317#\320#!\321#\210\314\11\315\316\307\316\307\n\317#\322#!\323#\210\314\11..." [startup/urbit-buffer doom-leader-map +startup-prefix set-popup-rule! :quit nil :select t :ttl eval-after-load which-key #f(compiled-function () #<bytecode 0xfe391195805c585>) define-key general--kbd general--concat "u" "r" startup/restart-urbit "s" startup/select-urbit "x" startup/kill-urbit buffer-live-p get-buffer startup/start-urbit] 9)
  tmp/exwm-init-hook()
  run-hooks(exwm-init-hook)
  exwm-init()
  run-hooks(window-setup-hook)
  #f(compiled-function () #<bytecode -0x9ea7d71999fdd44>)()
  normal-top-level()
  backtrace()
  (if window (apply oldfun window args) (backtrace))
  +exwm-select-window-a(#<subr select-window> nil nil)
  apply(+exwm-select-window-a #<subr select-window> (nil nil))
  #f(advice +exwm-select-window-a :around #<subr select-window>)(nil nil)
  ad-Advice-select-window(#f(advice +exwm-select-window-a :around #<subr select-window>) nil)
  apply(ad-Advice-select-window #f(advice +exwm-select-window-a :around #<subr select-window>) nil)
  #f(advice ad-Advice-select-window :around #f(advice +exwm-select-window-a :around #<subr select-window>))(nil)
  apply(#f(advice ad-Advice-select-window :around #f(advice +exwm-select-window-a :around #<subr select-window>)) nil)
  select-window(nil)
  exwm--on-ClientMessage([161 32 172 0 2 0 224 0 63 1 0 0 1 0 0 0 46 185 123 1 0 0 0 0 0 0 0 0 0 0 0 0] t)
  #f(compiled-function (conn) "Process cached events." #<bytecode 0x1139e679d51db704>)(#<xcb:connection xcb:connection-30c6b0e>)
  apply(#f(compiled-function (conn) "Process cached events." #<bytecode 0x1139e679d51db704>) #<xcb:connection xcb:connection-30c6b0e> nil)
  xcb:-process-events(#<xcb:connection xcb:connection-30c6b0e>)
  xcb:-connection-filter(#<process XELB> "\24\0\254\0\212\1\0\0\2\0\340\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\241 \254\0\2\0\340\0?\1\0\0\1\0\0\0\30\271...")
  accept-process-output(#<process vterm> 0.1)
  #f(compiled-function (&rest rest) "Teach subsequent commands to use current Emacs instance as editor.\n\nSet and export the environment variable ENVVAR, by default\n\"EDITOR\".  The value is automatically generated to teach\ncommands to use the current Emacs instance as \"the editor\".\n\nThis works in `shell-mode', `term-mode', `eshell-mode' and\n`vterm'." (interactive #f(compiled-function () #<bytecode 0x1dc07fb98bc1>)) #<bytecode 0x84163db50967da2>)()
  my-doom-shut-up-a(#f(compiled-function (&rest rest) "Teach subsequent commands to use current Emacs instance as editor.\n\nSet and export the environment variable ENVVAR, by default\n\"EDITOR\".  The value is automatically generated to teach\ncommands to use the current Emacs instance as \"the editor\".\n\nThis works in `shell-mode', `term-mode', `eshell-mode' and\n`vterm'." (interactive #f(compiled-function () #<bytecode 0x1dc07fb98bc1>)) #<bytecode 0x84163db50967da2>))
  apply(my-doom-shut-up-a #f(compiled-function (&rest rest) "Teach subsequent commands to use current Emacs instance as editor.\n\nSet and export the environment variable ENVVAR, by default\n\"EDITOR\".  The value is automatically generated to teach\ncommands to use the current Emacs instance as \"the editor\".\n\nThis works in `shell-mode', `term-mode', `eshell-mode' and\n`vterm'." (interactive #f(compiled-function () #<bytecode 0x1dc07fb98bc1>)) #<bytecode 0x84163db50967da2>) nil)
  with-editor-export-editor()
  run-hooks(change-major-mode-after-body-hook vterm-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook vterm-mode-hook))
  run-mode-hooks(vterm-mode-hook)
  vterm-mode()
  vterm--internal(ignore "*urbit*")
  startup/start-urbit()
  byte-code("\303\10\304\305\306\307\310\305&\7\210\311\312\313\"\210\314\11\315\316\307\316\307\n\317#\320#!\321#\210\314\11\315\316\307\316\307\n\317#\322#!\323#\210\314\11..." [startup/urbit-buffer doom-leader-map +startup-prefix set-popup-rule! :quit nil :select t :ttl eval-after-load which-key #f(compiled-function () #<bytecode 0xfe391195805c585>) define-key general--kbd general--concat "u" "r" startup/restart-urbit "s" startup/select-urbit "x" startup/kill-urbit buffer-live-p get-buffer startup/start-urbit] 9)
  tmp/exwm-init-hook()
  run-hooks(exwm-init-hook)
  exwm-init()
  run-hooks(window-setup-hook)
  #f(compiled-function () #<bytecode -0x9ea7d71999fdd44>)()
  normal-top-level()
medranocalvo commented 1 year ago

select-window is invoked in _NET_ACTIVE_WINDOW handling. If EXWM receives such a request for a window it does not manage, it will fail. Does discord show a splash screen or similar?

LemonBreezes commented 1 year ago

select-window is invoked in _NET_ACTIVE_WINDOW handling. If EXWM receives such a request for a window it does not manage, it will fail. Does discord show a splash screen or similar?

Yup. That's exactly what happens.

etisHere commented 1 year ago

Just in case you're still having this issue or someone else is make sure you're launching discord with the async-shell-command as it says in the guide.

I found launching discord any other way(counsel-linux-app etc) just gave off this error and would not allow the window to open.