From 5e12c1d953975ef48c09d0907f26578567d426bd Mon Sep 17 00:00:00 2001 From: moons Date: Sun, 2 Aug 2026 21:35:35 +0900 Subject: [PATCH] fxitx5 --- modules/applications/fcitx5/config | 69 -------------- modules/applications/fcitx5/home.nix | 44 --------- modules/applications/fcitx5/nixos.nix | 131 +++++++++++++++----------- 3 files changed, 74 insertions(+), 170 deletions(-) delete mode 100644 modules/applications/fcitx5/config delete mode 100644 modules/applications/fcitx5/home.nix diff --git a/modules/applications/fcitx5/config b/modules/applications/fcitx5/config deleted file mode 100644 index a11fae8..0000000 --- a/modules/applications/fcitx5/config +++ /dev/null @@ -1,69 +0,0 @@ -[Hotkey] -# トリガーキーを押すたびに切り替える -EnumerateWithTriggerKeys=False -# 一時的に第1入力メソッドに切り替える -AltTriggerKeys= -# 切り替え時は第1入力メソッドをスキップする -EnumerateSkipFirst=False -# Time limit in milliseconds for triggering modifier key shortcuts -ModifierOnlyKeyTimeout=250 - -[Hotkey/TriggerKeys] -1=Zenkaku_Hankaku - -[Hotkey/ActivateKeys] -0=Henkan - -[Hotkey/DeactivateKeys] -0=Muhenkan - -[Hotkey/PrevPage] -0=Up - -[Hotkey/NextPage] -0=Down - -[Hotkey/PrevCandidate] -0=Shift+Tab - -[Hotkey/NextCandidate] -0=Tab - -[Hotkey/TogglePreedit] -0=Control+Alt+P - -[Behavior] -# デフォルトで有効にする -ActiveByDefault=False -# フォーカス時に状態をリセット -resetStateWhenFocusIn=No -# 入力状態を共有する -ShareInputState=No -# アプリケーションにプリエディットを表示する -PreeditEnabledByDefault=True -# 入力メソッドを切り替える際に入力メソッドの情報を表示する -ShowInputMethodInformation=True -# フォーカスを変更する際に入力メソッドの情報を表示する -showInputMethodInformationWhenFocusIn=False -# 入力メソッドの情報をコンパクトに表示する -CompactInputMethodInformation=True -# 第1入力メソッドの情報を表示する -ShowFirstInputMethodInformation=True -# デフォルトのページサイズ -DefaultPageSize=5 -# XKB オプションより優先する -OverrideXkbOption=False -# カスタム XKB オプション -CustomXkbOption= -# Force Enabled Addons -EnabledAddons= -# Force Disabled Addons -DisabledAddons= -# Preload input method to be used by default -PreloadInputMethod=True -# パスワード欄に入力メソッドを許可する -AllowInputMethodForPassword=False -# パスワード入力時にプリエディットテキストを表示する -ShowPreeditForPassword=False -# ユーザーデータを保存する間隔(分) -AutoSavePeriod=30 diff --git a/modules/applications/fcitx5/home.nix b/modules/applications/fcitx5/home.nix deleted file mode 100644 index 21771ae..0000000 --- a/modules/applications/fcitx5/home.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ - config, - lib, - osConfig, - ... -}: -let - mkSessionService = target: { - Unit = { - Description = "Fcitx 5 input method"; - Documentation = [ "https://fcitx-im.org/" ]; - PartOf = [ target ]; - After = [ target ]; - }; - - Service = { - ExecStart = "${osConfig.i18n.inputMethod.package}/bin/fcitx5 --replace"; - Restart = "on-failure"; - }; - - Install.WantedBy = [ target ]; - }; -in -{ - home.file.".config/fcitx5/config" = { - recursive = true; - source = ./config; - }; - - # niri starts XDG autostart entries through systemd. The explicit service - # below is shared with labwc, so suppress the package-provided entry. - xdg.configFile."autostart/org.fcitx.Fcitx5.desktop".text = '' - [Desktop Entry] - Hidden=true - ''; - - systemd.user.services = - lib.optionalAttrs config.my.applications.niri.enable { - fcitx5-niri = mkSessionService "niri.service"; - } - // lib.optionalAttrs config.my.applications.labwc.enable { - fcitx5-labwc = mkSessionService "labwc-session.target"; - }; -} diff --git a/modules/applications/fcitx5/nixos.nix b/modules/applications/fcitx5/nixos.nix index a004d6c..2f05d01 100644 --- a/modules/applications/fcitx5/nixos.nix +++ b/modules/applications/fcitx5/nixos.nix @@ -1,43 +1,4 @@ { pkgs, ... }: -let - # CC-BY-SA 3.0: https://github.com/jiro-aqua/aquamozc-dictionary - kanaengDictionary = - pkgs.runCommandNoCC "mozcdic-ut-kanaeng" - { - nativeBuildInputs = with pkgs; [ - gawk - gnutar - bzip2 - ]; - } - '' - mkdir -p "$out" - - awk -F '\t' 'NF == 3 { print $1 "\t0000\t0000\t8000\t" $2; }' \ - ${ - pkgs.fetchurl { - url = "https://raw.githubusercontent.com/jiro-aqua/aquamozc-dictionary/ae7fae40b18f1500d97e3e4531fdff22abdc6a39/edict-katakana-english/kanaeng.mozc.txt"; - hash = "sha256-rw8AlE2YAc3d4B6qQ6+LYchDiGwm6TesIfOozzZBGXo="; - } - } > mozcdic-ut-kanaeng.txt - - tar -cjf "$out/mozcdic-ut-kanaeng.txt.tar.bz2" mozcdic-ut-kanaeng.txt - ''; - - mozcWithKanaeng = pkgs.mozc.override { - dictionaries = with pkgs; [ - mozcdic-ut-alt-cannadic - mozcdic-ut-edict2 - mozcdic-ut-jawiki - mozcdic-ut-neologd - mozcdic-ut-personal-names - mozcdic-ut-place-names - mozcdic-ut-skk-jisyo - mozcdic-ut-sudachidict - kanaengDictionary - ]; - }; -in { services.hazkey.enable = true; @@ -48,30 +9,86 @@ in fcitx5 = { waylandFrontend = true; addons = with pkgs; [ - (fcitx5-mozc.override { mozc = mozcWithKanaeng; }) fcitx5-gtk kdePackages.fcitx5-qt qt6Packages.fcitx5-configtool ]; - settings.inputMethod = { - GroupOrder."0" = "Default"; - "Groups/0" = { - Name = "Default"; - "Default Layout" = "jp"; - DefaultIM = "mozc"; + settings = { + inputMethod = { + GroupOrder."0" = "Default"; + "Groups/0" = { + Name = "Default"; + "Default Layout" = "jp"; + DefaultIM = "hazkey"; + }; + "Groups/0/Items/0" = { + Name = "keyboard-jp"; + }; + "Groups/0/Items/1" = { + Name = "hazkey"; + }; }; - "Groups/0/Items/0" = { - Name = "keyboard-jp"; - Layout = ""; - }; - "Groups/0/Items/1" = { - Name = "mozc"; - Layout = ""; - }; - "Groups/0/Items/2" = { - Name = "hazkey"; - Layout = ""; + + globalOptions = { + Hotkey = { + EnumerateWithTriggerKeys = false; + AltTriggerKeys = ""; + EnumerateSkipFirst = false; + ModifierOnlyKeyTimeout = 250; + }; + + "Hotkey/TriggerKeys" = { + "1" = "Zenkaku_Hankaku"; + }; + + "Hotkey/ActivateKeys" = { + "0" = "Henkan"; + }; + + "Hotkey/DeactivateKeys" = { + "0" = "Muhenkan"; + }; + + "Hotkey/PrevPage" = { + "0" = "Up"; + }; + + "Hotkey/NextPage" = { + "0" = "Down"; + }; + + "Hotkey/PrevCandidate" = { + "0" = "Shift+Tab"; + }; + + "Hotkey/NextCandidate" = { + "0" = "Tab"; + }; + + "Hotkey/TogglePreedit" = { + "0" = "Control+Alt+P"; + }; + + Behavior = { + ActiveByDefault = false; + resetStateWhenFocusIn = "No"; + ShareInputState = "No"; + PreeditEnabledByDefault = true; + ShowInputMethodInformation = true; + showInputMethodInformationWhenFocusIn = false; + CompactInputMethodInformation = true; + ShowFirstInputMethodInformation = true; + DefaultPageSize = 5; + OverrideXkbOption = false; + CustomXkbOption = ""; + EnabledAddons = ""; + DisabledAddons = ""; + PreloadInputMethod = true; + AllowInputMethodForPassword = false; + ShowPreeditForPassword = false; + AutoSavePeriod = 30; + }; }; }; };