Discussed in http://forum.kde.org/viewtopic.php?f=227&t=101711&p=220475 My workflow with konsole involves opening up a window with lots of tabs to various servers. I would like to be able to search for tab contents. Hitting ctrl-alt-/ or something and typing "cas-dev" would select the tab containing that string. This would allow me to quickly find the tab corresponding with the server I'm searching for. Reproducible: Always
Created attachment 132649 [details] Kate Ctrl Tab Video Video attached of kate's Ctrl Tab feature Perhaps something similar to kate's Ctrl Tab feature could be used, I'm not sure if this feature is a KDE module/plugin to apps or if it's only in kate. But either way it could be used.
The following command allows the user to select a session by searching through the session names, and returns the number of the chosen session: qdbus $KONSOLE_DBUS_SERVICE /Windows/1 sessionList|xargs -I{} sh -c 'printf "%s\t" {}; qdbus $KONSOLE_DBUS_SERVICE /Sessions/{} org.kde.konsole.Session.title 1'|fzf --with-nth 2 |cut -d$'\t' -f1 The only missing piece here is the ability to switch to the tab associated with a session number via D-bus.
I should add that, since `sessionList` only returns session numbers, we need to loop through all sessions to get their titles, which is awfully slow. A dedicated `sessionListWithTitle` method would be much needed for that purpose.
> The only missing piece here is the ability to switch to the tab associated with a session number via D-bus. This would be achieved by fixing bug 422262.
(In reply to Nicolas Girard from comment #4) > > The only missing piece here is the ability to switch to the tab associated with a session number via D-bus. > > This would be achieved by fixing bug 422262. I filed that bug when I wanted to achieve the same thing. Currently I have an awful workaround which activates the tabs one by one and gets the current title while it founds the searched tab.
(In reply to Gabor from comment #5) > > I filed that bug when I wanted to achieve the same thing. Currently I have > an awful workaround which activates the tabs one by one and gets the current > title while it founds the searched tab. Yeah, I saw someone else getting that dirty here: https://debianforum.de/forum/viewtopic.php?t=178041 and didn't feel like trying. How bad does it feel with a few tens of tabs ? I might give it a try after all, if you don't mind pasting your code.
(In reply to Nicolas Girard from comment #6) > (In reply to Gabor from comment #5) > > > > > I filed that bug when I wanted to achieve the same thing. Currently I have > > an awful workaround which activates the tabs one by one and gets the current > > title while it founds the searched tab. > > Yeah, I saw someone else getting that dirty here: > https://debianforum.de/forum/viewtopic.php?t=178041 and didn't feel like > trying. > > How bad does it feel with a few tens of tabs ? > I might give it a try after all, if you don't mind pasting your code. Here you have it: https://pastebin.com/7HFThb5a activates the tab if found else exits 0
Works with exact match, and I have not tried it more than about 10 tab.
> > Here you have it: https://pastebin.com/7HFThb5a > activates the tab if found else exits 0 OK, so thanks to your input I tried `dbus-send` and adopted it as it seems roughly twice as fast as `qdbus`. I took your "tab switch" loop from your code and incorporated into mine, reducing the sleep delay to 5ms. I also revamped my code. The overall result is... well, not that bad for a temporary solution. It's crappy, but it does the job. Since this has been pissing me off so long, and probably other people too, I think I'll create a proper repo on Github and put the code there.
> Since this has been pissing me off so long, and probably other people too, I think I'll create a proper repo on Github and put the code there. Done: https://invent.kde.org/ngirard/konsole-tab-switch
I would agree having something like would be nice. The link in comment 10 looks like a nice alternative for now.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/1045
Git commit 74c648c0fc842af4746892205330a77377c90cbd by Kurt Hindenburg, on behalf of Troy Hoover. Committed on 04/12/2024 at 14:18. Pushed by hindenburg into branch 'master'. Add search tab button to the tab bar The button takes user input and sorts through a list of tab names for the tab that matches SearchTabs pulls from Kate's similar tab sort function called QuickOpen GUI: M +3 -0 src/CMakeLists.txt A +318 -0 src/searchtabs/SearchTabs.cpp [License: GPL(v2.0+)] A +68 -0 src/searchtabs/SearchTabs.h [License: GPL(v2.0+)] A +69 -0 src/searchtabs/SearchTabsModel.cpp [License: GPL(v2.0+)] A +68 -0 src/searchtabs/SearchTabsModel.h [License: GPL(v2.0+)] A +431 -0 src/searchtabs/kfts_fuzzy_match.h [License: LGPL(v2.0+)] M +115 -8 src/settings/TabBarSettings.ui M +8 -0 src/settings/konsole.kcfg M +34 -1 src/widgets/ViewContainer.cpp M +2 -0 src/widgets/ViewContainer.h https://invent.kde.org/utilities/konsole/-/commit/74c648c0fc842af4746892205330a77377c90cbd