You are not logged in.
Pages: 1


While in the process of adapting Triskel (KDE) to be more like Manjaro Xfce and replacing Konsole with xfce4-terminal, I identified one thing that I really liked from Konsole.
This is how Konsole (of KDE) does does tab titles by default, name of running process after subtle ~ or -, eg.
| ~ : bash | - : sudo -i | ~ : wget -c | ~ : sleep 200 | ~ : rsync | Less useful and more kludge is displaying user@hostname, ie. below is what xfce terminal shows, eg :
| user1@compute | root@comput | user1@compute | user1@compute | user1@compute | BTW in case devs don't know, the Help button on the Title Popup-Editor-Bubble links to a broken/non-existent page:
I did a blind probe/test, which seems to indicate only the following dynamic variables exist for tab titles:
%# : the tab number (eg. "1" for first tab, then "2", etc...)
%d : username of user that started the tab?? Even when root it says non-root 'user1'???
%D : home dir of user that started the tab?? Even when root it says /home/user1/ ???, and
%w : (default) the slightly more useful title (eg. user1@compu..., or root@compu...)
What may be intuitive, user-friendly, less kludge could be something like:
%c : command (full with options etc), and
%C : command (first word ie. "$0" only)
The speculative '%c' above would at least result in something like below, which would be helpful:
| bash | sudo -i | wget -c | sleep 200 | rsync -avu | EDIT: So I guess my question is, have I just missed something, or is the thing I'm looking for just not an option?
Added later 8 h 54 min 32 s:
Guessing by lack of response from this learned community that there is no method to easily do above.
I re-edited the above post to make it hopefully extra readable, when I get time i'll patch xfce4-terminal to do this and produce a fairly detailed post on re-building xfce4-terminal on a Trisquel (debian) amd64 setup (until maybe it ends up in the main project). In the meantime thanks for reading, non-responses are also responses. Any further input will of course still be apprciated. Till then, peace and joy to all. 
Last edited by organicode (Today 02:26:40)
No LLM was used in the production of this post
Offline


If you are using bash as your shell, you can use it's trap/DEBUG with PROMPT_COMMAND extensions to accomplish the same effect:
trap '[[ "$BASH_COMMAND" == "$PROMPT_COMMAND" ]] || printf "\e]0;%s : %s\a" "$PWD" "$BASH_COMMAND"' DEBUG
PROMPT_COMMAND='printf "\e]0;%s\a" "$PWD"'Place this code in your ~/.bashrc file and open a new terminal window to test.
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


Work great for me.
xfce4-terminal-0.6.3
bash-4.4.23
ncurses-6.3
It's sad to think that this thread will get buried in the forum, we need a new option called [Tip of the Week]
.
Offline


Place this code in your ~/.bashrc
Niiiice! Def a top tip! Thanks ToZ. The '$PWD' part seems to output the full path to a folder (ie. "/home/user1"), so i replaced it with a more simple dash '-' for root users or a tilde '~' for non-root. I never want a full PWD in the title.
This is a result of mangling your code, ToZ, but it only seems to work for non-root for some reason??
if [[ ${EUID} == 0 ]] ; then
trap '[[ "$BASH_COMMAND" == "$PROMPT_COMMAND" ]] || printf "\e]0;- : %s\a" "$BASH_COMMAND"' DEBUG
PROMPT_COMMAND='printf "\e]0;- : bash\a"'
else
trap '[[ "$BASH_COMMAND" == "$PROMPT_COMMAND" ]] || printf "\e]0;~ : %s\a" "$BASH_COMMAND"' DEBUG
PROMPT_COMMAND='printf "\e]0;~ : bash\a"'
fiGetting sooo close! 
No LLM was used in the production of this post
Offline


but it only seems to work for non-root for some reason??
How are you running these root commands/sessions?
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


sudo -i # or
sudo su
I suppose I'm expecting something like what is is the OP, like sudo -i to appear as the "running" command, until i launch another command as root i guess. 
No LLM was used in the production of this post
Offline


For "sudo -i", you need to put the same snippet into the root's bash initialization file (/root/.bash_profile).
"sudo su" is somewhat redundant as both commands kind of do the same thing (sudo to run commands as root, su to get a root login), but try running "sudo su -" which will simulate a root login and read .bash_profile as in "sudo -i".
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


put the same snippet into the root's bash initialization file
Don't mind me, its as if the internet switched my brain off hahaha
MARKING AS SOLVED
Congrats all! Long live freedom software! 
No LLM was used in the production of this post
Offline
Pages: 1
[ Generated in 0.027 seconds, 7 queries executed - Memory usage: 550.41 KiB (Peak: 567.39 KiB) ]