Bug 337001 - Script to open new tabs with a specific command.
Summary: Script to open new tabs with a specific command.
Status: RESOLVED DUPLICATE of bug 310842
Alias: None
Product: yakuake
Classification: Applications
Component: general (other bugs)
Version First Reported In: 2.9.9
Platform: Debian unstable Linux
: NOR wishlist
Target Milestone: ---
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-03 11:15 UTC by Salvo "LtWorf" Tomaselli
Modified: 2014-10-19 10:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Salvo "LtWorf" Tomaselli 2014-07-03 11:15:54 UTC
I have written a script called ynew, that uses qdbus to tell yakuake to open a new tab, call it something and run something inside that tab.

I usually use it like that:

ynew build_server

Which will open a terminal with an ssh connection to that server. The terminal will also close when the ssh is terminated.

It is useful for anything that has an interactive prompt and we might want to have inside a separate shell.



Here's the script:

#!/bin/sh

title=$1
script=~/.ynew/$1

if ! test -e $script
then
        echo command does not exist
        read -p "add a new command? [Y/n]" a

        if test -z "$a"
        then
                a="y"
        fi

        if [ "$a" = "y" ] || [ "$a" = "Y" ]
        then
                mkdir ~/.ynew
                echo "#!/bin/sh" > $script
                chmod u+x $script
                editor $script
        fi
        exit 0
fi

qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.addSession

for i in `qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.sessionIdList | sed 's/,/ /g'`
do
        lastsession=$i
done

qdbus org.kde.yakuake /yakuake/tabs org.kde.yakuake.setTabTitle $lastsession $title

qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.runCommandInTerminal $lastsession $script



I think it could be included within the yakuake installation.

Reproducible: Always
Comment 1 Eike Hein 2014-10-19 10:04:42 UTC
Thank you for your contribution, but I think this would be better implemented by adding support for the -e option that Konsole has.

Related: Bug 149518.

*** This bug has been marked as a duplicate of bug 310842 ***