Bug 283719 - RFE - Add ability to send commands to Konsole via D-BUS
Summary: RFE - Add ability to send commands to Konsole via D-BUS
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.7.1
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
Depends on:
Reported: 2011-10-10 16:44 UTC by Oleg Atamanenko
Modified: 2012-03-24 19:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0


Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Atamanenko 2011-10-10 16:44:35 UTC
Version:           2.7.5 (using KDE 4.7.1) 
OS:                Linux

Current DBUS API doesn't have separate method to run command in Konsole. 

And method sendText doesn't allow to send \n in command. It adds escape to \ and the result text contains \n.

As I know there is similar command exists in yakuake (https://gitorious.org/yakuake/yakuake/blobs/master/app/sessionstack.h#line85)

Could you please port this command from yakuake to konsole?

Thank you!

Reproducible: Didn't try

Steps to Reproduce:

Expected Results:  
Comment 1 Mark Atkinson 2011-10-31 16:45:36 UTC
You can send a command and have it execute, but it needs to use the correct character from your terminfo, not \n or \r\n.   Most likely this is '^M' in your case, so the following shell function will send a command to a session

sendtab () {
    dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call \
    --print-reply ${session} org.kde.konsole.Session.sendText string:"$cmd^M"

* Note that you must use the actual control character (0x0d) and not just the string '^M' in your script (i.e.  ctrl-v+<enter key> in vim/gvim)
Comment 2 Jekyll Wu 2012-03-24 19:18:27 UTC
Git commit ba204b106577aa0e1c5662272d68b17a9e35cc9b by Jekyll Wu.
Committed on 24/03/2012 at 14:30.
Pushed by jekyllwu into branch 'master'.

Add dbus method runCommand(QString) for running command

Although the existing dbus method sendText(QString) can be used to do
the same job, it is not very friendly since users have to deal with the
problem of how to represent and send the final newline.
REVIEW: 104398
FIXED-IN: 4.9.0

M  +5    -0    src/Session.cpp
M  +5    -0    src/Session.h