Some pop-ups in GTK4 applications fail to appear with fcitx5
Hello! I've noticed that certain buttons that should spawn a pop-up in GTK applications simply don't do anything. I've noticed two cases of this occurring:
- The "Open" button in the top left corner of some GTK4 applications like Gnome Text Editor and Apostrophe, which should spawn a pop-up containing a list of the recent documents, doesn't do anything and no pop-up appears
- The "Rename" button in Nautilus' context menu also doesn't spawn the pop-up to rename stuff, although occasionally it can be briefly seen for one single frame
System Information
-
niri version: niri 0.1.6 (unknown commit)
-
Distro: Arch Linux
-
GPU: AMD Radeon Vega 8
-
CPU: Ryzen 5700U
I use plenty of GTK 4 apps and haven't seen this issue yet. So don't know.
And those two specific cases work properly for you? I might try this on another computer to see if it only happens on one device
Edit: checked on my other computer but Niri just shows a black screen there (nvidia_drm.modeset is correctly set to 1) so I can't really confirm
Yeah, they work fine.
confirmed, they work for me as well
Closing because I don't think this is a niri issue; feel free to reopen.
Now that Niri kinda works on Nvidia (1060 with 555 drivers in my case), I tested it on my other computer too and it has the same issue
The issue is not present on Hyprland and Sway
Really very strange. Is there anything interesting in the output of either niri (journalctl -eb --user-unit niri) or the program that fails to show the pop-up? Could you try if it reproduces on cosmic-comp?
When I get home in a few days I'll test and report back, thank you for the quick response!
Update:
There's no output in journalctl -eb --user-unit niri nor from the application (Nautilus, Apostrophe, etc) itself when the pop-up fails to appear (although, as mentioned, sometimes the Rename pop-up can be seen for a split second and then it disappears)
I've also installed cosmic-session and the pop-ups work properly there, both the Rename pop-up in Nautilus and the Open pop-up in Apostrophe
Thanks. Very strange
Hello. I have the exact same issue, so I feel there is a problem somewhere. Other users might also be facing the same issue, and they just have not realized it yet. Now, the good news is that I might have detected the cause. I had to do a lot of tinkering but at least on my machine the cause is fcitx5. It will be interesting to see if @cyber-sushi also uses fcitx5.
After some troubleshooting, I decided to use the default config generated by niri upon launch and surprise, surprise everything was working properly. Then, I reverted to my custom config and started commenting out lines in an attempt to see if something is causing the pop ups to stop appearing. I eventually narrowed it down to the spawn-at-startup section and then further to the fcitx5 command.
I am not sure if this is a problem with fcitx5 or niri but if someone else can verify my findings it might provide some more insight. I would really like to use niri, so I hope there is a workaround or fix.
To reproduce the issue in the simplest manner please do the following:
- Install fcitx5 (in my case I installed fcitx5, fcitx5-configtool and fcitx5-gtk)
- Launch a niri session with default config
- Launch one of the problematic applications (gnome text editor, apostrophe, nautilus etc)
- Verify the pop ups work as expected
- Start the fcitx5 daemon:
fcitx5 --replaceorfcitx5 --replace -d - Try to open one of the pop ups
Please note that if you kill fcitx5 (pkill fcitx5) the pop ups will start working again.
I will be happy to provide more information if required or help to further debug the issue so just let me know.
Thank you for your work on this great compositor!
Thanks for the investigation, interesting. And on other compositors with fcitx5 the popups work fine? What about cosmic-comp?
I can confirm that the issue only appears when fcitx5 is running, if I kill it the pop-ups work as expected.
On Cosmic (and Sway/Hyprland), everything seem to work properly regardless of fcitx5 running or not.
Unrelated to the issue, but I realized that both Niri and Cosmic seem to autostart fcitx5 even though it's not present in spawn-at-startup or XDG_CONFIG_HOME/autostart (Sway and Hyprland don't do this), is that intended?
I see. I'll have to look into this I guess.
Niri doesn't autostart fcitx5, must be something else causing it to start. Maybe you have it as a systemd service enabled and bound to graphical-session.target?
Okay found it, seems like fcitx5 automatically dropped its .desktop file in /etc/xdg/autostart/org.fcitx.Fcitx5.desktop, thanks
I can confirm that the issue only appears when fcitx5 is running, if I kill it the pop-ups work as expected.
Thank you for chiming in and confirming the issue with fcitx5. I am glad that we have managed to detect the cause of the problem.
And on other compositors with fcitx5 the popups work fine? What about cosmic-comp?
On Cosmic (and Sway/Hyprland), everything seem to work properly regardless of fcitx5 running or not.
I can also confirm that things work as expected both on Cosmic and Gnome Wayland.
I see. I'll have to look into this I guess.
I have a separate installation running the latest niri git via the nightly COPR you have provided in the latest release. If you need me to do any testing at any point feel free to reach out.
Thank you for taking the time to look into this issue.
Since I setup a Sway VM for #620 here are some screenshots showing the problematic pop-ups working fine under Sway:
Gnome Files (nautilus) rename dialog:
Apostrophe recent documents dialog:
BoxBuddy container image selector dialog:
You can see fcitx5 running on the side as well.
None of these work properly under niri.
Quick update on this issue. I am not sure if it helps in any way but this problem does not occur on NixOS. I have also tested niri on Fedora and Arch Linux where the issue does persist. I am wondering if it has anything to do with how fcitx is being distributed like build flags, install location etc.
Well, I am having this issue on NixOS - a reproducible flake of my setup can be found here: https://github.com/42willow/flake/tree/16a50b511fbaf6accf17137736e191506c1c567c
Yeah, this happens with nautilus and renaming files every time with me.
All you need is fcitx5 installed and set as default IM.
Yeah, this happens with nautilus and renaming files every time with me.
All you need is fcitx5 installed and set as default IM.
This solves the same issue for me as well. Specifically, add these two lines to /etc/environment:
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
However, the "Detect GTK_IM_MODULE being set and Wayland Input method frontend is working. It is recommended to unset GTK_IM_MODULE and use Wayland input method frontend instead. For more details see https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland" notification is just annoying.
Yeah, this happens with nautilus and renaming files every time with me. All you need is fcitx5 installed and set as default IM.
This solves the same issue for me as well. Specifically, add these two lines to
/etc/environment:GTK_IM_MODULE=fcitx QT_IM_MODULE=fcitxHowever, the
"Detect GTK_IM_MODULE being set and Wayland Input method frontend is working. It is recommended to unset GTK_IM_MODULE and use Wayland input method frontend instead. For more details see https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland"notification is just annoying.
For my issue with easyeffects, it is still happening even with the above workaround.
For context, I've installed fcitx via a home-manager module, which defines session variables. I also forced the above session variables - same behaviour.
Quick update on this issue. I am not sure if it helps in any way but this problem does not occur on NixOS. I have also tested niri on Fedora and Arch Linux where the issue does persist. I am wondering if it has anything to do with how fcitx is being distributed like build flags, install location etc.
Can you provide a configuration ? I'm running nixos (fcitx5 conf + niri conf ) as well and this problem actually appears for me
Thanks to this issue, I figured out this annoying problem of pop-up window not showing in dialect and apostrophe....now I have to deal with the annoying notification, thank you everyone:)
@GRFTSOL what exactly was the solution for you?
I had to change away from nautilus, as nothing I tried worked... but I'd like to change back.
@GRFTSOL what exactly was the solution for you?
I had to change away from nautilus, as nothing I tried worked... but I'd like to change back.
uncomment GTK_IM_MODULE=fcitx in niri's config, I disabled before since it pop up a notification to let me disable this
Thanks to this issue, I figured out this annoying problem of pop-up window not showing in
dialectandapostrophe....now I have to deal with the annoying notification, thank you everyone:)
The notification, should have a button "do not show" if your notify service support that. or you can manually add "wayland-diagnose-other" in "hide notification" in fcitx's notification option.
quickly looking through the code that reference popup and input method, https://github.com/YaLTeR/niri/blob/37458d94b288945f6cfbd3c5c233f634d59f246c/src/handlers/xdg_shell.rs#L292 This line doesn't look correct.
input method's keyboard grab ask compositor to forward key to input method first, it has nothing to do with the popup grab. Using input method in a popup window is a totally valid use case. input method grab and popup grab are two orthogonal things.
Another thing that might go wrong is input method popup doesn't have parent in relation ship, but it can be treated as the current text-input focus is the parent. While https://github.com/FlafyDev/smithay/blob/150a72d8b9e4af0bdb65210812108bf8bd216ed3/src/desktop/wayland/popup/manager.rs#L222C8-L222C31 doesn't seem to handle such use case, there could be some thing not fully correct in niri's logic.
Though I might be wrong on points above since they are purely judged reading through the code.
Thanks to this issue, I figured out this annoying problem of pop-up window not showing in
dialectandapostrophe....now I have to deal with the annoying notification, thank you everyone:)The notification, should have a button "do not show" if your notify service support that. or you can manually add "wayland-diagnose-other" in "hide notification" in fcitx's notification option.
quickly looking through the code that reference popup and input method,
niri/src/handlers/xdg_shell.rs
Line 292 in 37458d9 if self.niri.seat.input_method().keyboard_grabbed() { This line doesn't look correct.
input method's keyboard grab ask compositor to forward key to input method first, it has nothing to do with the popup grab. Using input method in a popup window is a totally valid use case. input method grab and popup grab are two orthogonal things.
Another thing that might go wrong is input method popup doesn't have parent in relation ship, but it can be treated as the current text-input focus is the parent. While https://github.com/FlafyDev/smithay/blob/150a72d8b9e4af0bdb65210812108bf8bd216ed3/src/desktop/wayland/popup/manager.rs#L222C8-L222C31 doesn't seem to handle such use case, there could be some thing not fully correct in niri's logic.
Though I might be wrong on points above since they are purely judged reading through the code.
Well I use mako for notification as niri's wiki recommended, seems like there is no clickable button under my config, but I finished by blocking in fcitx5-configtool.
If this is a bug caused by niri's logic, variable GTK_IM_MODULE=fcitx still should be commented?
@GRFTSOL as input method process, we can't predict or reliably know what compositor is being used. We only care about what wayland protocol is exposed from compositor. The im module under wayland is implemented as a temporarily workaround for compositor doesn't have proper input method support. The approach is intrusive to application (creating extra window within application process). I'd prefer it to be avoided if possible.
Input method(or any other wayland app) doesn't know the name of compositor or the version of compositor, so not practical for an app to guess if a compositor has some random bug and workaround it. Even if possible, it won't scale.
For my issue with easyeffects, it is still happening even with the above workaround.
Good news. Easyeffects version 8.0 switched to Qml so running it with fcitx5 no longer an issue. Though, I can confirm that the workaround of setting GTK_IM_MODULE=fcitx in the environment variable doesn't solve the issue for Easyeffect prior to version 8.0 where it still using GTK but solved the problem on other GTK Apps.