Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-07-20 17:26:25

wrh1728
Member
Registered: 2020-12-15
Posts: 43

Setting title in xfce4-terminal

I would like to set the title in an existing xfce4-terminal instance to the command most recently typed at the command line in that instance. In addition, I would like to be able to specify the font used for this, so that even long command lines will stand a good chance to fit in their entirety within the title region.

In this at all possible? I am running Xfce 4.16 with xfce4-terminal 0.8.10.

Offline

#2 2022-07-20 18:58:33

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,493

Re: Setting title in xfce4-terminal


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-07-20 18:59:25

wrh1728
Member
Registered: 2020-12-15
Posts: 43

Re: Setting title in xfce4-terminal

wrh1728 wrote:

I would like to set the title in an existing xfce4-terminal instance to the command most recently typed at the command line in that instance. In addition, I would like to be able to specify the font used for this, so that even long command lines will stand a good chance to fit in their entirety within the title region.

In this at all possible? I am running Xfce 4.16 with xfce4-terminal 0.8.10.

Actually, this is more an issue having to do with the shell in the terminal emulator. In case this can be of help to anybody, when running bash, if one adds the following line to one's .bashrc file:

trap 'echo -ne "\033]2;$(history 1 | sed "s/^[ ]*[0-9]*[ ]*//g")\007"' DEBUG

then every time a new command is typed that command is printed out in the title bar of the xfce4-terminal instance.  Still no clue how to change the font size though.

Offline

#4 2022-07-20 19:29:46

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: Setting title in xfce4-terminal

Depending on your distribution and your shell, you may or may not have it preset in shellrc file. Assuming it's Debian with Bash, first make sure to comment out the following section:

# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
#    ;;
#*)
#    ;;
#esac

Somewhere below, assign PROMPT_COMMAND:

PROMPT_COMMAND='echo -ne "\033]0;$(history 1 | cut -d" " -f4-)\007"'

Naturally, to make the changes take effect, sourcing ~/.bashrc is required.

Window title font is set by xfwm4, so you can't really apply only to one app.
Tab title font can be changed via ~/.config/gtk-3.0/gtk.css:

#xfce4-terminal-notebook label {
	font-size: 12px;
}

Edit
And I got beaten by ToZ. tongue

Last edited by KBar (2022-07-20 19:44:03)


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#5 2022-07-21 23:19:12

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: Setting title in xfce4-terminal

what if a "solution" used lines typed in even if they are not shell commands, such as a "y/n?" response?  would that be OK or do you really need to show commands, only.  only the shell would know what is a command as opposed to data (which it would not get).  tailing the history file in a script run at every command sounds like the thing.

Offline

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.005 seconds, 8 queries executed - Memory usage: 534.66 KiB (Peak: 535.51 KiB) ]