exwm
exwm copied to clipboard
grab emacs frame with OBS
I'm currently setting up an environment to pre-record lectures (Thank's Corona).
I was thinking about using OBS as recording system. OBS can be configured to record any collection of sources (web-cam, Windows (Xcomposite), etc.). It works perfectly with X-applications started in EXWM. The only problem I have is, that I cannot capture Emacs buffers I'm currently working in since they don't seem to be known to the composite manager.
Is there any way to make an emacs buffer known so that it can be captured with X-application buffers?
Thanks for any suggestion,
Alex
OBS uses _NET_CLIENT_LIST
to get a list of windows:
https://github.com/obsproject/obs-studio/blob/226f704e90292099fb9baf6d77f7ead286caf4c7/plugins/linux-capture/xcompcap-helper.cpp#L108
At the moment only X windows are included in that list.
Ideally, the X window ID of each Emacs window would be added to that list, but Emacs does not provide that ID. (Moreover, I think Emacs windows are not X windows internally, though I'm not sure.) On the other hand, Emacs does provide the frames' X window IDs. If we added those to the list, OBS would be able to record them. The downside would be that they would show an empty buffer in stead of the managed X windows.
Perhaps we can include XIDs of Emacs frames when setting that property in exwm-manage--set-client-list
. The XIDs are stored in the exwm-outer-id
frame parameter. No sure if that will break something else.
I tried this with with:
(defun exwm-manage--set-client-list ()
"Set _NET_CLIENT_LIST."
(exwm--log)
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST
:window exwm--root
:data (vconcat (mapcar #'car exwm--id-buffer-alist)
(seq-remove #'not (mapcar (lambda (f) (frame-parameter f 'exwm-outer-id)) (frame-list)))))))
But OBS was not able to pick up my frames, using the exwm-container
parameter did work for me though:
(defun exwm-manage--set-client-list ()
"Set _NET_CLIENT_LIST."
(exwm--log)
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST
:window exwm--root
:data (vconcat (mapcar #'car exwm--id-buffer-alist)
(seq-remove #'not (mapcar (lambda (f) (frame-parameter f 'exwm-container)) (frame-list)))))))
Although this worked for OBS it did not allow Firefox to pick up these frames.
I haven't noticed any negative effects yet
@jtamagnan-delphix, thank you for checking and letting everyone know.
I don't understand why the first doesn't work... One difference is that the exwm-container
X window is a direct child of the root X window, but that shouldn't matter.
Does OBS show only the Emacs frame or do the X windows show up as well?