feat: open a compose project's folder in a terminal or editor #27
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/20-open-project"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #20
Stacked on #26 (#19 notifications); merge after it.
What
com.docker.compose.project.working_dirlabel."terminal"setting, elsexdg-terminal-exec,$TERMINAL,x-terminal-emulator, then ptyxis, gnome-terminal, kgx, konsole, xfce4-terminal, kitty, alacritty, wezterm, foot, xterm. It's started in the folder (current_dir), so no per-terminal flags are needed."editor"setting, else the first ofcode,codium,zed/zeditor,subl,kate, or the VS Code flatpak, with the folder as its argument. There's no XDG default for a code editor (text/plainis often a plain text editor that can't open folders), so with none found the action becomes Open Folder (xdg-open, the file manager).~/.config/krane/settings.json, e.g.{"terminal": "kitty", "editor": "code --new-window"}. Split like a shell would;{dir}stands for the folder (otherwise editors get it appended, terminals just start in it). No UI for these yet; README documents them.DOCKER_HOSTother thanunix:///npipe://), or the folder doesn't exist here.sh -c, so spaces and quotes are fine), and a threadwait()s on it so nothing is left as a zombie. A failed spawn shows a toast.settings.rsnow holds settings reading/writing (moved out ofnotify.rs).--mock. Newprojectscreenshot scene; README features, screenshot table and layout updated.Tested
mock, build, tests): 4 new unit tests (local vs remote engine, missing folder,{dir}and quoting, launch runs in a folder with a space and errors for a missing program).shop): Open in Terminal opened xfce4-terminal in the project folder; with no editor installed the menu said Open Folder; with"editor": "thunar {dir}"it said Open in Editor and opened the folder. No zombie children left.Known limit: the Info tab's buttons pick up a changed
editorsetting the next time the project is selected (the menu checks each time it opens).Screenshots (mock data)
Adds Open in Terminal and Open in Editor (Open Folder when no editor is found) to a compose project's right-click menu and Info tab. The terminal starts in the project's working directory; the editor gets it as an argument. Both can be set in ~/.config/krane/settings.json ("terminal", "editor", with {dir} for the folder). The actions are hidden when the engine is remote or the folder isn't on this machine. Settings reading/writing moves from notify.rs into settings.rs. Closes #20fd8eb1518573ece6f00173ece6f001ccd4fa0a53F10 fixed in
ccd4fa0(rebased on #26's5838fb8): known terminals now get the folder explicitly:ptyxis --new-window -d DIR,--working-directory=DIRfor gnome-terminal, kgx and xfce4-terminal, plus konsole--workdir, kitty--directory, alacritty--working-directory, weztermstart --cwdand foot-D. x-terminal-emulator (and a $TERMINAL path) is resolved to the terminal it links to,.wrapperstripped, so it gets those args. Nye's unit test passes, and a liveptyxis --new-window -dopens its shell in the folder.