Open sei40kr opened 3 years ago
Did you re-log in after enabling fcitx? It sets some environment variables and GNOME Shell will not see them until restarted, whereas terminal will source profile
on startup, getting the latest enviromnent.
Also is this Wayland or X11 GNOME?
As talking above, I think the problem is that when gnome starts, fcitx5 isn't started or the environment variable isn't passed, therefore applications don't handle special action for input method.
You can open a pure terminal in gnome to have environment run in gnome, for example, not loading any profiles and initial scripts like .bash_profile, .bashrc and /etc/profile. Then run fcitx5-diagnose. Note, runing bash --noprofile with a opened temrminal is useless, because the environment variable in profiles are inherited.
By the way, I use xmonad without any desktop managers, and fcitx5 is worked fine. So does my friend who uses KDE.
Seong Yong-ju @.***> writes:
Describe the bug Fcitx 5 don't work in browser apps run by the GNOME application launcher.
To Reproduce Enable GNOME 4 & Fcitx 5.
{ services.xserver = { displayManager.gdm.enable = true; desktopManager.gnome.enable = true; }; i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ fcitx5-mozc ]; }; }
- Configure Fcitx with Mozc
- Make sure no browser processes (ex. google-chrome, firefox) are not running
- Open a browser app via the GNOME application launcher
- Can't enable Mozc in the browser session (can't switch input method, can't make Mozc working even if we switch the input method by
fcitx5-remote
)- Kill the browser sessions
- Open a browser app via command line in a terminal
- This time we can make Mozc working
Expected behavior Fcitx 5 & Mozc is working in a browser session run by the GNOME application launcher.
Notify maintainers @poscat0x04 @Vonfry
Metadata
- system: `"x86_64-linux"` - host os: `Linux 5.10.45, NixOS, 21.11.20210626.f84d5fb (Porcupine)` - multi-user?: `yes` - sandbox: `yes` - version: `nix-env (Nix) 3.0pre20200829_f156513` - channels(root): `""` - channels(sei40kr): `"nixpkgs-21.05.1205.b72bde7c4a1"` - nixpkgs: `/home/sei40kr/.nix-defexpr/channels/nixpkgs`
Thank you for your quick responses.
@jtojnar
Did you re-log in after enabling fcitx?
Yes, I tried.
@jansol
Also is this Wayland or X11 GNOME?
Wayland
@Vonfry
I tried to press Alt+F2 and open sh
, and run env | less
there.
env | less
And then I noticed none of GTK_IM_MODULE
, QT_IM_MODULE
was set.
Wayland session doesn't read /etc/profile
, so we may need those environment variables in /etc/environment
.
Thank you.
I put this in my configuration:
{
# Wayland sesion doesn't read environment.variables
environment.sessionVariables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
}
and confirmed those variables in set in GNOME session. (same way as above) But it's still not working. There probably exists another cause.
It's also not working for me in Plasma5 / Wayland, even if I set those env variables.
Exporting NIX_USER_PROFILE_DIR
and NIX_PROFILES
worked for me:
sh-4.4$ export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
sh-4.4$ export NIX_PROFILES="/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/$USER $HOME/.nix-profile"
sh-4.4$ google-chrome-stable
I think those variables have nothing to do with Fcitx 5, but somehow, it works :thinking:
environment.sessionVariables = {
NIX_PROFILES =
"${concatStringsSep " " (reverseList config.environment.profiles)}";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
This works great for me!
environment.sessionVariables
to export GTK_IM_MODULE
, QT_IM_MODULE
, XMODIFIERS
because Wayland session doesn't read set-environment
NIX_PROFILES
, NIX_USER_PROFILE_DIRS
, and other Nix basic variables in pam-environment
Please check https://github.com/fcitx/fcitx5/issues/292#issuecomment-864396920.
Wayland support is in progress and you may need xwayland now.
On 2021年7月8日 at 06:19:20, Seong Yong-ju @.**@.)) wrote:
environment.sessionVariables = { NIX_PROFILES = "${concatStringsSep " " (reverseList config.environment.profiles)}"; GTK_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx"; XMODIFIERS = @.***=fcitx"; };
This works great for me!
Use environment.sessionVariables to export GTK_IM_MODULE, QT_IM_MODULE, XMODIFIERS because Wayland session doesn't read set-environment Export NIX_PROFILES, NIX_USER_PROFILE_DIRS, and other Nix basic variables in pam-environment
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub(https://github.com/NixOS/nixpkgs/issues/129442#issuecomment-875972207), or unsubscribe(https://github.com/notifications/unsubscribe-auth/AA2BI77XIZ7YSRKDHP5LNDLTWTHGRANCNFSM474XCIKA).
Setting those variables to environment.sessionVariables
does indeed seem to work. The Fcitx5 module in NixOS already sets the *_IM_MODULE
variables... but it does that using environment.variables
, which should probably be changed. Does environment.sessionVariables
work in X11 environments? Not sure what the right place for setting NIX_PROFILES
would be but I'm pretty sure it's not in the Fcitx5 module.
I'd like to let wayland use set-environment rather than move them into sessionvariables because there are other variables besides ones for inputmethods. Is there a startup script for wayland like xprofile?
@Vonfry
Is there a startup script for wayland like xprofile?
Basically, no.
We have 2 ways to set environment for Wayland session:
pam-environment
& let display manager read it (we should consider some people use no display manager)extraSessionCommands
)I perfer to make a wrapper.
Currently, x11 is also worked with a wrapper. You can check xsessionWrapper in <nixpkgs/nixos/modules/services/x11/display-manager/default.nix>. Then desktop-manager is also worked with a wrapper in services.xserver.desktopManager.session.start (<nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix>).
Seong Yong-ju @.***> writes:
@Vonfry
Is there a startup script for wayland like xprofile?
Basically, no.
We have 2 ways to set environment for Wayland session:
- Write in
pam-environment
& let display manager read it- Make a wrapper for desktop manager (just like
extraSessionCommands
in Sway)
Sorry if this is entirely a different issue (it probably is), but I can't even figure out how to get fcitx5
to recognize fcitx5-mozc
.
Using fcitx5-configtool
doesn't even show mozc for me:
I do have the following, so I don't quite get how this could happen.
{
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-mozc ];
};
}
I'm on:
$ nixos-version
22.05pre352272.c5051e2b5fe (Quokka)
You should search mozc instead of japanese, because the name of mozc doesn't involve japanese. By the way, you may also uncheck "Only Show Current Language".
Sage Hane @.***> writes:
Sorry if this is entirely a different issue (it probably is), but I can't even figure out how to get fcitx5 to recognize fcitx5-mozc. Using fcitx5-configtools doesn't even show mozc for me:
image
I do have the following, so I don't quite get how this could happen.
{ i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ fcitx5-mozc ]; }; }
I'm on:
$ nixos-version 22.05pre352272.c5051e2b5fe (Quokka)
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.
I've tried that too. The issue seems to be that the wrong Addon Config Dir was being read, so I opened an issue at https://github.com/NixOS/nixpkgs/issues/160437.
I do find it weird that nobody else other than me seems to have encountered it. I wonder if I'm doing something wrong.
@sagehane
If you can't find Mozc by searching mozc
, then restart Fcitx5 daemon by running
fcitx5 -r
and try again.
If this won't fix your issue, it's entirely a different issue.
Yep, I've tried plenty of stuff, including manually doing fcitx-remote -s
, it's a different issue from my understanding. Sorry to bother.
environment.sessionVariables = { NIX_PROFILES = "${concatStringsSep " " (reverseList config.environment.profiles)}"; GTK_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx"; XMODIFIERS = "@im=fcitx"; };
This works great for me!
1. Use `environment.sessionVariables` to export `GTK_IM_MODULE`, `QT_IM_MODULE`, `XMODIFIERS` because Wayland session doesn't read `set-environment` 2. Export `NIX_PROFILES`, `NIX_USER_PROFILE_DIRS`, and other Nix basic variables in `pam-environment`
I just hit this problem myself after switching to Wayland on KDE Plasma. Thanks for this snippet! Until a proper solution for Wayland is developed, I will be using this configuration workaround.
environment.sessionVariables = { NIX_PROFILES = "${concatStringsSep " " (reverseList config.environment.profiles)}"; GTK_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx"; XMODIFIERS = "@im=fcitx"; };
This works great for me!
- Use
environment.sessionVariables
to exportGTK_IM_MODULE
,QT_IM_MODULE
,XMODIFIERS
because Wayland session doesn't readset-environment
- Export
NIX_PROFILES
,NIX_USER_PROFILE_DIRS
, and other Nix basic variables inpam-environment
Saved my day! Thanks!
FWIW with the plasma6 module you don't need to set any environment variables for Fcitx5 to work. In fact it will yell at you if you do.
HOWEVER if you are switching over from an older version or from X11 you should make sure to delete all KDE and Fcitx-related files and subdirectories from your ~/.config
as those probably still try to launch the X11 version of Fcitx5
And you'll also need to enable the Fcitx 5
virtual keyboard in Plasma settings under Keyboard > Virtual Keyboard (technically you should enable Fcitx 5 Wayland Launcher
but it seems to revert to Fcitx 5
afterwards and still work fine:
Describe the bug Fcitx 5 doesn't work on Wayland.
To Reproduce Enable GNOME 4 & Fcitx 5.
fcitx5-remote
)Expected behavior Fcitx 5 & Mozc is working in a browser session run by the GNOME application launcher.
Notify maintainers @poscat0x04 @Vonfry
Metadata