Customise Yakuake Tabs On Start

YakuakeI’ve been recommending the slide-down terminal Yakuake to people for some time now and I couldn’t live without it myself. Although I use Cinnamon as a desktop I much prefer Yakuake over Guake and can live with the extra RAM usage of the KDE libraries.

When logging in I wanted to have tabs created for the servers I commonly connect to rather than just starting Yakuake with one empty tab. To do so I replaced the start-up command that called the Yakuake binary with the following script:

#!/bin/bash

/usr/bin/yakuake &
sleep 1

function instruct {
    cmd="qdbus org.kde.yakuake $1"
    eval $cmd &> /dev/null
    sleep 0.5
}
instruct "/yakuake/sessions org.kde.yakuake.addSession"
instruct "/yakuake/sessions org.kde.yakuake.addSession"
instruct "/yakuake/sessions org.kde.yakuake.addSession"
instruct "/yakuake/sessions org.kde.yakuake.addSession"
instruct "/yakuake/sessions org.kde.yakuake.addSession"

instruct "/yakuake/tabs org.kde.yakuake.setTabTitle 0 LOCAL"
instruct "/yakuake/tabs org.kde.yakuake.setTabTitle 1 marge"
instruct "/yakuake/tabs org.kde.yakuake.setTabTitle 2 homer"
instruct "/yakuake/tabs org.kde.yakuake.setTabTitle 3 bart"
instruct "/yakuake/tabs org.kde.yakuake.setTabTitle 4 lisa"

instruct "/Sessions/1 org.kde.konsole.Session.sendText 'top'"
instruct "/Sessions/2 org.kde.konsole.Session.sendText 'ssh jonny@marge'"
instruct "/Sessions/3 org.kde.konsole.Session.sendText 'ssh jonny@homer'"
instruct "/Sessions/4 org.kde.konsole.Session.sendText 'ssh jonny@bart'"
instruct "/Sessions/5 org.kde.konsole.Session.sendText 'ssh jonny@lisa'"

instruct "/Sessions/1 org.kde.konsole.Session.sendText \$'\n'"
instruct "/Sessions/2 org.kde.konsole.Session.sendText \$'\n'"
instruct "/Sessions/3 org.kde.konsole.Session.sendText \$'\n'"
instruct "/Sessions/4 org.kde.konsole.Session.sendText \$'\n'"
instruct "/Sessions/5 org.kde.konsole.Session.sendText \$'\n'"

Note that the Session numbers start from 1 but when naming the tabs start from zero. Also if you are testing this out with your own commands you need to quit Yakuake before running the script again as the Session numbers will need to be reset back to 1.

 

Reference: http://kdetipsdb.nielsvm.org/automatically-setup-yakuake-upon-login

One Response to “Customise Yakuake Tabs On Start”

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>