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

Displaying X buffers in a predefined fashion #906

Open
nanjigen opened this issue Feb 6, 2023 · 0 comments
Open

Displaying X buffers in a predefined fashion #906

nanjigen opened this issue Feb 6, 2023 · 0 comments

Comments

@nanjigen
Copy link

nanjigen commented Feb 6, 2023

I’m working to try and wrangle the x-windows of a wine program. I have some regexes that capture the exwm-titles and rename the buffers to what is seen below.
As x-windows under EXWM are just emacs buffers, they should be controllable with the built-in display-buffer tooling via display-buffer-alist with the following layout in mind:

--------------------------------------------
| tree       |  sm-element-window   |
|                |                                                |
|                |                                                |
|                |                                                |
|                |                                                |
|                |                                                |
|                |-------------------------------|
|                |  sm-element-data          |
|                |                                                |
-------------------------------------------
    (add-to-list 'display-buffer-alist
                 '(("sm-frame"
                    (display-buffer-no-window))
                   ("sm-element-window"
                    (display-buffer-reuse-window display-buffer-same-window)
                    (window-width . 0.60))
                   ("sm-knowledge-tree"
                    (display-buffer-reuse-window display-buffer-in-side-window)
                    (side . left)
                    (slot . 0)
                    (window-width . 0.22))
                   ("sm-element-data"
                    (display-buffer-at-bottom)
                    (side . bottom)
                    (slot . 0)
                    (window-height . 0.24))))

However, this doesn’t work as expected, and we have to wrap these rules in an exwm hook:

    (add-hook 'exwm-manage-finish-hook
              (lambda ()
                (when (string-match-p "sm-frame" (buffer-name))
                  (display-buffer
                   (get-buffer-create "sm-frame")
                   '((display-buffer-same-window)
                     (allow-no-window . t))))
                (when (string-match-p "sm-element-window" (buffer-name))
                  (display-buffer
                   (get-buffer-create "sm-element-window")
                   ;; (doom-modeline-mode 1)
                   '((display-buffer-same-window) ;;FIXME maybe as race condition this doesn't work as expected
                     (window-height . 0.60))))
                (when (string-match-p "sm-knowledge-tree" (buffer-name))
                  (display-buffer
                   (get-buffer-create "sm-knowledge-tree")
                   '((display-buffer-in-side-window)
                     ;; (inhibit-same-window . t)
                     (side . left)
                     (slot . 0)
                     (window-width . 0.21))))
                (when (string-match-p "sm-element-data" (buffer-name))
                  (progn (exwm-layout-hide-mode-line)
                         (display-buffer
                          (get-buffer-create "sm-element-data")
                          '((display-buffer-in-side-window)
                            ;; (inhibit-same-window . t)
                            (side . bottom)
                            (slot . 1)
                            (window-height . 0.24)))))))

Unlike the alist attempt, the hook creates the correctly sized windows, and at least for some of the buffers, initially places them in the correct configuration.
However, this approach seems to be triggered everytime I change workspaces, causing the hook to attempt to replace the buffers ending in a broken buffer layout.

I'd prefer to use the more idiomatic display-buffer-alist approach if possible.

What information should I be using to debug the issue?

If anyone has advice or working display-buffer-alist configurations for multi-window applications that would be greatly appreciated.

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

1 participant