about summary refs log tree commit diff stats
path: root/modules/by-name/al/alacritty/module.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-09-24 11:01:47 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-09-24 11:01:47 +0200
commita313260ac9184327afafb8524a1778900000ace9 (patch)
tree59a7dfe5fa34414c97f0849d274f37576475815b /modules/by-name/al/alacritty/module.nix
parentmodules/ssh: Adapt to home-manager module changes (diff)
downloadnixos-config-a313260ac9184327afafb8524a1778900000ace9.zip
modules/legacy/{rofi,alacritty}: Migrate to by-name
Diffstat (limited to '')
-rw-r--r--modules/by-name/al/alacritty/module.nix468
1 files changed, 468 insertions, 0 deletions
diff --git a/modules/by-name/al/alacritty/module.nix b/modules/by-name/al/alacritty/module.nix
new file mode 100644
index 00000000..33db0d3e
--- /dev/null
+++ b/modules/by-name/al/alacritty/module.nix
@@ -0,0 +1,468 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{
+  config,
+  lib,
+  pkgs,
+  libraries,
+  ...
+}: let
+  cfg = config.soispha.programs.alacritty;
+in {
+  options.soispha.programs.alacritty = {
+    enable = libraries.base.options.mkEnable "alacritty";
+
+    package = lib.mkPackageOption pkgs "alacritty" {};
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.soispha = {
+      home.sessionVariables = {
+        # This is **not** the TERM variable but a special one to signify my favorite terminal.
+        TERMINAL = "alacritty";
+      };
+
+      programs.alacritty = {
+        enable = true;
+        inherit (cfg) package;
+
+        settings = {
+          bell = {
+            duration = 0;
+          };
+
+          colors = builtins.fromTOML (builtins.readFile ./theme.toml);
+
+          cursor = {
+            blink_interval = 750;
+            blink_timeout = 5;
+            style = {
+              blinking = "On";
+              shape = "Beam";
+            };
+            thickness = 0.15;
+            unfocused_hollow = true;
+            vi_mode_style = "None";
+          };
+
+          env = {
+            COLORTERM = "truecolor";
+            TERM = "alacritty";
+          };
+
+          font = {
+            builtin_box_drawing = true;
+            glyph_offset = {
+              x = -1;
+              y = -1;
+            };
+            normal = {
+              family = "SauceCodePro Nerd Font Mono";
+              style = "Regular";
+            };
+            offset = {
+              x = -1;
+              y = -1;
+            };
+            size = 12;
+          };
+
+          general = {
+            ipc_socket = true;
+            live_config_reload = true;
+          };
+
+          hints = {
+            alphabet = "jfkdls;ahgurieowpq";
+            enabled = [
+              {
+                binding = {
+                  key = "U";
+                  mods = "Control|Shift";
+                };
+                command = "xdg-open";
+                hyperlinks = true;
+                mouse = {
+                  enabled = true;
+                };
+                persist = false;
+                post_processing = true;
+                regex = "(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file:|git://|ssh:|ftp://)[^";
+              }
+              {
+                action = "Paste";
+                binding = {
+                  key = "T";
+                  mods = "Control|Shift";
+                };
+                post_processing = false;
+                regex = "([^ '\"`=:\\[\\(]*/)([^/: '\"`\\)\\]]*)";
+              }
+              {
+                action = "Paste";
+                binding = {
+                  key = "H";
+                  mods = "Control|Shift";
+                };
+                post_processing = false;
+                regex = "([a-z0-9]{7,40})\\s";
+              }
+            ];
+          };
+
+          keyboard = {
+            bindings = [
+              {
+                action = "Paste";
+                key = "P";
+                mods = "Control";
+              }
+              {
+                action = "Paste";
+                key = "Insert";
+                mods = "Shift";
+              }
+              {
+                chars = "gc";
+                key = "Slash";
+                mods = "Control";
+              }
+              {
+                action = "Copy";
+                key = "Y";
+                mods = "Control";
+              }
+              {
+                action = "ResetFontSize";
+                key = "Key0";
+                mods = "Control";
+              }
+              {
+                action = "IncreaseFontSize";
+                key = "Equals";
+                mods = "Control";
+              }
+              {
+                action = "IncreaseFontSize";
+                key = "Plus";
+                mods = "Control";
+              }
+              {
+                action = "DecreaseFontSize";
+                key = "Minus";
+                mods = "Control";
+              }
+              {
+                action = "ToggleViMode";
+                key = "Space";
+                mods = "Control";
+              }
+              {
+                action = "ScrollToBottom";
+                key = "Space";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ScrollToBottom";
+                key = "I";
+                mode = "Vi";
+              }
+              {
+                action = "ToggleViMode";
+                key = "I";
+                mode = "Vi";
+              }
+              {
+                action = "ScrollToBottom";
+                key = "C";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ToggleViMode";
+                key = "C";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ClearSelection";
+                key = "Escape";
+                mode = "Vi";
+              }
+              {
+                action = "ScrollLineUp";
+                key = "Y";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ScrollLineDown";
+                key = "E";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ScrollToTop";
+                key = "G";
+                mode = "Vi";
+              }
+              {
+                action = "ScrollToBottom";
+                key = "G";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "ScrollPageUp";
+                key = "B";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ScrollPageDown";
+                key = "F";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ScrollHalfPageUp";
+                key = "U";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ScrollHalfPageDown";
+                key = "D";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "Copy";
+                key = "Y";
+                mode = "Vi";
+              }
+              {
+                action = "ClearSelection";
+                key = "Y";
+                mode = "Vi";
+              }
+              {
+                action = "ToggleNormalSelection";
+                key = "V";
+                mode = "Vi";
+              }
+              {
+                action = "ToggleLineSelection";
+                key = "V";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "ToggleBlockSelection";
+                key = "V";
+                mode = "Vi";
+                mods = "Control";
+              }
+              {
+                action = "ToggleSemanticSelection";
+                key = "V";
+                mode = "Vi";
+                mods = "Alt";
+              }
+              {
+                action = "Open";
+                key = "Return";
+                mode = "Vi";
+              }
+              {
+                action = "Up";
+                key = "K";
+                mode = "Vi";
+              }
+              {
+                action = "Down";
+                key = "J";
+                mode = "Vi";
+              }
+              {
+                action = "Left";
+                key = "H";
+                mode = "Vi";
+              }
+              {
+                action = "Right";
+                key = "L";
+                mode = "Vi";
+              }
+              {
+                action = "Up";
+                key = "Up";
+                mode = "Vi";
+              }
+              {
+                action = "Down";
+                key = "Down";
+                mode = "Vi";
+              }
+              {
+                action = "Left";
+                key = "Left";
+                mode = "Vi";
+              }
+              {
+                action = "Right";
+                key = "Right";
+                mode = "Vi";
+              }
+              {
+                action = "First";
+                key = "Key0";
+                mode = "Vi";
+              }
+              {
+                action = "Last";
+                key = "Key4";
+                mode = "Vi";
+              }
+              {
+                action = "FirstOccupied";
+                key = "Key6";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "High";
+                key = "H";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "Middle";
+                key = "M";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "Low";
+                key = "L";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "SemanticLeft";
+                key = "B";
+                mode = "Vi";
+              }
+              {
+                action = "SemanticRight";
+                key = "W";
+                mode = "Vi";
+              }
+              {
+                action = "SemanticRightEnd";
+                key = "E";
+                mode = "Vi";
+              }
+              {
+                action = "WordLeft";
+                key = "B";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "WordRight";
+                key = "W";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "WordRightEnd";
+                key = "E";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "Bracket";
+                key = "Key5";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "SearchForward";
+                key = "Slash";
+                mode = "Vi";
+              }
+              {
+                action = "SearchBackward";
+                key = "Slash";
+                mode = "Vi";
+                mods = "Shift";
+              }
+              {
+                action = "SearchNext";
+                key = "N";
+                mode = "Vi";
+              }
+              {
+                action = "SearchPrevious";
+                key = "N";
+                mode = "Vi";
+                mods = "Shift";
+              }
+            ];
+          };
+
+          mouse = {
+            bindings = [
+              {
+                action = "Copy";
+                mouse = "Middle";
+              }
+            ];
+            hide_when_typing =
+              false;
+          };
+
+          scrolling = {
+            history = 10000;
+            multiplier = 3;
+          };
+
+          selection = {
+            save_to_clipboard = false;
+            semantic_escape_chars = ",│`|:\"' ()[]{}<>\t";
+          };
+
+          window = {
+            class = {
+              general = "Alacritty";
+              instance = "Alacritty";
+            };
+            decorations = "none";
+            decorations_theme_variant = "None";
+            dimensions = {
+              columns = 0;
+              lines = 0;
+            };
+            dynamic_title = true;
+            opacity = 0.9;
+            padding = {
+              x = 5;
+              y = 5;
+            };
+            startup_mode = "Windowed";
+            title = "Alacritty";
+          };
+        };
+      };
+    };
+  };
+}