Results 1 to 4 of 4

Thread: [Python] Set title in Konsole (and other terminals)

  1. #1
    Join Date
    Jul 2011
    Location
    /Europe/Netherlands
    Beans
    378
    Distro
    Kubuntu 22.04 Jammy Jellyfish

    [Python] Set title in Konsole (and other terminals)

    I found a method to change the title of the terminal from Python. However it doesn't seem to work for me in Kubuntu 12.10 and Konsole as terminal. https://bbs.archlinux.org/viewtopic.php?id=85567

    The code that supposed to work is:
    Code:
    import sys
    sys.stdout.write("\x1b]2;test\x07")
    To quickly try out yourself:
    Type
    Code:
    python
    to enter the python shell and enter the two lines I quoted above.

    This does not change the title in Konsole however. Neither do those lines give any errors. Is their another way to set the terminal title from within Python? Or is the problem just with KDE's Konsole?

  2. #2
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: [Python] Set title in Konsole (and other terminals)

    That command works in LXTerminal, and also in gnome-terminal.

    According to this page you need to enable it in Preferences for Konsole, but I don't have KDE available at the moment to verify this.

  3. #3
    Join Date
    Jul 2011
    Location
    /Europe/Netherlands
    Beans
    378
    Distro
    Kubuntu 22.04 Jammy Jellyfish

    Re: [Python] Set title in Konsole (and other terminals)

    Thanks again spjackson for the quick reply. I'll try that later on and report back here

  4. #4
    Join Date
    Jul 2011
    Location
    /Europe/Netherlands
    Beans
    378
    Distro
    Kubuntu 22.04 Jammy Jellyfish

    Re: [Python] Set title in Konsole (and other terminals)

    So it's a Konsole specific 'problem'. After changing the tab tile to "%w" I get my custom titles. I'll mark this as solved. Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •