Bug 465448 - Allow to manipulate splits programmatically
Summary: Allow to manipulate splits programmatically
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: split-view (show other bugs)
Version: 22.12.2
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-07 21:42 UTC by Gustavo
Modified: 2023-12-25 17:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo 2023-02-07 21:42:55 UTC
SUMMARY

Konsole lacks a way to manipulate splits programmatically. I can't create, focus, resize or move splits, neither by its CLI interface nor by DBUS. It would be useful if it provided such an API.

For instance, on Kitty, that's how one creates a new split [1]:

kitty @ launch --type=tab --tab-title "My Tab" --keep-focus bash

And that's how one changes focus to another tab/split:

kitty @ focus-window --match 'title:^Output'

Third party programs can then use those APIs to manipulate splits. Kakoune (which implements a client/server architecture) for instance uses them to spawn clients on new splits [2].

STEPS TO REPRODUCE
1. On Konsole, type: konsole --help
2. Type:  qdbus $KONSOLE_DBUS_SERVICE

OBSERVED RESULT

There's no CLI option nor DBUS method to manipulate splits.

EXPECTED RESULT

Be presented with an API for programmatic manipulation of splits.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed 20230204
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

[1]: https://sw.kovidgoyal.net/kitty/remote-control/

[2]: https://github.com/mawww/kakoune/blob/eb0e9831330d3b1e1d3ddb2bc789000706e6e445/rc/windowing/kitty.kak#L28
Comment 1 Kurt Hindenburg 2023-04-28 22:31:38 UTC
This should be possible for someone w/ some time.
Comment 2 Kurt Hindenburg 2023-12-25 17:47:50 UTC
Git commit f7732e33c40e7787a83da53746af06326e0d34dc by Kurt Hindenburg, on behalf of Theodore Wang.
Committed on 25/12/2023 at 18:42.
Pushed by hindenburg into branch 'master'.

Implements DBus methods for manipulation of splits

Methods implmented allow for:
1. retrieval of layout information encoded in a string
2. getting size proportions of a splitter's direct child widgets
3. setting the size proportions of a splitter's direct child widgets
4. simple splitting of a view horizontally or vertically
5. using existing widgets to create a splitter at a specified position under a splitter
6. moving an existing view to a specified position under a splitter
7. moving an existing splitter to a specified position under a splitter
8. switching focus to an existing view

See documentation in source files for more details.

M  +233  -0    src/ViewManager.cpp
M  +56   -0    src/ViewManager.h
M  +3    -0    src/terminalDisplay/TerminalDisplay.cpp
M  +9    -0    src/terminalDisplay/TerminalDisplay.h
M  +15   -0    src/widgets/ViewContainer.cpp
M  +2    -0    src/widgets/ViewContainer.h
M  +86   -0    src/widgets/ViewSplitter.cpp
M  +16   -0    src/widgets/ViewSplitter.h

https://invent.kde.org/utilities/konsole/-/commit/f7732e33c40e7787a83da53746af06326e0d34dc