diff options
| author | Caroline Larimore <caroline@larimo.re> | 2025-02-08 15:42:06 -0800 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2025-04-14 18:58:50 -0700 |
| commit | 6f6b6b59e64ee94be095e856e1e6943bbf574349 (patch) | |
| tree | 2e228d8cdc48273d12a238fe34c3e3124da754c0 | |
| parent | 89911792efc07ce5dd52f3a9f5b2eb2046fd06a6 (diff) | |
migration: fcitx5 theme + fix
| -rw-r--r-- | hosts/c-pc/home.nix | 3 | ||||
| -rw-r--r-- | roles/home/desktop/fcitx5.nix | 62 | ||||
| -rw-r--r-- | snowfall/modules/home/desktop/components/fcitx5/default.nix | 82 | ||||
| -rw-r--r-- | snowfall/modules/home/desktop/components/i3/default.nix | 3 | ||||
| -rw-r--r-- | snowfall/modules/home/suites/desktop/default.nix | 1 | ||||
| -rw-r--r-- | snowfall/modules/nixos/hardware/keyboard/default.nix | 6 | ||||
| -rw-r--r-- | snowfall/modules/nixos/suites/desktop/default.nix | 2 |
7 files changed, 89 insertions, 70 deletions
diff --git a/hosts/c-pc/home.nix b/hosts/c-pc/home.nix index 15a9e09..0bbe373 100644 --- a/hosts/c-pc/home.nix +++ b/hosts/c-pc/home.nix @@ -25,9 +25,6 @@ ".config/Obsidian" - ".config/fcitx" - ".config/fcitx5" - ".config/qBittorrent" ".local/share/qBittorrent" ".cache/qBittorrent" diff --git a/roles/home/desktop/fcitx5.nix b/roles/home/desktop/fcitx5.nix deleted file mode 100644 index 3b3e537..0000000 --- a/roles/home/desktop/fcitx5.nix +++ /dev/null @@ -1,62 +0,0 @@ -# This file only handles theming of fcitx5. -{ config, lib, pkgs, ... }: - -lib.mkIf config.home.roles.desktop.enable { - xdg.dataFile."fcitx5/themes/nix-theme/theme.conf".source = let c = config.theme.colors; in (pkgs.formats.ini { }).generate "what" { - "Metadata" = { - Name = "nix-theme"; - Author = "CartConnoisseur"; - Description = "Theme generated by nixos"; - Version = 1; - }; - - "InputPanel" = { - NormalColor = "#${c.fg}"; - HighlightColor = "#${c.fg}"; - HighlightBackgroundColor = "#00000000"; - HighlightCandidateColor = "#${c.bg}"; - - FullWidthHighlight = true; - PageButtonAlignment = "Last Candidate"; - }; - - "InputPanel/Background" = { - Color = "#${c.bg}"; - BorderColor = "#${c.fg1}"; - BorderWidth = 2; - }; - - # "InputPanel/Background/Margin" = { - # Left = 10; - # Right = 10; - # Top = 10; - # Bottom = 10; - # }; - - "InputPanel/Highlight" = { - Color = "#${c.fg}"; - BorderWidth = 0; - }; - - "InputPanel/Highlight/Margin" = { - Left = 2; - Right = 2; - Top = 2; - Bottom = 2; - }; - - "InputPanel/ContentMargin" = { - Left = 2; - Right = 2; - Top = 2; - Bottom = 2; - }; - - "InputPanel/TextMargin" = { - Left = 5; - Right = 5; - Top = 5; - Bottom = 5; - }; - }; -} diff --git a/snowfall/modules/home/desktop/components/fcitx5/default.nix b/snowfall/modules/home/desktop/components/fcitx5/default.nix new file mode 100644 index 0000000..0eb0a4c --- /dev/null +++ b/snowfall/modules/home/desktop/components/fcitx5/default.nix @@ -0,0 +1,82 @@ +{ options, config, osConfig, lib, pkgs, namespace, ... }: + +with lib; with lib.${namespace}; let + cfg = config.${namespace}.desktop.components.fcitx5; + oscfg = osConfig.${namespace}.hardware.keyboard.jp; + desktop = config.${namespace}.desktop; + impermanence = config.${namespace}.impermanence; +in { + options.${namespace}.desktop.components.fcitx5 = with types; { + enable = mkEnableOption "fcitx5 theming"; + }; + + config = mkIf (cfg.enable && oscfg.enable) { + #TODO: investigate generating config files instead of persisting + home.persistence.${impermanence.location} = { + directories = [ + ".config/fcitx" + ".config/fcitx5" + ]; + }; + + xdg.dataFile."fcitx5/themes/nix-theme/theme.conf".source = let + c = desktop.theme.colors; + in (pkgs.formats.ini {}).generate "fcitx5-theme.conf" { + "Metadata" = { + Name = "nix-theme"; + Author = "CartConnoisseur"; + Description = "Theme generated by NixOS"; + Version = 1; + }; + + "InputPanel" = { + NormalColor = "#${c.fg}"; + HighlightColor = "#${c.fg}"; + HighlightBackgroundColor = "#00000000"; + HighlightCandidateColor = "#${c.bg}"; + + FullWidthHighlight = true; + PageButtonAlignment = "Last Candidate"; + }; + + "InputPanel/Background" = { + Color = "#${c.bg}"; + BorderColor = "#${c.fg1}"; + BorderWidth = 2; + }; + + # "InputPanel/Background/Margin" = { + # Left = 10; + # Right = 10; + # Top = 10; + # Bottom = 10; + # }; + + "InputPanel/Highlight" = { + Color = "#${c.fg}"; + BorderWidth = 0; + }; + + "InputPanel/Highlight/Margin" = { + Left = 2; + Right = 2; + Top = 2; + Bottom = 2; + }; + + "InputPanel/ContentMargin" = { + Left = 2; + Right = 2; + Top = 2; + Bottom = 2; + }; + + "InputPanel/TextMargin" = { + Left = 5; + Right = 5; + Top = 5; + Bottom = 5; + }; + }; + }; +} diff --git a/snowfall/modules/home/desktop/components/i3/default.nix b/snowfall/modules/home/desktop/components/i3/default.nix index 93542f0..cf9ed91 100644 --- a/snowfall/modules/home/desktop/components/i3/default.nix +++ b/snowfall/modules/home/desktop/components/i3/default.nix @@ -115,7 +115,8 @@ in { { command = "polybar-msg cmd quit; polybar"; always = true; notification = false; } { command = "systemctl --user restart picom"; always = true; notification = false; } { command = "${pkgs.feh}/bin/feh --bg-fill ${desktop.background}"; always = true; notification = false; } - { command = "${pkgs.fcitx5}/bin/fcitx5 -r -d"; always = true; notification = false; } + ] ++ optionals desktop.components.fcitx5.enable [ + { command = "fcitx5 -dr"; always = true; notification = false; } ]; keybindings = { diff --git a/snowfall/modules/home/suites/desktop/default.nix b/snowfall/modules/home/suites/desktop/default.nix index a98472a..377cff6 100644 --- a/snowfall/modules/home/suites/desktop/default.nix +++ b/snowfall/modules/home/suites/desktop/default.nix @@ -22,6 +22,7 @@ in { picom.enable = true; gtk.enable = true; + fcitx5.enable = true; }; }; }; diff --git a/snowfall/modules/nixos/hardware/keyboard/default.nix b/snowfall/modules/nixos/hardware/keyboard/default.nix index a8c478d..0ea2aa6 100644 --- a/snowfall/modules/nixos/hardware/keyboard/default.nix +++ b/snowfall/modules/nixos/hardware/keyboard/default.nix @@ -5,7 +5,7 @@ with lib; with lib.${namespace}; let in { options.${namespace}.hardware.keyboard = with types; { enable = mkEnableOption "keyboard hardware tweaks"; - jp = mkEnableOption "japanese ime support"; + jp.enable = mkEnableOption "japanese ime support"; }; config = mkIf cfg.enable { @@ -29,13 +29,13 @@ in { }; }; - i18n.inputMethod = mkIf cfg.jp { + i18n.inputMethod = mkIf cfg.jp.enable { enable = true; type = "fcitx5"; fcitx5.addons = with pkgs; [ fcitx5-mozc ]; }; - environment.variables = mkIf cfg.jp { + environment.variables = mkIf cfg.jp.enable { # Required for fcitx5 support in kitty GLFW_IM_MODULE = "ibus"; }; diff --git a/snowfall/modules/nixos/suites/desktop/default.nix b/snowfall/modules/nixos/suites/desktop/default.nix index 1d6e0c2..246f38c 100644 --- a/snowfall/modules/nixos/suites/desktop/default.nix +++ b/snowfall/modules/nixos/suites/desktop/default.nix @@ -11,7 +11,7 @@ in { cxl = { hardware = { audio.enable = true; - keyboard.jp = true; + keyboard.jp.enable = true; }; apps = { |