From 1957081c122fe231eb6120192489dd979d214317 Mon Sep 17 00:00:00 2001 From: mediocregopher Date: Sun, 13 Aug 2023 21:34:14 +0200 Subject: Update branch with all changes which could be brought in from private branches For a while I was keeping a private branch where there were a lot of non-public things included, and that became the de-facto branch while this one lagged. This one is now up-to-date, all private stuff is dealt with via config files which are not committed. --- alacritty/alacritty.yml | 193 ++++++++++++++++----------- alacritty/default.nix | 54 +++++--- alacritty/fonts/SourceCodePro-Black.ttf | Bin 120356 -> 0 bytes alacritty/fonts/SourceCodePro-Bold.ttf | Bin 120504 -> 0 bytes alacritty/fonts/SourceCodePro-ExtraLight.ttf | Bin 121568 -> 0 bytes alacritty/fonts/SourceCodePro-Light.ttf | Bin 121284 -> 0 bytes alacritty/fonts/SourceCodePro-Medium.ttf | Bin 120244 -> 0 bytes alacritty/fonts/SourceCodePro-Regular.ttf | Bin 120548 -> 0 bytes alacritty/fonts/SourceCodePro-Semibold.ttf | Bin 120252 -> 0 bytes 9 files changed, 151 insertions(+), 96 deletions(-) delete mode 100644 alacritty/fonts/SourceCodePro-Black.ttf delete mode 100644 alacritty/fonts/SourceCodePro-Bold.ttf delete mode 100644 alacritty/fonts/SourceCodePro-ExtraLight.ttf delete mode 100644 alacritty/fonts/SourceCodePro-Light.ttf delete mode 100644 alacritty/fonts/SourceCodePro-Medium.ttf delete mode 100644 alacritty/fonts/SourceCodePro-Regular.ttf delete mode 100644 alacritty/fonts/SourceCodePro-Semibold.ttf (limited to 'alacritty') diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml index d09b2fb..06285c5 100644 --- a/alacritty/alacritty.yml +++ b/alacritty/alacritty.yml @@ -101,82 +101,76 @@ env: # Scrolling distance multiplier. #multiplier: 3 -## Font configuration +# Font configuration font: - size: 7 - - # - #TODO I'd like to restore this font configuration, but I can't cause nix - #doesn't play nicely with fontconfig - #font: - # # Normal (roman) font face - # normal: - # # Font family - # # - # # Default: - # # - (macOS) Menlo - # # - (Linux/BSD) monospace - # # - (Windows) Consolas - # family: Source Code Pro - # - # # The `style` can be specified to pick a specific face. - # style: Regular - # - # # Bold font face - # bold: - # # Font family - # # - # # If the bold family is not specified, it will fall back to the - # # value specified for the normal font. - # family: Source Code Pro - # - # # The `style` can be specified to pick a specific face. - # style: Bold - # - # # Italic font face - # italic: - # # Font family - # # - # # If the italic family is not specified, it will fall back to the - # # value specified for the normal font. - # family: Source Code Pro - # - # # The `style` can be specified to pick a specific face. - # style: Italic - # - # # Bold italic font face - # bold_italic: - # # Font family - # # - # # If the bold italic family is not specified, it will fall back to the - # # value specified for the normal font. - # family: Source Code Pro - # - # # The `style` can be specified to pick a specific face. - # style: Bold Italic - # - # # Point size - # size: 6.3 - # - # # Offset is the extra space around each character. `offset.y` can be thought - # # of as modifying the line spacing, and `offset.x` as modifying the letter - # # spacing. - # #offset: - # # x: 0 - # # y: 0 - # - # # Glyph offset determines the locations of the glyphs within their cells with - # # the default being at the bottom. Increasing `x` moves the glyph to the - # # right, increasing `y` moves the glyph upward. - # #glyph_offset: - # # x: 0 - # # y: 0 - # - # # Thin stroke font rendering (macOS only) - # # - # # Thin strokes are suitable for retina displays, but for non-retina screens - # # it is recommended to set `use_thin_strokes` to `false`. - # #use_thin_strokes: true + # Normal (roman) font face + normal: + # Font family + # + # Default: + # - (macOS) Menlo + # - (Linux/BSD) monospace + # - (Windows) Consolas + family: "Source Code Pro" + + # The `style` can be specified to pick a specific face. + style: Regular + + # Bold font face + bold: + # Font family + # + # If the bold family is not specified, it will fall back to the + # value specified for the normal font. + family: "Source Code Pro" + + # The `style` can be specified to pick a specific face. + style: Bold + + # Italic font face + italic: + # Font family + # + # If the italic family is not specified, it will fall back to the + # value specified for the normal font. + family: "Source Code Pro" + + # The `style` can be specified to pick a specific face. + style: Italic + + # Bold italic font face + bold_italic: + # Font family + # + # If the bold italic family is not specified, it will fall back to the + # value specified for the normal font. + family: "Source Code Pro" + + # The `style` can be specified to pick a specific face. + style: Bold Italic + + # Point size + size: 6.3 + + # Offset is the extra space around each character. `offset.y` can be thought + # of as modifying the line spacing, and `offset.x` as modifying the letter + # spacing. + #offset: + # x: 0 + # y: 0 + + # Glyph offset determines the locations of the glyphs within their cells with + # the default being at the bottom. Increasing `x` moves the glyph to the + # right, increasing `y` moves the glyph upward. + #glyph_offset: + # x: 0 + # y: 0 + + # Thin stroke font rendering (macOS only) + # + # Thin strokes are suitable for retina displays, but for non-retina screens + # it is recommended to set `use_thin_strokes` to `false`. + #use_thin_strokes: true # If `true`, bold text is drawn using the bright color variants. #draw_bold_text_with_bright_colors: false @@ -855,7 +849,54 @@ colors: # - Info # - Debug # - Trace - #log_level: Warn + #log_level: Trace # Print all received window events. #print_events: false + +# Hints +# +# Terminal hints can be used to find text or hyperlink in the visible part of +# the terminal and pipe it to other applications. +#hints: + # Keys used for the hint labels. + #alphabet: "jfkdls;ahgurieowpq" + + # List with all available hints + # + # Each hint must have any of `regex` or `hyperlinks` field and either an + # `action` or a `command` field. The fields `mouse`, `binding` and + # `post_processing` are optional. + # + # The `hyperlinks` option will cause OSC 8 escape sequence hyperlinks to be + # highlighted. + # + # The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and + # `mouse.mods` accept the same values as they do in the `key_bindings` section. + # + # The `mouse.enabled` field controls if the hint should be underlined while + # the mouse with all `mouse.mods` keys held or the vi mode cursor is above it. + # + # If the `post_processing` field is set to `true`, heuristics will be used to + # shorten the match if there are characters likely not to be part of the hint + # (e.g. a trailing `.`). This is most useful for URIs and applies only to + # `regex` matches. + # + # Values for `action`: + # - Copy + # Copy the hint's text to the clipboard. + # - Paste + # Paste the hint's text to the terminal or search. + # - Select + # Select the hint's text. + # - MoveViModeCursor + # Move the vi mode cursor to the beginning of the hint. + #enabled: + # - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" + # hyperlinks: true + # command: xdg-open + # post_processing: true + # mouse: + # enabled: true + # mods: None +hints: $HINTS diff --git a/alacritty/default.nix b/alacritty/default.nix index c5681b0..213ec86 100644 --- a/alacritty/default.nix +++ b/alacritty/default.nix @@ -1,35 +1,49 @@ { - pkgs ? (import ../pkgs.nix) {}, + config, + + pkgs ? (import ../pkgs.nix).stable2305 {}, zsh ? pkgs.zsh, }: rec { - # TODO figure out a way to provide my font to alacritty at runtime. fontconfig - # is a hot mess... - # - #dataDir = pkgs.stdenv.mkDerivation { - # name = "alacritty-dataDir"; - # src = ./fonts; - # buildInputs = [ pkgs.fontconfig ]; - # builder = builtins.toFile "builder.sh" '' - # source $stdenv/setup - # mkdir "$out" - # cp -r "$src" "$out"/fonts - # chmod -R +w "$out" + defaultXDGOpenRules = [ + { + name = "open-url"; + pattern = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^<>\"\\s{-}\\^⟨⟩`]+"; + xdgOpen = "$1"; + } + ]; - # env + xdgOpenRules = defaultXDGOpenRules ++ config.alacritty.xdgOpenRules; - # export FONTCONFIG_FILE="$out"/fontconfig - # fc-cache --verbose "$out"/fonts + hints = { + enabled = (builtins.map (r: + { + regex = r.pattern; + hyperlinks = true; + command = (pkgs.writeShellScript "alacritty-hints-${r.name}" '' + xdg-open "${r.xdgOpen}" + ''); + post_processing = true; + mouse.enabled = true; + } + ) xdgOpenRules); + }; - # ''; - #}; + configFile = pkgs.writeText "alacritty-config" ( + builtins.replaceStrings + ["$HINTS"] + [(builtins.toJSON hints)] + (builtins.readFile ./alacritty.yml) + ); alacritty = pkgs.writeScriptBin "alacritty" '' #!${pkgs.bash}/bin/bash - exec ${pkgs.nixgl}/bin/nixGLIntel ${pkgs.alacritty}/bin/alacritty \ - --config-file ${./alacritty.yml} \ + + exec ${pkgs.nixgl}/bin/nixGL ${pkgs.alacritty}/bin/alacritty \ + -o font.size=${builtins.toString config.alacritty.fontSize} \ + --config-file ${configFile} \ -e "${zsh}/bin/zsh" ''; } diff --git a/alacritty/fonts/SourceCodePro-Black.ttf b/alacritty/fonts/SourceCodePro-Black.ttf deleted file mode 100644 index ea73e60..0000000 Binary files a/alacritty/fonts/SourceCodePro-Black.ttf and /dev/null differ diff --git a/alacritty/fonts/SourceCodePro-Bold.ttf b/alacritty/fonts/SourceCodePro-Bold.ttf deleted file mode 100644 index a56f1fa..0000000 Binary files a/alacritty/fonts/SourceCodePro-Bold.ttf and /dev/null differ diff --git a/alacritty/fonts/SourceCodePro-ExtraLight.ttf b/alacritty/fonts/SourceCodePro-ExtraLight.ttf deleted file mode 100644 index f409b71..0000000 Binary files a/alacritty/fonts/SourceCodePro-ExtraLight.ttf and /dev/null differ diff --git a/alacritty/fonts/SourceCodePro-Light.ttf b/alacritty/fonts/SourceCodePro-Light.ttf deleted file mode 100644 index 51eb963..0000000 Binary files a/alacritty/fonts/SourceCodePro-Light.ttf and /dev/null differ diff --git a/alacritty/fonts/SourceCodePro-Medium.ttf b/alacritty/fonts/SourceCodePro-Medium.ttf deleted file mode 100644 index 1ee45eb..0000000 Binary files a/alacritty/fonts/SourceCodePro-Medium.ttf and /dev/null differ diff --git a/alacritty/fonts/SourceCodePro-Regular.ttf b/alacritty/fonts/SourceCodePro-Regular.ttf deleted file mode 100644 index b2cff92..0000000 Binary files a/alacritty/fonts/SourceCodePro-Regular.ttf and /dev/null differ diff --git a/alacritty/fonts/SourceCodePro-Semibold.ttf b/alacritty/fonts/SourceCodePro-Semibold.ttf deleted file mode 100644 index b425f9c..0000000 Binary files a/alacritty/fonts/SourceCodePro-Semibold.ttf and /dev/null differ -- cgit v1.2.3