Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
yakuake_exec.sh - run command in new tab with custom title
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
barca
n00b
n00b


Joined: 13 Nov 2007
Posts: 20
Location: Poland

PostPosted: Fri Apr 15, 2011 6:51 pm    Post subject: yakuake_exec.sh - run command in new tab with custom title Reply with quote

If you (just like me a couple hours ago) think how to run command in Yakuake (possibly in new tab) and change
tab's title... it's for You ;)

Code:
#!/bin/sh
#
# yakuake_exec.sh by Barca (barca@linuxstorm.org)
# Can be freely distributed under the GPL. Enjoy open source ;)
#
# Script to run command in Yakuake and set its tab's title.

case $1 in
    "")
    echo -e "\n\E[34m:::\033[0m\E[31m yakuake_newtab.sh\033[0m \e[34m:::\033[0m"
    echo "yakuake_exec.sh - script to run command in Yakuake and set its tab's title."
    echo -e "by Barca (barca@linuxstorm.org\n"
    echo -e "\E[31mUsage:\033[0m"
    echo -e "$0 <tab title> <command> <options>\n"
    echo -e "\E[31mOptions:\033[0m"
    echo "--newtab           run command in new tab"
    echo -e "\n\E[31mExample:\033[0m"
    echo "$0 soundmixer alsamixer"
    echo -e "opens new tab in Yakuake with title \"soundmixer\" and runs alsamixer binary in it\n"
    exit 0
    ;;
*)
        TAB_TITLE=$1
        COMMAND=$2
        OPTIONS=$3
        if [[ "$OPTIONS" =~ "--newtab" ]]; then qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.addSession &>/dev/null; fi                                                     
        SESSION_ID=`qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId`                                                                                           
        qdbus org.kde.yakuake /yakuake/tabs setTabTitle $SESSION_ID $TAB_TITLE &>/dev/null                                                                                             
        qdbus org.kde.yakuake /yakuake/sessions runCommandInTerminal $SESSION_ID "$COMMAND" &>/dev/null                                                                                 
        exit                                                                                                                                                                           
esac


So you can add to your ~/.kde4/Autostart/autostart.sh (or similar file in any other graphical manager):

Code:
~/moje/yakuake_exec.sh alsamixer alsamixer --newtab
~/moje/yakuake_exec.sh "#" "clear; su" --newtab
~/moje/yakuake_exec.sh "games" "cd ~/games; clear; mc" --newtab
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum