dcop: tool for controlling stuff, like Konsole

Migrated. Originally posted: 2009-04-04

KDE uses DCOP as its tools for automating the interface in KDE 3.X. In KDE 4.X, DBUS is used instead. I use the following program to connect to machines in a “build” network at work. As you can see, it saves some typing, but more important, it shows the name of the machine on the Konsole tab.

#!/bin/bash
set -ue

function usage() {
    echo Usage: $0 computername
    echo " -" $0 will renamethe current tab after the machine, and ssh to it
    echo

    exit 1
}

if [ $# -eq "0" ]
then
    echo Error: Please supply the computer name
    echo
    usage
fi

computer=$1

konsole=$( echo $KONSOLE_DCOP | sed 's/.*(\([^,]\+\).*/\1/' )

echo Connecting to: ${computer}.build

session=$( dcop $konsole konsole currentSession )
dcop $konsole $session renameSession $computer
ssh sxdev@${computer}.build
dcop $konsole $session renameSession "shell (was $computer)"
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s