ime: wrapper helper for fcitx module

This commit is contained in:
js0ny 2025-11-18 08:19:15 +00:00
parent 20a2dc258f
commit 5c189f5c0f
7 changed files with 147 additions and 104 deletions

View file

@ -55,5 +55,7 @@
srm
mediainfo
exiftool
ddgr # DuckDuckGo CLI
jujutsu
];
}

View file

@ -1,66 +1,88 @@
{pkgs, ...}: {
home.packages = with pkgs; [
# Terminal Emulator
ghostty # default
kitty
alacritty
warp-terminal
{
pkgs,
lib,
...
}: let
mkFcitxIM = builtins.map (
p:
lib.hiPrio (
pkgs.runCommand "${p.name}-wrapped" {nativeBuildInputs = with pkgs; [makeWrapper];} ''
mkdir -p $out/bin
makeWrapper \
${p}/bin/${p.meta.mainProgram or p.pname} \
$out/bin/${p.meta.mainProgram or p.pname} \
--set GTK_IM_MODULE fcitx \
--set QT_IM_MODULE fcitx
''
)
);
in {
home.packages = with pkgs;
[
# Terminal Emulator
ghostty # default
kitty
alacritty
warp-terminal
# PDF Viewer
kdePackages.okular # default
sioyek
# PDF Viewer
kdePackages.okular # default
sioyek
# Image Viewer
loupe # SUPER FAST 有催人跑的感觉 w/ GPU Accel.
# Image Viewer
loupe # SUPER FAST 有催人跑的感觉 w/ GPU Accel.
kdePackages.elisa
mpv
haruna
kdePackages.elisa
mpv
haruna
# Email
protonmail-bridge
thunderbird
birdtray
# Email
protonmail-bridge
thunderbird
birdtray
# Theming
papirus-icon-theme
rose-pine-cursor
# Theming
papirus-icon-theme
rose-pine-cursor
pcloud
materialgram
steam
signal-desktop
# Use Wayland for Jetbrains
(jetbrains.idea-ultimate.override {
vmopts = ''-Dawt.toolkit.name=WLToolkit'';
})
(jetbrains.rider.override {
vmopts = ''-Dawt.toolkit.name=WLToolkit'';
})
localsend
cherry-studio
kdePackages.kdeconnect-kde
picard
qutebrowser
ryubing
qbittorrent
protonvpn-gui
proton-pass
neovim-qt
goldendict-ng
kdePackages.kdenlive
gimp
steam-run
bottles
lutris
vivaldi
rustdesk
kdePackages.krdc
kdePackages.breeze
zotero
anki-bin
feishin
];
pcloud
materialgram
steam
signal-desktop
# Use Wayland for Jetbrains
(jetbrains.idea-ultimate.override {
vmopts = ''-Dawt.toolkit.name=WLToolkit'';
})
(jetbrains.rider.override {
vmopts = ''-Dawt.toolkit.name=WLToolkit'';
})
localsend
cherry-studio
kdePackages.kdeconnect-kde
picard
qutebrowser
ryubing
qbittorrent
protonvpn-gui
proton-pass
goldendict-ng
kdePackages.kdenlive
gimp
steam-run
bottles
lutris
vivaldi
rustdesk
kdePackages.krdc
kdePackages.breeze
zotero
anki-bin
feishin
]
++ (mkFcitxIM [
pkgs.neovim-qt
pkgs.anki
]);
home.sessionVariables = {
ANKI_WAYLAND = 1;
@ -68,37 +90,6 @@
NIXOS_OZONE_WL = 1;
};
xdg.desktopEntries = {
"anki" = {
name = "Anki";
genericName = "Flashcards";
comment = "An intelligent spaced-repetition memory training program";
icon = "anki";
type = "Application";
terminal = false;
categories = [
"Education"
"Languages"
"KDE"
"Qt"
];
mimeType = [
"application/x-apkg"
"application/x-anki"
"application/x-ankiaddon"
];
# Should specify wayland and IME used
exec = "env ANKI_WAYLAND=1 QT_IM_MODULE=fcitx anki %f";
settings = {
"TryExec" = "anki";
"Version" = "1.0";
"X-GNOME-SingleWindow" = "true";
"SingleMainWindow" = "true";
"StartupWMClass" = "anki";
};
};
};
# TODO: This is a dependency of `feishin` (EOL)
# Once the new version is published, delete this
nixpkgs.config.permittedInsecurePackages = [

View file

@ -105,17 +105,46 @@ in {
source = rimeConfigFiltered;
recursive = true;
};
home.file."${rimePath}/default.custom.yaml" = {
text = ''
patch:
schema_list:
- schema: wanxiang_pro
- schema: latex
- schema: jyut6ping3
- schema: dioion
- schema: gekion
# yaml 最后留出一行
home.file = {
"${rimePath}/default.custom.yaml" = {
text = ''
patch:
# 方案列表
schema_list:
- schema: wanxiang_pro
- schema: latex
- schema: jyut6ping3
- schema: dioion
- schema: gekion
# 切换中英:
# 不同的选项表示:打字打到一半时按下了 CapsLock、Shift、Control 后:
# commit_code 上屏原始的编码,然后切换到英文
# commit_text 上屏拼出的词句,然后切换到英文
# clear 清除未上屏内容,然后切换到英文
# inline_ascii 切换到临时英文模式,按回车上屏后回到中文状态
# noop 屏蔽快捷键,不切换中英,但不要屏蔽 CapsLock
ascii_composer/switch_key:
Shift_L: noop
Shift_R: commit_code
key_binder/bindings:
# emacs editing:
- { when: composing, accept: Control+p, send: Up }
- { when: composing, accept: Control+n, send: Down }
- { when: composing, accept: Control+b, send: Left }
- { when: composing, accept: Control+f, send: Right }
'';
enable = true;
'';
enable = true;
};
"${rimePath}/wanxiang_pro.custom.yaml" = {
text = ''
patch:
key_binder/sequence:
pin: "Alt+p" # 使用 Alt-p 而不是 Ctrl-p 置顶候选项(见 ./default.custom.yaml 中 emacs editing
'';
enable = true;
};
};
}