WORK-IN-PROGRESS - Xfce4 terminal: how to correctly set $TERM to xterm-256color

Technical issues/questions of an intermediate or advanced nature.
User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

WORK-IN-PROGRESS - Xfce4 terminal: how to correctly set $TERM to xterm-256color

Post#1 by Rava » 28 Oct 2023, 06:52

Above my issue, the bold and green text further down is about the solution. That for now not works for me - see also below, even further down than the quoted article from https://bbs.archlinux.org/ .

System Porteus 5.01 with XFCE 4.16 x86-64:

Code: Select all

guest@rava:~$ cat /etc/porteus/*
001-core.xzm:20230922
002-xorg.xzm:20231001
002-xtra.xzm:20230922
003-xfce.xzm:20230922
06-man.xzm:20230915
initrd.xz:20220928
The themes really do annoy me in mc.
Tried several, but every one has at least one flaw when a certain file type (or worse even: file types) is not displayed at all.

My current theme (in mc's parlance that is Appearance / Skin) is darkfar
Trying 256 color skin gives me errors like this

Code: Select all

┌────────────────────────────── Error ──────────────────────────────┐
│                                                                   │
│ Unable to use 'gray-green-purple256' skin with 256 colors support │
│                    on non-256 colors terminal.                    │
│                   Default skin has been loaded                    │
│                                                                   │
└───────────────────────────────────────────────────────────────────┘
My DE: XFCE 4.16 on Port 5.01; xfce4-terminal is V0.8.10

E.g. a folder listing looks like so for me using darkfar

Code: Select all

←═ ...gs.default/extension-data ═•[↓]→╗
║↑m     Name      │ Size  │Modify time ║
║/..              │UP--DIR│Oct 28 08:12║
║ ublock0.sqlite  │ 62336K│Oct 28 08:06║
║                 │       │            ║
║                 │       │            ║
║ ematrix.sqlite  │1277952│Oct 28 07:04║
║                 │       │            ║
╟──────────────────────────────────────╢
║ ematrix.sqlite                       ║
╚═══════════════════ 789G/1829G (43%) ═╝
When I move the cursor up it looks like so

Code: Select all

←═ ...gs.default/extension-data ═•[↓]→╗
║↑m     Name      │ Size  │Modify time ║
║/..              │UP--DIR│Oct 28 08:12║
║ ublock0.sqlite  │ 62336K│Oct 28 08:06║
║                 │       │            ║
║ ematrix.~ite.bak│1277952│Oct 28 07:04║
║ ematrix.sqlite  │1277952│Oct 28 07:04║
║                 │       │            ║
╟──────────────────────────────────────╢
║ ematrix.sqlite.bak                   ║
╚═══════════════════ 789G/1829G (43%) ═╝
and when I Dr. Copy and Mr. Paste the above it gets obvious that the two seemingly empty lines are black on black listings of files:

Code: Select all

←═ ...gs.default/extension-data ═•[↓]→╗
║↑m     Name      │ Size  │Modify time ║
║/..              │UP--DIR│Oct 28 08:12║
║ ublock0.sqlite  │ 62336K│Oct 28 08:06║
║ ublock0.~ite.bak│7602176│Oct 28 07:04║
║ ematrix.~ite.bak│1277952│Oct 28 07:04║
║ ematrix.sqlite  │1277952│Oct 28 07:04║
║                 │       │            ║
╟──────────────────────────────────────╢
║ ematrix.sqlite                       ║
╚═══════════════════ 789G/1829G (43%) ═╝
There are others out there with similar issues.
Seemingly a solution is to be found here:
bbs.archlinux.org: [SOLVED] Xfce4 terminal: how to correctly set $TERM to xterm-256color

In other posts in this thread there are warnings and info why it is a bad idea to change globally all of the $TERM variable since that could lead to a broken terminal. Especially when you switch to a Virtual Terminal to do some emergency work or emergency recovery when your DE is no longer reacting, a broken terminal is the last thing you need. Or when you want / need to log into your system using ssh or any other remove access: once again, a broken terminal is the last thing you need.

To quote from the above linked forum post:
sbs wrote:There are two steps to get this working in Xfce4.

1. Copy the system terminal .desktop file to the local config directory.

Code: Select all

cp /usr/share/applications/xfce4-terminal.desktop ~/.local/share/applications/xfce4-terminal.desktop
and edit the following two entries:

Code: Select all

Exec=xfce4-terminal
Terminal=false
with:

Code: Select all

Exec=env TERM=xterm-256color /bin/bash
Terminal=true
2. This will correctly set the $TERM environment variable when the terminal emulator is launched from the Xfce applications menu, but not when launched from the default panel launcher.

On my system, the panel launcher for the terminal emulator was defined in a .desktop file in the directory ~/.config/xfce4/panel/launcher-*, where "*" is a number, which by default was being called with the commands:

Code: Select all

Exec=exo-open --launch TerminalEmulator
Terminal=false
I could not figure out how to combine "exo-open" with "env", or any other way to set an environment variable with "exo-open", so I also replaced the two .desktop entries with:

Code: Select all

Exec=env TERM=xterm-256color /bin/bash
Terminal=true
and now everything works as expected.
Added in 12 minutes 16 seconds:
Some of my ~/.config/xfce4/panel/launcher-*/*.desktop have these entries:

Code: Select all

Exec=xfce4-terminal
Terminal=false
and not the above mentioned

Code: Select all

Exec=exo-open --launch TerminalEmulator
Terminal=false
For now I created and edited ~/.local/share/applications/xfce4-terminal.desktop as described in the article as quoted above. Now I test a bit and see if that is sufficient already (I doubt that it will be), or if I need to use the same code as in the quote above, but replacing different code from my own ~/.config/xfce4/panel/launcher-*/*.desktop files.

I will be back to report.

Added in 9 minutes 52 seconds:
Nope, not really working.

For now only created and edited the ~/.local/share/applications/xfce4-terminal.desktop file:

Code: Select all

[Desktop Entry]
Version=1.0
Name=Xfce Terminal
Name[de]=Xfce-Terminal
Name[en_AU]=Xfce Terminal
Name[en_GB]=Xfce Terminal
Comment=Terminal Emulator
Comment[de]=Terminal-Programm
Comment[en_AU]=Terminal Emulator
Comment[en_GB]=Terminal Emulator
GenericName=Terminal Emulator
GenericName[de]=Terminal-Programm
GenericName[en_AU]=Terminal Emulator
GenericName[en_GB]=Terminal Emulator
Exec=Exec=env TERM=xterm-256color /bin/bash
Icon=org.xfce.terminal
Terminal=true
Type=Application
Categories=GTK;System;TerminalEmulator;
StartupNotify=true
Actions=preferences;

[Desktop Action preferences]
Name=Terminal Preferences
Name[de]=XFCE Terminal Einstellungen
Name[en_AU]=Terminal Preferences
Name[en_GB]=Terminal Preferences
Exec=xfce4-terminal --preferences
(I removed all language entries I am not interested in)

The "Terminal emulator" that sits in the main menu (not in any sub-menu) works as it should:

Code: Select all

guest@rava:~$ echo $TERM
xterm-256color
but I did not test that menu entry prior the above change. Maybe that entry worked fine all the time?

But when I try to start it via [main menu]/System/XFCE Terminal I get this error:
Image
What does "Failed to execuve" mean? Is that a bug in XFCE 4.16 and should have read "Failed to execute"?
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

WORK-IN-PROGRESS - Xfce4 terminal: how to correctly set $TERM to xterm-256color

Post#2 by Rava » 28 Oct 2023, 07:24

Also, I just realized that the solution from that forum post will not help me at all.
An older terminal (as in: started ages ago) also has this:

Code: Select all

guest@rava:~$ echo $TERM
xterm-256color
(when running mc on that terminal and switching to the terminal in mc, that one reports "xterm" when asked about $TERM, but mc is always started from a terminal that has $TERM=xterm-256color)

so there is no need for any of the above "solution" since it only produces an error.

After deleting the newly created ~/.local/share/applications/xfce4-terminal.desktop all is back to a working state: regardless how I start the xfce4-terminal - all report $TERM=xterm-256color .
And this error
Image
is a thing of the past.

But even though my xfce4-terminal 0.8.10 (Xfce 4.16) reports $TERM=xterm-256color …


… … …


mc is not accepting 256 colours skin / theme / appearance . :wall:

Any ideas?
Cheers!
Yours Rava

itrukrakso
Black ninja
Black ninja
Posts: 62
Joined: 23 Jul 2022, 07:42
Distribution: Porteus 5.01_x86_64 Xfce

WORK-IN-PROGRESS - Xfce4 terminal: how to correctly set $TERM to xterm-256color

Post#3 by itrukrakso » 28 Oct 2023, 09:28

Hi,
Rava wrote:
28 Oct 2023, 07:24
For now only created and edited the ~/.local/share/applications/xfce4-terminal.desktop file:

Code: Select all

[Desktop Entry]
Version=1.0
Name=Xfce Terminal
Name[de]=Xfce-Terminal
Name[en_AU]=Xfce Terminal
Name[en_GB]=Xfce Terminal
Comment=Terminal Emulator
Comment[de]=Terminal-Programm
Comment[en_AU]=Terminal Emulator
Comment[en_GB]=Terminal Emulator
GenericName=Terminal Emulator
GenericName[de]=Terminal-Programm
GenericName[en_AU]=Terminal Emulator
GenericName[en_GB]=Terminal Emulator
Exec=Exec=env TERM=xterm-256color /bin/bash
Icon=org.xfce.terminal
Terminal=true
Type=Application
Categories=GTK;System;TerminalEmulator;
StartupNotify=true
Actions=preferences;

[Desktop Action preferences]
Name=Terminal Preferences
Name[de]=XFCE Terminal Einstellungen
Name[en_AU]=Terminal Preferences
Name[en_GB]=Terminal Preferences
Exec=xfce4-terminal --preferences
look at this line: Exec=Exec=env TERM=xterm-256color /bin/bash

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

WORK-IN-PROGRESS - Xfce4 terminal: how to correctly set $TERM to xterm-256color

Post#4 by Rava » 28 Oct 2023, 10:15

itrukrakso wrote:
28 Oct 2023, 09:28
look at this line: Exec=Exec=env TERM=xterm-256color /bin/bash
:wall:
That would be the reason for the error.

But still: the fix is unneeded in Porteus.
The Virtual Terminals have $TERM=linux :

Code: Select all

When finished, use "poweroff" or "reboot" command and wait until it completes
===============================================================================

rava login: guest
Password:
Last login: Fri Oct 27 00:53:40 on tty2
guest@rava:~$ echo $TERM
linux
guest@rava:~$
and in the xfce4-terminal we have $TERM=xterm-256color as quoted above.

And still, mc insists I have no 256 colours terminal environment. :cry:
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

WORK-IN-PROGRESS - Xfce4 terminal: how to correctly set $TERM to xterm-256color

Post#5 by Rava » 26 Apr 2024, 01:49

Now I run a newer Porteus version than above, but the error is still the same.
In XFCE -xfce4-terminal -

Code: Select all

guest@rava:/$ echo $TERM
xterm-256color
but still, mc tells me my terminal has not 256 colours. :wall:
Cheers!
Yours Rava

Post Reply