Announcement

Collapse
No announcement yet.

Konsole, change tabname on commandline

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Konsole, change tabname on commandline

    I used to use KDE 3. Here I made in my konsole some scripts to start my servers.

    Each server has a name and that name was automatically used as tabname.
    Code:
    SERVER=test
    
    /usr/bin/dcop $KONSOLE_DCOP_SESSION renameSession "$SERVER"
    /usr/bin/ssh -l root $SERVER.tester.com $1
    /usr/bin/dcop $KONSOLE_DCOP_SESSION renameSession "Shell"
    Now in the new KDE and Konsole, this doesn't work anymore.

    Can anybody give me a direction or a hint on how I can make such a script again?
    Fat_lu is in tha house!

    #2
    Re: Konsole, change tabname on commandline

    You shouldn't need a script for that. Edit your konsole profile, under "Tabs"-tab you can set how to rename tabs in remote sessions '%h' and '%H' stand for hostname (short and long format).

    In case you're wondering why your script doesn't work, dcop has been superceded by dbus in KDE4.

    Comment


      #3
      Re: Konsole, change tabname on commandline

      If I change the value under remote session to '%h' or '%H' nothing changes. The tabname is still pcname:bash.
      After restarting Konsole, it still doesn't work.

      And I did knew that dcop was changed by dbus. But I can't find out on google how I could do this with dbus.
      Fat_lu is in tha house!

      Comment


        #4
        Re: Konsole, change tabname on commandline

        Originally posted by Dikke_lu
        If I change the value under remote session to '%h' or '%H' nothing changes. The tabname is still pcname:bash.
        After restarting Konsole, it still doesn't work.
        Hmm, working as expected here with Karmic KDE4.3 (Which version of KDE are you using, could be a bug?)

        I have "%n : %D" for local sessions, and "@%H" for remote sessions and the tab name changes to "@hostname" with an ssh connection.
        (Just to make sure, you did try connecting to the remote machine after changing the setting? :P)

        Comment


          #5
          Re: Konsole, change tabname on commandline

          The same thing like you '@%H' changes the tabname to @ but not to @Hostname

          I have KDE version KDE: 4.2.2 (KDE 4.2.2). I only update when kubuntu pushes the updates.

          (Just to make sure, you did try connecting to the remote machine after changing the setting? Tongue)
          Oh no I forgot to do that :P. No, I'm kidding
          Fat_lu is in tha house!

          Comment


            #6
            Re: Konsole, change tabname on commandline

            Anybody else an idea how I can fix this?
            Fat_lu is in tha house!

            Comment


              #7
              Re: Konsole, change tabname on commandline

              I talked to a friend of mine who is running jaunty, and she said tab renaming is working as expected for her (she is using kde 4.2.4, though). So I'd think it is either a bug in kde4.2.2 konsole or some sort of config issue.

              Originally posted by Dikke_lu
              The same thing like you '@%H' changes the tabname to @ but not to @Hostname
              Sort of works, just not the important part. Did you try other variables than %h or %H...are the variables not working in general, or just the hostname keys?

              Comment


                #8
                Re: Konsole, change tabname on commandline

                None of the variables is working.

                I will test it on another jaunty machine if it is a config issue!
                Fat_lu is in tha house!

                Comment


                  #9
                  Re: Konsole, change tabname on commandline

                  Originally posted by Dikke_lu
                  I used to use KDE 3. Here I made in my konsole some scripts to start my servers.

                  Each server has a name and that name was automatically used as tabname.
                  Code:
                  SERVER=test
                  
                  /usr/bin/dcop $KONSOLE_DCOP_SESSION renameSession "$SERVER"
                  /usr/bin/ssh -l root $SERVER.tester.com $1
                  /usr/bin/dcop $KONSOLE_DCOP_SESSION renameSession "Shell"
                  Now in the new KDE and Konsole, this doesn't work anymore.

                  Can anybody give me a direction or a hint on how I can make such a script again?
                  I ported a similar script I had. The only problem I haven't solved is if I rename a tab, the tabs lose their name the instance I type something into a shell. The following is a shortened sanitized version of it (yes the `echo yadda'\r'` business is necessary to send commands into your shells):

                  #!/bin/bash

                  kstart --maximize konsole

                  sleep 2

                  for nr in 1 2 3; do
                  qdbus org.kde.konsole /Konsole org.kde.konsole.Konsole.newSession
                  done

                  qdbus org.kde.konsole /Sessions/1 org.kde.konsole.Session.setTitle 1 server1
                  qdbus org.kde.konsole /Sessions/2 org.kde.konsole.Session.setTitle 1 server2
                  qdbus org.kde.konsole /Sessions/3 org.kde.konsole.Session.setTitle 1 server3


                  qdbus org.kde.konsole /Sessions/1 sendText "`echo ssh -i ~/sshkeys/id_dsa_server1 root@some_server1$'\r'`"
                  qdbus org.kde.konsole /Sessions/2 sendText "`echo ssh -i ~/sshkeys/id_dsa_server2 root@server2$'\r'`"
                  qdbus org.kde.konsole /Sessions/3 sendText "`echo ssh -i ~/sshkeys/id_dsa_server3 root@server3$'\r'`"

                  qdbus org.kde.konsole session-3 sendText "`echo cd /home/user/scripts$'\r'`"

                  Comment


                    #10
                    Re: Konsole, change tabname on commandline

                    The only problem I haven't solved is if I rename a tab, the tabs lose their name the instance I type something into a shell
                    did you ever find a way to make the new tab text stay persistent?

                    Comment

                    Working...
                    X