From 8b31ad8202a9b992c2f5e7c25e52004f3014f7b6 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 16 May 2023 15:35:24 -0400 Subject: [PATCH] Abstract fcitx5 and rofi into separate files --- flake.nix | 2 + home-manager/fcitx5/default.nix | 156 ++++++++++++++++ home-manager/rofi/default.nix | 27 +++ .../rofi/launchpad.rasi | 0 home.nix | 173 ------------------ 5 files changed, 185 insertions(+), 173 deletions(-) create mode 100644 home-manager/fcitx5/default.nix create mode 100644 home-manager/rofi/default.nix rename launchpad.rasi => home-manager/rofi/launchpad.rasi (100%) diff --git a/flake.nix b/flake.nix index 4205ede8..6a77b2b0 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,8 @@ modules = [ ./configuration.nix ./home.nix + ./home-manager/fcitx5 + ./home-manager/rofi hyprland.nixosModules.default { programs.hyprland.enable = true; } stylix.nixosModules.stylix diff --git a/home-manager/fcitx5/default.nix b/home-manager/fcitx5/default.nix new file mode 100644 index 00000000..77f1e842 --- /dev/null +++ b/home-manager/fcitx5/default.nix @@ -0,0 +1,156 @@ +{ + home-manager.sharedModules = [{ + xdg.configFile."fcitx5/config".force = true; + xdg.configFile."fcitx5/config".text = '' + [Hotkey] + # Enumerate when press trigger key repeatedly + EnumerateWithTriggerKeys=True + # Temporally switch between first and current Input Method + AltTriggerKeys= + # Enumerate Input Method Forward + EnumerateForwardKeys= + # Enumerate Input Method Backward + EnumerateBackwardKeys= + # Skip first input method while enumerating + EnumerateSkipFirst=False + # Enumerate Input Method Group Forward + EnumerateGroupForwardKeys= + # Enumerate Input Method Group Backward + EnumerateGroupBackwardKeys= + # Activate Input Method + ActivateKeys= + # Deactivate Input Method + DeactivateKeys= + + [Hotkey/TriggerKeys] + 0=Super+space + + [Hotkey/PrevPage] + 0=Up + + [Hotkey/NextPage] + 0=Down + + [Hotkey/PrevCandidate] + 0=Shift+Tab + + [Hotkey/NextCandidate] + 0=Tab + + [Hotkey/TogglePreedit] + 0=Control+Alt+P + + [Behavior] + # Active By Default + ActiveByDefault=False + # Share Input State + ShareInputState=No + # Show preedit in application + PreeditEnabledByDefault=True + # Show Input Method Information when switch input method + ShowInputMethodInformation=True + # Show Input Method Information when changing focus + showInputMethodInformationWhenFocusIn=False + # Show compact input method information + CompactInputMethodInformation=True + # Show first input method information + ShowFirstInputMethodInformation=True + # Default page size + DefaultPageSize=5 + # Override Xkb Option + OverrideXkbOption=False + # Custom Xkb Option + CustomXkbOption= + # Force Enabled Addons + EnabledAddons= + # Force Disabled Addons + DisabledAddons= + # Preload input method to be used by default + PreloadInputMethod=True + ''; + xdg.configFile."fcitx5/profile".force = true; + xdg.configFile."fcitx5/profile".text = '' + [Groups/0] + # Group Name + Name="Group 1" + # Layout + Default Layout=us + # Default Input Method + DefaultIM=mozc + + [Groups/0/Items/0] + # Name + Name=keyboard-us + # Layout + Layout= + + [Groups/0/Items/1] + # Name + Name=mozc + # Layout + Layout= + + [GroupOrder] + 0="Group 1" + ''; + xdg.configFile."fcitx5/conf/classicui.conf".force = true; + xdg.configFile."fcitx5/conf/classicui.conf".text = '' + # Vertical Candidate List + Vertical Candidate List=False + # Use Per Screen DPI + PerScreenDPI=True + # Use mouse wheel to go to prev or next page + WheelForPaging=True + # Font + Font="Noto Sans CJK JP 11" + # Menu Font + MenuFont="Noto Sans CJK JP 11" + # Tray Font + TrayFont="Noto Sans CJK JP Medium 11" + # Tray Label Outline Color + TrayOutlineColor=#49483e + # Tray Label Text Color + TrayTextColor=#f8f8f2 + # Prefer Text Icon + PreferTextIcon=True + # Show Layout Name In Icon + ShowLayoutNameInIcon=True + # Use input method language to display text + UseInputMethodLangaugeToDisplayText=True + # Theme + Theme=default + ''; + xdg.configFile."fcitx5/conf/clipboard.conf".force = true; + xdg.configFile."fcitx5/conf/clipboard.conf".text = '' + # Trigger Key + TriggerKey= + # Paste Primary + PastePrimaryKey= + # Number of entries + Number of entries=5 + ''; + xdg.configFile."fcitx5/conf/mozc.conf".force = true; + xdg.configFile."fcitx5/conf/mozc.conf".text = '' + # Initial Mode + InitialMode=Hiragana + # Vertical candidate list + Vertical=True + # Expand Usage (Requires vertical candidate list) + ExpandMode="On Focus" + # Fix embedded preedit cursor at the beginning of the preedit + PreeditCursorPositionAtBeginning=False + # Hotkey to expand usage + ExpandKey=Control+Alt+H + ''; + xdg.configFile."fcitx5/conf/notifications.conf".force = true; + xdg.configFile."fcitx5/conf/notifications.conf".text = '' + # Hidden Notifications + HiddenNotifications= + ''; + xdg.configFile."fcitx5/conf/unicode.conf".force = true; + xdg.configFile."fcitx5/conf/unicode.conf".text = '' + # Trigger Key + TriggerKey= + ''; + }]; +} diff --git a/home-manager/rofi/default.nix b/home-manager/rofi/default.nix new file mode 100644 index 00000000..7782db46 --- /dev/null +++ b/home-manager/rofi/default.nix @@ -0,0 +1,27 @@ +{ pkgs, lib, ... }: + +{ + home-manager.sharedModules = [{ + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + cycle = false; + extraConfig = { + modi = "drun,filebrowser"; + font = "Noto Sans CJK JP 12"; + show-icons = true; + bw = 0; + display-drun = ""; + display-window = ""; + display-combi = ""; + icon-theme = "Fluent-dark"; + terminal = "kitty"; + drun-match-fields = "name"; + drun-display-format = "{name}"; + me-select-entry = ""; + me-accept-entry = "MousePrimary"; + }; + theme = lib.mkForce ./launchpad.rasi; + }; + }]; +} diff --git a/launchpad.rasi b/home-manager/rofi/launchpad.rasi similarity index 100% rename from launchpad.rasi rename to home-manager/rofi/launchpad.rasi diff --git a/home.nix b/home.nix index 9d651652..486e74dc 100644 --- a/home.nix +++ b/home.nix @@ -228,158 +228,6 @@ } active_on_launch: True ''; - xdg.configFile."fcitx5/config".force = true; - xdg.configFile."fcitx5/config".text = '' - [Hotkey] - # Enumerate when press trigger key repeatedly - EnumerateWithTriggerKeys=True - # Temporally switch between first and current Input Method - AltTriggerKeys= - # Enumerate Input Method Forward - EnumerateForwardKeys= - # Enumerate Input Method Backward - EnumerateBackwardKeys= - # Skip first input method while enumerating - EnumerateSkipFirst=False - # Enumerate Input Method Group Forward - EnumerateGroupForwardKeys= - # Enumerate Input Method Group Backward - EnumerateGroupBackwardKeys= - # Activate Input Method - ActivateKeys= - # Deactivate Input Method - DeactivateKeys= - - [Hotkey/TriggerKeys] - 0=Super+space - - [Hotkey/PrevPage] - 0=Up - - [Hotkey/NextPage] - 0=Down - - [Hotkey/PrevCandidate] - 0=Shift+Tab - - [Hotkey/NextCandidate] - 0=Tab - - [Hotkey/TogglePreedit] - 0=Control+Alt+P - - [Behavior] - # Active By Default - ActiveByDefault=False - # Share Input State - ShareInputState=No - # Show preedit in application - PreeditEnabledByDefault=True - # Show Input Method Information when switch input method - ShowInputMethodInformation=True - # Show Input Method Information when changing focus - showInputMethodInformationWhenFocusIn=False - # Show compact input method information - CompactInputMethodInformation=True - # Show first input method information - ShowFirstInputMethodInformation=True - # Default page size - DefaultPageSize=5 - # Override Xkb Option - OverrideXkbOption=False - # Custom Xkb Option - CustomXkbOption= - # Force Enabled Addons - EnabledAddons= - # Force Disabled Addons - DisabledAddons= - # Preload input method to be used by default - PreloadInputMethod=True - ''; - xdg.configFile."fcitx5/profile".force = true; - xdg.configFile."fcitx5/profile".text = '' - [Groups/0] - # Group Name - Name="Group 1" - # Layout - Default Layout=us - # Default Input Method - DefaultIM=mozc - - [Groups/0/Items/0] - # Name - Name=keyboard-us - # Layout - Layout= - - [Groups/0/Items/1] - # Name - Name=mozc - # Layout - Layout= - - [GroupOrder] - 0="Group 1" - ''; - xdg.configFile."fcitx5/conf/classicui.conf".force = true; - xdg.configFile."fcitx5/conf/classicui.conf".text = '' - # Vertical Candidate List - Vertical Candidate List=False - # Use Per Screen DPI - PerScreenDPI=True - # Use mouse wheel to go to prev or next page - WheelForPaging=True - # Font - Font="Noto Sans CJK JP 11" - # Menu Font - MenuFont="Noto Sans CJK JP 11" - # Tray Font - TrayFont="Noto Sans CJK JP Medium 11" - # Tray Label Outline Color - TrayOutlineColor=#49483e - # Tray Label Text Color - TrayTextColor=#f8f8f2 - # Prefer Text Icon - PreferTextIcon=True - # Show Layout Name In Icon - ShowLayoutNameInIcon=True - # Use input method language to display text - UseInputMethodLangaugeToDisplayText=True - # Theme - Theme=default - ''; - xdg.configFile."fcitx5/conf/clipboard.conf".force = true; - xdg.configFile."fcitx5/conf/clipboard.conf".text = '' - # Trigger Key - TriggerKey= - # Paste Primary - PastePrimaryKey= - # Number of entries - Number of entries=5 - ''; - xdg.configFile."fcitx5/conf/mozc.conf".force = true; - xdg.configFile."fcitx5/conf/mozc.conf".text = '' - # Initial Mode - InitialMode=Hiragana - # Vertical candidate list - Vertical=True - # Expand Usage (Requires vertical candidate list) - ExpandMode="On Focus" - # Fix embedded preedit cursor at the beginning of the preedit - PreeditCursorPositionAtBeginning=False - # Hotkey to expand usage - ExpandKey=Control+Alt+H - ''; - xdg.configFile."fcitx5/conf/notifications.conf".force = true; - xdg.configFile."fcitx5/conf/notifications.conf".text = '' - # Hidden Notifications - HiddenNotifications= - ''; - xdg.configFile."fcitx5/conf/unicode.conf".force = true; - xdg.configFile."fcitx5/conf/unicode.conf".text = '' - # Trigger Key - TriggerKey= - ''; xdg.configFile."ranger/rc.conf".text = '' set line_numbers absolute set padding_right false @@ -795,27 +643,6 @@ mpd_crossfade_time = 3; }; }; - programs.rofi = { - enable = true; - package = pkgs.rofi-wayland; - cycle = false; - extraConfig = { - modi = "drun,filebrowser"; - font = "Noto Sans CJK JP 12"; - show-icons = true; - bw = 0; - display-drun = ""; - display-window = ""; - display-combi = ""; - icon-theme = "Papirus"; - terminal = "kitty"; - drun-match-fields = "name"; - drun-display-format = "{name}"; - me-select-entry = ""; - me-accept-entry = "MousePrimary"; - }; - theme = lib.mkForce ./launchpad.rasi; - }; services.gpg-agent = { enable = true; pinentryFlavor = "curses";