# How can I make Org-Roam work in a single-window-mode? (Only one window + the backlinks buffer)

**URL:** <https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726>\
**Category:** Requests\
**Created:** [January 17, 2025, 6:18pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726 "2025-01-17T18:18:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alienbogart](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@alienbogart](https://org-roam.discourse.group/u/alienbogart)\
**Post date:** [January 17, 2025, 6:18pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/1 "2025-01-17T18:18:21Z")

</div>

I would like to use Org-Roam with only a single-window. Technically two windows if you count the Backlinks Buffer.

Traditionally, when I open a node via the Backlinks Buffer, it will open as a new window below the existing one. So I would have three windows: one with the buffer where I was previously, the one with the new node, and the Backlinks Buffer. I would prefer, instead, if the new link occupied the whole left part of the frame, remove the previous Buffer from view.

I have tried fixing that using advices and functions of my own (I’m not a programmer in the slightest) but nothing seemed to work universally and flawlessly with all the links/nodes/things that open stuff from the Backlinks Buffer.

Is there any official or recommended way to do that?

Thanks!

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 17, 2025, 6:49pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/2 "2025-01-17T18:49:02Z")

</div>

You say you use Doom in another thread. Doom has its own window management (called popup, or something rather). You’d need to look into how you can tame windows with it from Doom resources or community. I spent countless hours a few years back only to learn this lesson without succeeding to help the other person (on this forum).

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 17, 2025, 6:58pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/3 "2025-01-17T18:58:15Z")

</div>

By default, org-roam should use `pop-to-buffer-same-window`…

See lines 437-439 [here](https://github.com/org-roam/org-roam/blob/main/org-roam-mode.el#L437).

See how your system is configured to respond to this function.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 19, 2025, 4:46pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/4 "2025-01-19T16:46:17Z")

</div>

> [@alienbogart](#):
>
> I have tried fixing that using advices and functions of my own (I’m not a programmer in the slightest) but nothing seemed to work universally and flawlessly with all the links/nodes/things that open stuff from the Backlinks Buffer.

I’ll be brief here and try to come back with more to explain this, but here is what I consider to be one of minimum configuration approaches to achieve “Org-Roam with only a single-window”. No need for advice or custom functions; only with user options made available by Emacs and Org. (Org-roam just leverages these). As I don’t fully understand how Doom does things, your miles will vary for sure…

```emacs-lisp

(add-to-list 'display-buffer-alist
             '("\\*org-roam\\*"
               (display-buffer-in-side-window)
               (window-width . 0.25)
               (side . left) ; << replace left with right as you prefer; top
                             ; and bototom are also acceptable here
               (slot . 0)))

(setopt display-buffer-base-action
        '((display-buffer-use-some-window)))

(setf (alist-get 'file org-link-frame-setup)
                     #'find-file)

```

---

<div class="post-metadata">

**Author:** ![akashp](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/akashp/32/1383_2.png) [@akashp](https://org-roam.discourse.group/u/akashp)\
**Post date:** [January 19, 2025, 6:21pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/5 "2025-01-19T18:21:43Z")

</div>

Hey @nobiot I was wondering if it was possible to open it in a new frame? I like how org-remark can open the notes buffer in a new frame.  
Is it possible to achieve it? It is probably off topic here, but is there any general way? Or can the above settings be modified to achieve it?

Much thanks.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [January 19, 2025, 7:29pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/6 "2025-01-19T19:29:35Z")

</div>

> [@akashp](#):
>
> I was wondering if it was possible to open it in a new frame?

Sure, it should be possible. I won’t test it now myself, but the theory tells me the following ways:

To open `org-roam-buffer`, this should work.

```emacs-lisp
(add-to-list 'display-buffer-alist
             '("\\*org-roam\\*"
               (display-buffer-pop-up-frame`)) ;<< there are other functions to open a new frame; try them

```

I can’t be certain how you can open a link target back in the “main” frame from within `org-roam-buffer` – I only use one frame. The default `org-roam-preview-visit` uses `pop-to-buffer-same-window` as shown in the code excerpt below. I don’t know if it woks across frames (it may well do). If not, you may need to override the `preview-visit` function with using `display-buffer-use-some-frame` or `display-buffer-other-frame`.

```auto
        (display-buffer-fn (if other-window
                               #'switch-to-buffer-other-window
                             #'pop-to-buffer-same-window)))

```

---

<div class="post-metadata">

**Author:** ![akashp](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/akashp/32/1383_2.png) [@akashp](https://org-roam.discourse.group/u/akashp)\
**Post date:** [January 20, 2025, 5:56pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/7 "2025-01-20T17:56:41Z")

</div>

> [@nobiot](#):
>
> If not, you may need to override the `preview-visit` function with using `display-buffer-use-some-frame` or `display-buffer-other-frame`.

Thanks, I had some more time to look into this, I was earlier trying to use `display-buffer-overriding-action` but it turned out to make the situation more complex than I like, I opted for overriding the functions altogether in the end.

> [@nobiot](#):
>
> To open `org-roam-buffer`, this should work.
> 
> ```auto
> (add-to-list 'display-buffer-alist
> '("\\*org-roam\\*"
> (display-buffer-pop-up-frame`)) ;<< there are other functions to open a new frame; try them
> 
> ```

This opens the org-roam-buffer in another frame, i think its workable too - but I lose the ability of org-roam-buffer following the currently opened node.

```auto
(defun org-roam-buffer--redisplay-h ()
  "Reconstruct the persistent `org-roam-buffer'.
This needs to be quick or infrequent, because this designed to
run at `post-command-hook'."
  (and (get-buffer-window org-roam-buffer 'all-frames)
       (org-roam-buffer-persistent-redisplay)))

```

However, if we add the 'all-frames argument to get-buffer-window here; it will follow the currently “selected” window, although this is very finicky since even the mouse cursor moving over the frame will cause the org-roam-buffer to change as its part of a `post-command-hook`.

Ultimately, i settled on changing the `display-buffer-fn`

```auto
(display-buffer-fn (if other-window
                               #'switch-to-buffer-other-window
                             #'org-roam-get-or-create-frame)))

```

in both `org-roam-preview-visit` and `org-roam-grep-visit` with the following function

```auto
(defvar org-roam-frame nil
  "Dedicated frame for visiting links from Org-roam buffers.")

(defun org-roam-get-or-create-frame (buffer)
  "Get the existing Org-roam frame or create a new one, and open BUFFER in it."
  (if (frame-live-p org-roam-frame)
      ;; If the frame exists, just select it
      (progn
	(select-frame-set-input-focus org-roam-frame)
	(pop-to-buffer buffer))
    (setq org-roam-frame
          (make-frame '((name . "*Org-roam-visit*"))))
    (select-frame-set-input-focus org-roam-frame)
    (switch-to-buffer buffer)))

```

This creates a new frame, and uses that to visit links from the org-roam-buffer as opposed to having the org-roam-buffer itself in another frame.

---

<div class="post-metadata">

**Author:** ![nwstout](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nwstout/32/1682_2.png) [@nwstout](https://org-roam.discourse.group/u/nwstout)\
**Post date:** [November 10, 2025, 3:47pm UTC](https://org-roam.discourse.group/t/how-can-i-make-org-roam-work-in-a-single-window-mode-only-one-window-the-backlinks-buffer/3726/8 "2025-11-10T15:47:42Z")

</div>

I know this an old thread, but I just wanted to say thank you! I was having the exact same problem as OP, and it was driving me nuts! I put your code in `config.el`, and it worked!

Side note: It looks like I only needed to add

```elisp
(setopt display-buffer-base-action
        '((display-buffer-use-some-window)))

```

The other two lines are already set up in Doom Emacs (except the `org-roam` buffer is on the right, which I prefer).
