Unicode support in qterminal 0.9.0?


#1

I’m on OpenBSD 6.4 with LXQt 0.13.0 and qterminal 0.9.0. I have two questions about Unicode support in qterminal:

  1. How to display Unicode characters in qterminal? I have a test file that contains this string: eĥoŝanĝoĉiuĵaŭde. qterminal cannot display the Unicode characters at all. See this demonstration:

bruno@thinkpad:~459$ echo $LANG

en_US.UTF-8

bruno@thinkpad:~460$ echo $LC_ALL

en_US.UTF-8

bruno@thinkpad:~461$ cat test.txt

eoanoiuade

Is qterminal able to display Unicode characters? If so, how do I enable it?

  1. How to enter Unicode characters in qterminal? In all other X applications (including everywhere else in LXQt) to enter a Unicode character I press Shift+Control+u (at which point an underlined lowercase u appears), enter a Unicode code point, then press Enter. Pressing Shift+Control+u has no effect in qterminal.

Is it possible to enter Unicode characters in qterminal via Shift+Control+u? If so, how do I “activate” this function?

Thank you very much for any help! -Bruno


(stefano) #2

schermata-21-07-52-54

Not sure how much of this is still valid.


(Pedram Pourang) #3

No problem here either; just changed keyboard layout to Esperanto with US English locale (default) and typed into QTerminal:


#4

Thank you both for the input. Changing keyboard layout makes no difference here: The letters with diacritics simply don’t show up.

I tinkered some more and discovered something strange. If I start qterminal from keyboard shortcut or LXQt menu, no Unicode support. But then if I launch a new qterminal from existing qterminal (by typing qterminal at the shell prompt), everything works in the child terminal.

I compared the environment of parent and child terminals, but only difference I can detect is in SHLVL.

Does this new information suggest anything to you?


(Alf Gaida) #5

It might be that i’m totally wrong - but:

Just have a look into CmakeLists.txt

option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
option(BUILD_EXAMPLE "Build example application. Default OFF." OFF)
option(QTERMWIDGET_USE_UTEMPTER "Uses the libutempter library. Mainly for FreeBSD" OFF)
option(QTERMWIDGET_BUILD_PYTHON_BINDING "Build python binding" OFF)
option(USE_UTF8PROC "Use libutf8proc for better Unicode support. Default OFF" OFF)

So make sure that qtermwidget is compiled with USE_UTF8PROC - one should rebuild qterminal against the lib with the new options. The option has effects on several parts of qtermwidget:

if(USE_UTF8PROC)
    find_package(Utf8Proc REQUIRED)
endif()

...

if (UTF8PROC_FOUND)
    target_compile_definitions(${QTERMWIDGET_LIBRARY_NAME}
        PRIVATE
            "HAVE_UTF8PROC"
    )
    target_include_directories(${QTERMWIDGET_LIBRARY_NAME}
        INTERFACE
            ${UTF8PROC_INCLUDE_DIRS}
    )
    target_link_libraries(${QTERMWIDGET_LIBRARY_NAME}
        ${UTF8PROC_LIBRARIES}
    )
    string(APPEND PKG_CONFIG_REQ ", libutf8proc")
endif()

(Pedram Pourang) #6

I’ve never changed any default option but, of course, I use Linux, not OpenBSD.


#7

Thank you guys. I will recompile qtermwidget if necessary, but I doubt that’s the issue. Everything in OpenBSD is compiled with UTF8 support by default.

As I mentioned, when I launch qterminal from an existing qterminal, there is Unicode support in the child terminal. This is what the parent terminal spits out when launching the child:

bruno@thinkpad:~305$ qterminal
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-bruno'
Properties constructor called
TRANSLATIONS_DIR: Loading translation file "qterminal_en_US.qm" from dir /usr/local/share/qterminal/translations
load success: false
QDir::exists: Empty or null file name
Canot open file "/home/bruno/.config/qterminal.org/qterminal_bookmarks.xml"
Trying to load translation file from dir "/usr/local/share"
Trying to load translation file from dir "/usr/share"
Trying to load translation file from dir "/usr/local/share/qtermwidget5/translations"
default KB_LAYOUT_DIR:  "/usr/local/share/qtermwidget5/kb-layouts"
loadAllColorSchemes
Shell program: "/usr/local/bin/bash"
("/usr/local/bin/bash")

I tried creating a wrapper script that exports the three environmental variables mentioned, but no luck with that. I guess I’m running out of easy fixes.


#8

Is there a way for me to create a profile from a running qterminal? Is so, I could create a profile of a child terminal in which Unicode is working. After that, I can make a keyboard shortcut that runs ‘qterminal --profile /path/to/profile/with/working/unicode’


#9

I figured it out. I had ‘export LANG=en_US.UTF-8’ and ‘export LC_ALL=en_US.UTF-8’ in my .bashrc file, but by the time those environmental variables are set it’s “too late” for first qterminal instance.

Key was to put those two export statements in my ~/.xsession so that those two environmental variables are in effect everywhere in X. Now everything works as expected. Sorry for the noise.


#10

I’m not anything here but a lurker trying to learn stuff but I wouldn’t call your questions and results ‘noise’.

I do at least somewhat multi-lingual work on my system and I’ve found getting things working to be pretty much a black hole for time and effort often enough with very little positive result.

This is one place my old Mac+ was wonderful - - - I could work in a number of languages in the same document and had no issues - - - well maybe with the dictionaries - - - but not with the setup nor the printing.

I hope that one day Linux will be also as easy (and to make matters worse I’ve learnt more languages and some are not even using Latin characters so things are far more interesting! - - - grin!)

Hopefully my response isn’t what’s considered ‘noise’!

Regards


(Pedram Pourang) #11

As a “Windows refugee”, I came to Linux 14-15 years ago and, since then, have never had any problem with any language. My keyboard layout indicators have shown 3-5 languages (depending on what I do) under various DEs and I’ve been able to type easily in those languages anywhere.

The image you have in your mind about Linux and languages seems strange to me.


#12

tsujan

      [Pedram Pourang](https://forum.lxqt.org/u/tsujan)




    March 22

dabeegmon: I hope that one day Linux will be also as easy

As a “Windows refugee”, I came to Linux 14-15 years ago and, since then, have never had any problem with any language. My keyboard layout indicators have shown 3-5 languages (depending on what I do) under various DEs and I’ve been able to type easily in those languages anywhere.

What I’m missing is the incredible ease of working in multiple languages in even one document.

Its not that long ago that I found a relatively straightforward way of changing languages - - - its still awkward using more than one in a document - - - it needs a keyboard layout change every time. The Mac on the other hand allowed the use of option key combinations that were very easy to memorize (still have a number of them in my head right now not having used them at a keyboard for just about 20 years). Its just not that easy - - - - (maybe) yet.

Perhaps you have a system that is that easy - - - is so - – please?

The image you have in your mind about Linux and languages seems strange to me.

I am quite well aware that linux systems can use a very large number of languages but the ease of mixing them - - - - that is the sticking point.

Regards


(Pedram Pourang) #13

Good point! I almost never need to mix languages while typing and when I need another language in a specific window, I enable Window/Application switching policy.

I’ll check if there’s a feature request for layout shortcuts or if it’s already possible (I don’t think so); if not, I’ll open an issue (and might try to implement it if there isn’t an essential obstacle). I don’t think it’s a Linux limitation.

Other than that, I see no practical problem.

Also, please note that @puffyUberAlles’s problem was about OpenBSD, not Linux. Let’s not mix different issues under the same topic – although, it was good that you did so :wink:


#14

tsujan

      [Pedram Pourang](https://forum.lxqt.org/u/tsujan)




    March 22

dabeegmon: What I’m missing is the incredible ease of working in multiple languages in even one document

Good point! I almost never need to mix languages while typing and when I need another language in a specific window, I enable Window/Application switching policy.

I’ll check if there’s a feature request for layout shortcuts or if it’s already possible (I don’t think so); if not, I’ll open an issue (and might try to implement it if there isn’t an essential obstacle). I don’t think it’s a Linux limitation.

Other than that, I see no practical problem.

Hmmmm - - - its not a ‘linux’ limitation is largely a limitation because few persons have the need. Linux imo has helped bring the needs (AND the skills) from what is commonly called the third world much more into prominence but so much of the strategy and direction setting is still done in North America and its not that long ago where someone who was even bi-lingual wasn’t really ‘common’. Now in Europe its been sort of normal for quite some time where if you had a university education - - - well it was likely that you would be at least reasonable in 3 if not 4 languages and sometimes its even 5 or 6. So because the developoment crew doesn’t ‘commonly’ use multiple languages in ‘a’ document - - - well it isn’t on the radar.

I hadn’t brought up the topic because I wanted to get someone to implement a neat solution but I sure wouldn’t say no to such. Be sort of cool to have linux be more flexible on the desktop than the major competition and at least equal to the other major empire. Thank you for considering this!!!

Also, please note that @puffyUberAlles’s problem was about OpenBSD, not Linux. Let’s not mix different issues under the same topic – although, it was good that you did so

Sorry - - - I missed that part. I did change the subject though as the intent of the thread had definitely shifted (at least imo).

Regards


(Pedram Pourang) #15

That was very helpful. You made me find (and fix) a regression :slight_smile:


#16

@dabeegmon - I have a similar need: I never write multiple languages in one document, but write in English, Portuguese, and Esperanto in separate documents. I don’t like switching back and forth between keyboard layouts, so desired a single solution for all three languages.

Not finding any, I rolled my own. It’s a python3 script that watches for custom “trigger” character combinations and converts triggers to Unicode characters on-the-fly. (It is similar to hotstrings concept in autoit, but autoit is not available in OpenBSD.)

To use my script, install python3, xclip, and yad using your package manager. Then install pynput and Xlib using pip3. It works in Linux (I’ve checked) and should work in any Unix-like OS.

Here is the python3 script: klavaro

And here is my conf file: klavaro.conf

klavaro.conf can contain whatever trigger <-> character mappings you want. Just make sure to put klavaro.conf in the same directory as klavaro. Start it with klavaro start and stop it with klavaro stop :slight_smile:


(Pedram Pourang) #17

That’s already easy to do and I do it a lot. You could enable Window/Application switching policy in LXQt Panel’s keyboard indicator.

I opened https://github.com/lxqt/lxqt-config/issues/447 for what @dabeegmon proposed.


#18

Here’s hoping - - - will be watching for any word.

(Thank you for being open to this enhancement!!!)

Dee