feat: update for fcitx5

This commit is contained in:
ryan4yin
2023-05-21 12:46:52 +08:00
parent 58d4005e4f
commit 08ffdb556e
6 changed files with 29 additions and 59 deletions

View File

@@ -11,8 +11,6 @@ This repository is home to the nix code that builds my systems.
- enable disk encryption to enhance data security
- make fcitx5-rime work in vscode/chrome on wayland
- adjust the structure of this repo, make it more flexible, and can easily switch between i3, sway and hyprland.
- migrate my private tools & wireguard configurations into nixos, make it a private flake(private github repo), and used it as flake inputs in this repo.
## Why Nix?

View File

@@ -1,4 +1,12 @@
{pkgs, config, ... }: {
{pkgs, config, lib, ... }: {
home.file.".config/fcitx5/profile".source = ./profile;
home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup
# fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖
# 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
rm -f "${config.xdg.configHome}/fcitx5/profile"
'';
i18n.inputMethod = {
enabled = "fcitx5";
@@ -12,4 +20,15 @@
fcitx5-gtk # gtk im module
];
};
systemd.user.sessionVariables = {
# copy from https://github.com/nix-community/home-manager/blob/master/modules/i18n/input-method/fcitx5.nix
GLFW_IM_MODULE = "fcitx";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
INPUT_METHOD = "fcitx";
IMSETTINGS_MODULE = "fcitx";
};
}

View File

@@ -16,25 +16,10 @@
};
home.file.".gtkrc-2.0".source = ./gtkrc-2.0;
home.file.".config/hypr/wallpapers/wallpaper.png".source = ../wallpapers/wallpaper.png;
home.file.".config/fcitx5/profile".source = ./profile;
home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup
# fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖
# 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
rm -f "${config.xdg.configHome}/fcitx5/profile"
'';
# allow fontconfig to discover fonts and configurations installed through home.packages
fonts.fontconfig.enable = true;
# set cursor size and dpi for 4k monitor
# this is for xwayland
xresources.properties = {
"Xcursor.size" = 16;
"Xft.dpi" = 160;
};
systemd.user.sessionVariables = {
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
@@ -47,14 +32,14 @@
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
"WLR_NO_HARDWARE_CURSORS" = "1";
"WLR_EGL_NO_MODIFIRES" = "1";
# copy from https://github.com/nix-community/home-manager/blob/master/modules/i18n/input-method/fcitx5.nix
GLFW_IM_MODULE = "fcitx";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
INPUT_METHOD = "fcitx";
IMSETTINGS_MODULE = "fcitx";
};
# set cursor size and dpi for 4k monitor
# this is for xwayland
xresources.properties = {
"Xcursor.size" = 16;
"Xft.dpi" = 160;
};
}

View File

@@ -19,13 +19,6 @@
executable = true; # make all scripts executable
};
home.file.".config/fcitx5/profile".source = ./profile;
# fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖
# 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
rm -f "${config.xdg.configHome}/fcitx5/profile"
'';
# allow fontconfig to discover fonts and configurations installed through home.packages
fonts.fontconfig.enable = true;
@@ -33,14 +26,6 @@
"LIBVA_DRIVER_NAME" = "nvidia";
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
# copy from https://github.com/nix-community/home-manager/blob/master/modules/i18n/input-method/fcitx5.nix
GLFW_IM_MODULE = "fcitx";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
INPUT_METHOD = "fcitx";
IMSETTINGS_MODULE = "fcitx";
};
# set cursor size and dpi for 4k monitor
@@ -48,5 +33,5 @@
"Xcursor.size" = 16;
"Xft.dpi" = 160;
};
}

View File

@@ -1,17 +0,0 @@
[Groups/0]
# Group Name
Name=Other
# Layout
Default Layout=us
# Default Input Method
DefaultIM=rime
[Groups/0/Items/0]
# Name
Name=rime
# Layout
Layout=
[GroupOrder]
0=Other