Open and close "side panel" for repl and broot like an IDE


To have an ide-like experience, I would like to be able to open and close side panel mostly for my “file tree” ( broot ) and my REPL.

I’m close to find a solution with tmux, but I always have to move to the side panel to be close it. It is a bit painfull since I have to think of the right motion, then type tmux prefix+motion and then prefix+key to close it. I would like to do it in one keystroke.

Anyone has succeeded in implementing this feature ? ( with tmux, kitty or whatever )

I could give you a very simple solution using bspwm, but I am not sure if it’s going to help since changing the window manager is beyond using an application like tmux or kitty.

I will update bspwm.kak with this functionality tomorrow.

Actually I though about switching form i3 to bspwm.

Even tho, I’m curious about the solution

I’m using hammerspoon on Mac, it might be cool to do something similar.

Is it like a Mac equivalent of linux xdotool ?

The best solution would be to use something OS and emulator agnostic, like tmux or dvtm. But everysolution is good to ear.

@scr It can be pretty handy to focus and kill panes without prefix.


# Close focused pane
bind-key -n C-w kill-pane

# Move your focus around
bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R

Nice I didn’t knew I could do that. But still to much keypress in my opinion. I should be able to close the pane with only one keypress.

For the moment I use something like:

break-pane -d -n file_explorer -t 100
join-pane -hb -s file_explorer -p 30

I need to move the focus to the ‘file_explorer’ before doing the break-pane command. But for the moment I’m struggling acheiving that with pane id and select-pane.

Hi again @scr,

I tried to implement this today but I didn’t finish an script that I was confortable with.
Toggling the visibility of a window in bspwm is very easy, in case you want to switch, bspc node <window_id> --flag hidden.

The thing is getting the node’s id. You can do things like getting the id of the next spawned window (which I do for the plugin and store in an option) but what if a window opens just before the one you are expecting?

That’s why you need to be able to add rules for specific windows. It’s possible to do this based on the window’s class name, instance name or title. But because most people will want to open multiple connected terminals, it’s necessary to label them with different instance names, which depends on the terminal emulator.

Right now I have scripts that work but I would like to have something more general. Meanwhile, I share with you a script that does what you want.

define-command simpleide -override -docstring "Open file manager and repl" %{
    declare-option str fileswin
    # Launch a connected broot and a connected repl without focus and set in options their ids
    $ "kitty:kak-files" "kitty --name kak-files broot" ":send focus; set global fileswin" "--presel-dir west --presel-ratio 0.15"
    $ "kitty:kak-repl" "kitty --name kak-repl %arg{@}" ":send focus; set global replwin" "--presel-dir south --presel-ratio 0.8"
    # F4 toggles terminal, F9 toggles files view
    map global normal <F4> ': nop %sh{ bspc node $kak_opt_replwin --flag hidden }<ret>'
    map global insert <F4> '<a-;>: nop %sh{ bspc node $kak_opt_replwin --flag hidden }<ret>'
    map global normal <F9> ': nop %sh{ bspc node $kak_opt_fileswin --flag hidden }<ret>'
    map global insert <F9> '<a-;>: nop %sh{ bspc node $kak_opt_fileswin --flag hidden }<ret>'

Link to

(Btw, broot stops if the window is too small.)

1 Like