View previous topic :: View next topic |
Author |
Message |
barca n00b

Joined: 13 Nov 2007 Posts: 20 Location: Poland
|
Posted: Fri Apr 15, 2011 6:51 pm Post subject: yakuake_exec.sh - run command in new tab with custom title |
|
|
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 |
|
 |
|
|
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
|
|