feat: make fcitx5 systemd service

This commit is contained in:
DACHXY 2025-04-10 12:23:31 +08:00
parent 7aea0a631b
commit 6fddac69d2
5 changed files with 51 additions and 27 deletions

View file

@ -3,30 +3,35 @@
BROWSER = "firefox-nightly";
EDITOR = "nvim";
TERMINAL = "ghostty";
ELECTRON_OZONE_PLATFORM_HINT = "auto";
GDK_BACKEND = "wayland";
COLORTERM = "truecolor";
NIXOS_OZONE_WL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
QT_SCALE_FACTOR = "1";
MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
QT_QPA_PLATFORM = "wayland-egl";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
GTK_CSD = "0";
QT_IM_MODULES = "wayland;fcitx;ibus";
MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
WLR_NO_HARDWARE_CURSORS = "1";
CLUTTER_BACKEND = "wayland";
EGL_PLATFORM = "wayland";
WLR_RENDERER = "vulkan";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
GTK_USE_PORTAL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_DATA_HOME = "\${HOME}/.local/share";
GTK_IM_MODULE = "";
XDG_DATA_DIRS = "\${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:\${HOME}/.local/share/flatpak/exports/share";
ELECTRON_OZONE_PLATFORM_HINT = "auto";
GDK_BACKEND = "wayland";
COLORTERM = "truecolor";
GTK_CSD = "0";
GTK_USE_PORTAL = "1";
GTK_IM_MODULE = "";
};
}

View file

@ -26,8 +26,6 @@ let
hyprpaper &
waybar -c ~/.config/waybar/config.jsonc -s ~/.config/waybar/style.css &
systemctl --user enable --now hypridle.service &
fcitx5 -rd &
fcitx5-remote -r &
hyprsunset -t 3000k
'';
in

View file

@ -316,14 +316,14 @@ in
formatting = {
command = { "nixfmt" },
},
options = {
nixos = {
expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.${settings.personal.hostname}.options',
},
home_manager = {
expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."${settings.personal.username}@${settings.personal.hostname}".options',
}
}
-- options = {
-- nixos = {
-- expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.${settings.personal.hostname}.options',
-- },
-- home_manager = {
-- expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."${settings.personal.username}@${settings.personal.hostname}".options',
-- }
-- }
}
}
}

View file

@ -4,5 +4,6 @@
environment.variables = {
ELECTRON_OZONE_PLATFORM_HINT = "auto";
GSETTINGS_SCHEMA_DIR = "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/glib-2.0/schemas";
DIRENV_LOG_FORMAT = ""; # Hide direnv log
};
}

View file

@ -1,5 +1,14 @@
{ pkgs, ... }:
{ pkgs, settings, ... }:
let
addons = with pkgs; [
fcitx5-gtk
fcitx5-mozc # Japanese
fcitx5-chinese-addons
fcitx5-rime # Bopomofo
rime-data
];
in
{
i18n.defaultLocale = "en_US.UTF-8";
@ -20,13 +29,24 @@
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-gtk
fcitx5-mozc # Japanese
fcitx5-chinese-addons
fcitx5-rime # Bopomofo
rime-data
];
fcitx5.addons = addons;
};
systemd.user.services.fcitx5 = {
enable = true;
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
description = "Fcitx5 Input Method";
environment = {
GTK_IM_MODULE = "";
XMODIFIERS = "@im=fcitx";
QT_IM_MODULE = "fcitx";
};
serviceConfig = {
Type = "simple";
Restart = "on-failure";
RestartSec = 2;
ExecStart = "/run/current-system/sw/bin/fcitx5";
};
};
}