Tdesktop: Telegram Desktop does not recognize IBus switch between Japanese and English input

Created on 11 May 2016  Β·  82Comments  Β·  Source: telegramdesktop/tdesktop

Steps to reproduce

  1. Log in to the native app in Ubuntu 16.04 64bit
  2. Press CTRL+Spacebar the IBus program switch the language on the system to Japanese from default English.
  3. Type on the window a message to one of the contacts, but Telegram does not recognize the switch and just type in English.

    Expected behaviour

Tell us what should happen: The native Telegram app for Linux desktop should recognize the IBus switch from English to Japanese and allow typing in Japanese like on the other IM clients like Line, Hangouts, Facebook Messenger.

Actual behaviour

Tell us what happens instead: It is no recognizing the switch between En/JP in the desktop Ubuntu 16.04 64bit

Configuration

Operating system:
jair@x1:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

Version of Telegram Desktop:
Telegram Desktop 0.9.48 alpha

Logs

Insert logs here (if necessary)

You can type "debugmode" in settings and then see ~/.TelegramDesktop/DebugLogs/log_...txt for log files.
Type "debugmode" in settings again to disable logs.

3rd party issue bug

Most helpful comment

According to https://wiki.archlinux.org/index.php/Desktop_entries#Modify_environment_variables

Exec=env QT_IM_MODULE=ibus /opt/Telegram/Telegram -- %u

has better compatibility.

All 82 comments

Try starting the app like this:

QT_IM_MODULE=ibus /<path_to_executable>/Telegram/Telegram

Ref: issue #1348

Hello bit-pirate,

I ran it but got this:

Telegram/ Templates/

jair@W510 ~ $ sudo QT_IM_MODULE=ibus /home/jair/Telegram/Telegram
[sudo] password for jair:
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 80: saw unknown, expected number

Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 80: saw unknown, expected number

(Telegram:25076): libnotify-WARNING **: Failed to connect to proxy
jair@W510 ~ $

Thank you for your time and suggestions.

Sincerely,

You should not need (and should not use) sudo to run Telegram. For me on Kubuntu 14.04 Telegram runs fine with and without sudo. However, I only get that warning (Failed to connect to proxy), when using sudo.

γ‚γ‚ŠγŒγ¨γ†γ”γ–γ„γΎγ™οΌ

bit-pirate,

You were right, worked perfectly, the only concern I have is do i need to run Telegram always from the CLI and with the manual command:

jair@x1:~$ QT_IM_MODULE=ibus /home/jair/Telegram/Telegram
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 80: saw unknown, expected number
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 80: saw unknown, expected number

At least works in the native application for Linux. But if there is somewhere a setting where I can make that permanent will be excellent. Thank you in advance for the finding ^^

γ‚ˆγ‚γ—γγŠι‘˜γ„γ—γΎγ™γ€

You can edit command in .desktop file

Like @stek29 I created a desktop file/link/icon.

_Telegram.desktop_

[Desktop Entry]
Comment[en_US]=
Comment=
Exec=QT_IM_MODULE=ibus /home/someone/Downloads/Telegram/Telegram
GenericName[en_US]=
GenericName=
Icon=/home/someone/Pictures/icons_and_logos/telegram_td_logo.png
MimeType=
Name[en_US]=Telegram
Name=Telegram
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

Hello bit-pirate,

Thank you again for battling with me and this bug. This is what I have in Ubuntu 16.04:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
Exec=/home/jair/Telegram/Telegram -- %u
Icon=telegram
Terminal=false
StartupWMClass=Telegram
Type=Application
Categories=Network;
MimeType=x-scheme-handler/tg;
X-Desktop-File-Install-Version=0.22
Name[en_US]=Telegram

If I add the line: QT_IM_MODULE=ibus /home/jair/Telegram/Telegram -- %u

Telegram does not run/start.

Perhaps there is a different syntax?

I will also keep testing and researching.

Sincerely,

Try replacing

Exec=/home/jair/Telegram/Telegram -- %u

with

Exec=QT_IM_MODULE=ibus /home/jair/Telegram/Telegram

BTW what is the -- %u for?

@bit-pirate For handling telegram.me links, as I remember.

Is there a possibility that the team will fix this bug going forward in the next version update?

The format: Exec=/home/jair/Telegram/Telegram -- %u is how ubuntu 16.04 make the desktop icons.

NOTE: Again the issue is just on the Ubuntu 16.04 no even in older versions of Debian or Mint I have this issue.

Thank you!

@bit-pirate @john-preston It's for link handling indeed -- according to FreeDesktop specification %u is replaced by URL when file or link are opened via the app. And TDesktop handles protocol tg://, to which telegram.me links are redirected.

And -- marks end of options..

@jairusan did you manage to solve your problem by adjusting the shortcut settings as proposed?

According to https://wiki.archlinux.org/index.php/Desktop_entries#Modify_environment_variables

Exec=env QT_IM_MODULE=ibus /opt/Telegram/Telegram -- %u

has better compatibility.

The way suggested by @lne1030 worked for me on CentOS 7.

@GLeoLi's method worked for me on Fedora 28 on KDE.

I'm experiencing the same problem on Ubuntu 18.04LTS: Telegram does not recognize the switch to ibus.

It seems to go away after a reboot, only to return again after some time. All other apps work fine. The workaround of setting QT_IM_MODULE does not help.

I see this in the command line:

$ QT_IM_MODULE=ibus $(which telegram-desktop)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/snap/telegram-desktop/274/bin/desktop-launch: line 185: /home/misha/snap/telegram-desktop/common/.config/user-dirs.dirs: No such file or directory
cp: cannot create regular file '/home/misha/snap/telegram-desktop/common/.config/': Not a directory
/snap/telegram-desktop/274/bin/desktop-launch: line 188: /home/misha/snap/telegram-desktop/common/.config/user-dirs.dirs.md5sum: No such file or directory
/snap/telegram-desktop/274/bin/desktop-launch: line 188: /home/misha/snap/telegram-desktop/common/.config/user-dirs.locale.md5sum: No such file or directory
Qt: Session management error: None of the authentication protocols specified are supported
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
propsReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.272\" (uid=1000 pid=23821 comm=\"Telegram \" label=\"snap.telegram-desktop.telegram-desktop (enforce)\") interface=\"org.freedesktop.DBus.Properties\" member=\"GetAll\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=985 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
nmReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.272\" (uid=1000 pid=23821 comm=\"Telegram \" label=\"snap.telegram-desktop.telegram-desktop (enforce)\") interface=\"org.freedesktop.NetworkManager\" member=\"GetDevices\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=985 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
"Object path cannot be empty"

Uninstalling the snap package and installing with apt seems to resolve the problem. I'm not sure if it's a telegram or a packaging issue.

Same here with ubuntu and snap package

I am experiencing the same issues on ubuntu 18.04 with the snap version, yet everything works with older versions from apt/ppas. If QT_IM_MODULE fix does indeed work on 16.04, the bugfix might be as easy as manually telling QT which IM module to load.

Issue persists on ubuntu 18.04. None of these fixes work.

Same issue on Ubuntu 19.04. None of the suggested workaround fixes the defect.

Same issue on Fedora 30. Exporting QT_IM_MODULE=ibus does not help.
Anki also has this bug.

Similar problem here on Ubuntu 19.10, can not input Chinese in Telegram which is installed from snap store . The apt source version is OK.

Please check 1.9.9, now it uses the common desktop-launch script

I haven't seen this problem on my side in a while, if that helps.

When anki had a similar problem, updating glib to version glib2-2.60.7 fixed the problem:
See https://bugzilla.redhat.com/show_bug.cgi?id=1762455#c3

telegram-desktop also does not have this problem anymore on Fedora 31. Current versions on my system:

  • telegram-desktop-1.9.8-1.fc31.x86_64
  • ibus-1.5.21-7.fc31.x86_64
  • glib2-2.62.4-1.fc31.x86_64

I have an identical issue on Gentoo: ibus will work with everything else that I've tested, just not telegram-desktop. Setting the QT_IM_MODULE=ibus environment variable doesn't change anything, either.

  • net-im/telegram-desktop-1.9.10
  • app-i18n/ibus-1.5.21
  • app-i18n/ibus-m17n-1.3.4
  • dev-libs/glib-2.60.7-r1

Setting the QT_IM_MODULE=ibus environment variable doesn't change anything, either.

If you use tdesktop from mva overlay, then, this is a packaging issue, most likely.

This isn't from any overlay, it's from the main portage source.

Any progress on this? It's really painful to have to type somewhere else to copy-and-paste into tgdesktop. Is there anything we can produce to help solving the issue (except the actual coding)?

My case is detailed in #7421.

I'm installing with Tarball.

Please, when writing "I'm experiencing this issue too", don't forget to tell your installation method.

I'm installing with Tarball.

There is no notification when you edit your post :(

Is there anything we can produce to help solving the issue (except the actual coding)?

Yes, you can. You can try to install tdesktop in multiple ways and check where issue is present and where is not:

  • Static binary (you already did this)
  • Snap
  • Flatpak
  • Package from your distribution (there are latest version with debian backports, but you will get frankendebian if you're using ubuntu)

There is no package for Fedora. I'd try Flatpak here.

I asked my friends using Ubuntu 20.04 Beta. Their snap package failed but the .deb worked.

There is no package for Fedora. I'd try Flatp

That's wrong, it is in RPMFusion repo.

That's wrong, it is in RPMFusion repo.

I forgot about it. Yes. I tried the RPM too. It also didn't work.

It also didn't work.

Did you set QT_IM_MODULE=ibus? Qt apps won't use ibus without this variable.

cc @xvitaly

Did you set QT_IM_MODULE=ibus? Qt apps won't use ibus without this variable.

I tried this on both the binary Tarball package and the RPMFusion repo package. I started the telegram-desktop like this:

QT_IM_MODULE=ibus /full-path-to/telegram-desktop

Both failed.

I'd try Flatpak here.

What about flatpak?

What about flatpak?

Strangely, the Flatpak package works.

QT_IM_MODULE=ibus QT_LOGGING_RULES="qt.qpa.input.methods.debug=true" ./Telegram
And look for output

For me it's qt.qpa.input.methods: socketWatcher.addPath "/home/ilya/.config/ibus/bus/cc38dc7e35924fb99c8bd9aa6fdf47bc-unix-0" and ibus works (static binary)

$ QT_IM_MODULE=ibus QT_LOGGING_RULES="qt.qpa.input.methods.debug=true" /usr/bin/telegram-desktop

QSocketNotifier: Can only be used with threads started with QThread
qt.qpa.input.methods: socketWatcher.addPath "/home/user/.config/ibus/bus/<some-hash>-unix-0"
error: : cannot open
error: : cannot open
error: : cannot open

$ ls ~/.config/ibus/bus/
<some-hash>-unix-0  <some-hash>-unix-wayland-0

Are there multiple sockets in /home/user/.config/ibus/bus?

$ ls ~/.config/ibus/bus/
<some-hash>-unix-0  <some-hash>-unix-wayland-0

I.e. you on wayland? What if you try on X11?

I'm using Wayland. I don't know how to start X11 session for my system anymore.

Logout and choose X11 session in GDM

Started an X.org session:

qt.qpa.input.methods: socketWatcher.addPath "/home/user/.config/ibus/bus/<some-hash>-unix-0"
error: : cannot open
error: : cannot open
error: : cannot open
qt.qpa.input.methods: filterEventFinished return 58 109 0 true
qt.qpa.input.methods: filterEventFinished return 58 109 0 false
qt.qpa.input.methods: filterEventFinished return 45 107 0 true
qt.qpa.input.methods: filterEventFinished return 45 107 0 false
qt.qpa.input.methods: filterEventFinished return 65 32 0 true
qt.qpa.input.methods: filterEventFinished return 65 32 0 false
qt.qpa.input.methods: filterEventFinished return 22 65288 0 false
qt.qpa.input.methods: filterEventFinished return 22 65288 0 false
qt.qpa.input.methods: filterEventFinished return 64 65513 0 false
qt.qpa.input.methods: filterEventFinished return 23 65289 0 false
qt.qpa.input.methods: filterEventFinished return 64 65513 0 false

iBus works there.

Again:

$ ls ~/.config/ibus/bus/
<some-hash>-unix-0  <some-hash>-unix-wayland-0

Does any other Qt app work with IBus on Wayland?

I don't currently have other Qt app on my desktop. What do you suggest me to try with?

vlc, qbittorrent

According to https://bugreports.qt.io/browse/QTBUG-82910, qt ibus plugin is broken on wayland

I tried to type on the "Open Media" dialog in VLC, it worked with iBus on Wayland:
2020-04-15 21-11-22 ηš„θž’εΉ•ζ“·εœ–

Could you start vlc with QT_LOGGING_RULES="qt.qpa.input.methods.debug=true"?

Apparently I installed the Flatpak version of VLC. Removed and installed the RPMFusion VLC instead and it failed.

$ QT_IM_MODULE=ibus QT_LOGGING_RULES="qt.qpa.input.methods.debug=true" /usr/bin/vlc
VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
[000055f76067d5c0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
qt.qpa.input.methods: socketWatcher.addPath "/home/user/.config/ibus/bus/<some-hash>-unix-0"
[000055f76070bc20] main playlist: playlist is empty

2020-04-15 21-18-22 ηš„θž’εΉ•ζ“·εœ–

Ok. Then ibus is broken in Qt for now and there are no solution for telegram.
But there are a workaround that can force Qt to use the connection method from flatpak: IBUS_USE_PORTAL=1

https://bugreports.qt.io/browse/QTBUG-82910

Anyone who want ibus on wayland, can track this Qt bug report

Adding IBUS_USE_PORTAL=1 to the command and it works.

I modified the .desktop file to prepend env IBUS_USE_PORTAL=1 to the Exec variable and everything works like a charm. Perhaps that's all it need to do: prepend Exec of .desktop file of the distributed packages (e.g. .rpm).

You can add IBUS_USE_PORTAL=1 to ~/.pam_environment and this variable will be from start of your session, making all Qt apps use portal for ibus

You can add IBUS_USE_PORTAL=1 to ~/.pam_environment and this variable will be from start of your session, making all Qt apps use portal for ibus.

Just tried. It didn't work. If it works, it would have been a more elegant solution.

Just tried. It didn't work.

You need to restart your session. Also, keep in mind, that this is not a shell script and export produces a syntax error when it is parsed by pam

I even reboot my whole system. It doesn't work. Some said its disabled in Fedora. According to this discussion, ~/.profile is only read in X11 session. I'd guess the same might apply to ~/.pam_environment.

Will take my chance on ~/.config/environment.d/*.conf.

Then you can add to /etc/environment

Will take my chance on ~/.config/environment.d/*.conf.

I hope that will work

Yay! It works! But it took me a reboot.
I don't know why a simple logout-login doesn't work.

can i close this then?

can i close this then?

Probably :thinking:

IBUS_USE_PORTAL workaround should work with snap package as well since 2.1. However, installation with devmode confinement is required since snapd doesn't have rules to access to IBus portal.

Confirmed that it happens with snap version of Telegram on Ubuntu 20.04.
I also have another messenger "riot-web" installed but it works OK with ibus. Both are installed on strict confinement.

riot-web is Electron applicatiton whille Telegram is Qt application. Comparsion with, for example, VLC from snap or some KDE app from snap is more valid.

riot-web is Electron applicatiton whille Telegram is Qt application.

sorry didn't know that. Hope the ibus-qt issue will be fixed soon.

Hope the ibus-qt issue will be fixed soon.

I don't think so. It isn't known what is the problem with ibus and qt in snap.

Finally I found the root of the problem in snap: https://github.com/qt/qtbase/blob/08d6cb7673aa51bc0532d71db4134f4912e14769/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp#L629-L633

If Qt can't find the ibus-daemon binary (what's right for snap, since only Qt input plugin is bundled), it just disables the ibus support

Everyone who affected by this issue, please, test version 2.1.11-1-ge009ac026 on the edge channel

snap refresh --edge telegram-desktop

Anyone? :thinking:

Anyone? thinking

OS: Ubuntu 20.10 (developement)
snapd version: 2.45.1
Telegram version: 2.1.11-1-ge009ac026

Works OK between switch to Bangla and English language. Input method is IBus. Bangla support is installed with "ibus-avro" package from the universe repository. Thanks a lot!

Glad to hear :pray:

confirmed this is working for ibus + chewing
Ubuntu 20.04 Desktop
telegram-desktop 2.1.11-6-g99704e973 1683 latest/edge

The fix in the stable channel
If anyone still have this issue with 2.1.12, it is a time to say

The fix in the stable channel
If anyone still have this issue with 2.1.12, it is a time to say

You are the best!!!!

I even reboot my whole system. It doesn't work. Some said its disabled in Fedora. According to this discussion, ~/.profile is only read in X11 session. I'd guess the same might apply to ~/.pam_environment.

Will take my chance on ~/.config/environment.d/*.conf.

I just tried it, add "IBUS_USE_PORTAL=1"to .pam_environment, but it works. So maybe we don't need someting like ~/environmet.d/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matteotumiati picture matteotumiati  Β·  3Comments

TotalKrill picture TotalKrill  Β·  3Comments

hosseinab picture hosseinab  Β·  3Comments

luisalvarado picture luisalvarado  Β·  3Comments

qwitriy picture qwitriy  Β·  3Comments