Xfce Forum

Sub domains
 

You are not logged in.

#1 2026-10-05 17:56:59

dandelot
Member
Registered: 2026-10-05
Posts: 3
UbuntuFirefox 156.0

termal window title

Ubuntu 26.04.1 LTS  xfce  4.20

In the past , in a C program

  printf("\033]0;%s\007]", pref);

would set the terminal window title.

But not now.   It always shows
      userid@pwd (with real user id and what pwd would show).

I don't know where that specification comes from.

If I use xterm instead I can set the window title, but  have had no luck finding a settings page to
have correct colors and default window size.

Ideas?

Offline

#2 2026-10-05 22:53:24

juribel
Member
Registered: 2026-10-05
Posts: 1
LinuxFirefox 153.0

Re: termal window title

printf("\033]0;%s\007]", pref);

In a bash shell, try
 

printf '\e]2;title\007\n'; read

Works in bash here and in Perl, should work in C, too, should work in any language. Note that I printed '\e]2;', number 2 instead of 0, but both numbers should work. Use the read command to have the shell wait for your enter key, because otherwiseyour text disappears as soon as the prompt is shown, too quick to notice.

Here: Debian trixie with Xfce 4.20.1 and Xfce-Terminal 1.1.4

Offline

#3 2026-10-05 23:50:19

dandelot
Member
Registered: 2026-10-05
Posts: 3
UbuntuChrome 153.0

Re: termal window title

The terminal in the panel says the command is:

exo-open --launch TerminalEmulator

/usr/bin/xfce4-terminal

behaves exactly the same, setting the title does nothing. So far.

Added later 02 min 27 s:
I did alter the code to do:


printf("\e]2;%s\007\n", "dd");

sort of as you suggested.
Should have said that in previous note.

Added later 04 min 40 s:
That newline you suggested did result in
a blank line in the terminal window, but the title
of the window is not affected.

Offline

#4 2026-10-06 00:40:07

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,719
LinuxFirefox 157.0

Re: termal window title

One reason why the code might not work as previously, and works in xterm, might be related to your shell.

#include <stdio.h>

void main() {
        const char *pref = "XFCE";
        printf("\e]2;%s\007\n", pref);
}

This works in bourne shell (sh) but not bash because bash uses the PROMPT_COMMAND environment variable to overwrite the title when your c program finishes. To test this, try adding in a sleep(3); after the printf command (so you can see the effect), or in bash, "unset PROMPT_COMMAND" and run the program.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2026-10-06 01:19:32

dandelot
Member
Registered: 2026-10-05
Posts: 3
UbuntuChrome 153.0

Re: termal window title

Yes, right. It worked. Thank you.

Looking at $PROMPT_COMMAND, the default value is

__vte_prompt_command

which is not particularly meaningful (at least to me).

Added later 11 min 56 s:
I added

export PROMPT_COMMAND=""

to ~/.bashrc

and that worked.  I hope it won't have other effects.

Last edited by dandelot (2026-10-06 01:22:51)

Offline

#6 2026-10-06 11:59:03

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,719
LinuxFirefox 156.0

Re: termal window title

dandelot wrote:

Looking at $PROMPT_COMMAND, the default value is

__vte_prompt_command

which is not particularly meaningful (at least to me).

On your system, PROMPT_COMMAND isn't being directly set, but rather, bash is using a vte built-in function. You can see the contents of this function via:

type __vte_prompt_command

...which is probably defined somewhere in /etc/profile.d.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.022 seconds, 10 queries executed - Memory usage: 564.52 KiB (Peak: 565.5 KiB) ]