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.
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.
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
$ bspc-spawn.sh "kitty:kak-files" "kitty --name kak-files broot" ":send focus; set global fileswin" "--presel-dir west --presel-ratio 0.15"
$ bspc-spawn.sh "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>'
}
A belated reply, as I am working on a plugin for R that also relies on a side pane. You can kill the pane easily if you know its (unique) TMUX pane id. First, you need a command to create the pane that stores its ID as a pane_id Kakoune option. Called from the shell, tmux can do this with the -P (“print”) and -F (“format”) flags. So you could write a Kakoune command like: