Anyone knows how to add a key-binding in konsole that binds a key combination to a sequence of actions?
Maybe, this could be achieved via a script?
In my case, I just want a key-binding to switch to a certain tab and send the command !! (last used command). This is super-useful while developing. I can do the first action with standard konsole keybinding and the second action using a qdbus command. I don't know how to put them together...
4 Comments
count0@lemmy.dbzer0.com · 2 pts · 2y
Thank you!
This is what I came up with.
So you'd save the scripts somewhere you like, and run the
useThisSessionone in the session you'd like to be the target.Then, you can run / bind to a shortcut / ... the
runCommandscript, and it will show, raise, set Session, and run the command on the target saved earlier.useThisSession.sh:runCommand.sh:For testing purposes, I'm using
"echo cmd"instead of'!!'(note the different type of quotes) to not cause any... unintended... executions.Running
qdbus $MYCMD_SERVICE /konsole/MainWindow_$MYCMD_WINDOWwill show you all methods available on the Window, eg, so you can pick&choose from those if you want different behaviour from show (& un-minimize) and raise.EDIT: syntax adjusted to work in 'regular' bash
Capricorn@lemmy.today · 1 pts · 2y
Great! Anyway, still far from what you can get with tmux or kitty with just a line in the config...
count0@lemmy.dbzer0.com · 2 pts · 2y
Soo... If we could figure out how to do the first one via DBus/from the command line, you could put both in a script and bind that to a (global or so) shortcut, and be set. (?)
What qdbus command line exactly are you using to post input to the shell within Konsole?
I'll have a look later when I'm at my desktop again (and hopefully will remember).
Capricorn@lemmy.today · 3 pts · 2y
The thing is that the qdbus command only works from inside the terminal, because it needs to know the correct konsole instance. Anyway, I moved to alacritty because the konsole support for ANSI codes is terrible...
Qdbus command:
qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION runCommand "!!"