Switch to standard alacritty. Remove custom alt-keybinds, as they are replaced with option_as_alt

This commit is contained in:
xenia 2024-06-04 16:18:12 +02:00
parent bbb0aa3972
commit 4cb4e30f3d
2 changed files with 31 additions and 239 deletions

View File

@ -48,6 +48,9 @@ esac";
padding.y = 0;
decorations = if stdenv.isDarwin then "Buttonless" else "Full";
startup_mode = "Windowed";
opacity = 0.8;
blur = true;
option_as_alt = "OnlyRight";
};
mouse.hide_when_typing = true;
font = {
@ -62,95 +65,13 @@ esac";
shell.program = "${pkgs.zsh}/bin/zsh";
shell.args = [ "--login" "-c" "${tmux-menu}" ];
key_bindings = import ./keybinds.nix { bind-broken-mac-keybinds = stdenv.isDarwin; };
};
alt-patch-package = pkgs.fetchgit {
url = "https://github.com/loovjo/alacritty-modifiers-patch";
rev = "36ac4031248ba132f280017bfd8bf0a32e214f9d";
hash = "sha256-to5Tq64w8Tvt+KHjiKga3B31XC5TT/4kMR1zqp9A3AI=";
fetchSubmodules = true;
# deepClone = true;
};
rpathLibs = with pkgs; [
# expat
# fontconfig
# freetype
# libGL
# xorg.libX11
# xorg.libXcursor
# xorg.libXi
# xorg.libXrandr
# xorg.libXxf86vm
# xorg.libxcb
];
alacritty-alt-patch = with pkgs; rustPlatform.buildRustPackage {
pname = "alacritty-alt-patch";
version = "latest";
src = alt-patch-package;
cargoLock = { lockFile = alt-patch-package + "/Cargo.lock"; };
nativeBuildInputs = [
cmake
installShellFiles
makeWrapper
ncurses
pkg-config
python311
];
buildInputs = rpathLibs
++ (with pkgs.darwin.apple_sdk.frameworks; [
AppKit
CoreGraphics
CoreServices
CoreText
Foundation
libiconv
OpenGL
]);
doCheck = false; # meow
outputs = [ "out" "terminfo" ];
postPatch = lib.optionalString (!xdg-utils.meta.broken) ''
substituteInPlace alacritty/src/config/ui_config.rs \
--replace xdg-open ${xdg-utils}/bin/xdg-open
'';
checkFlags = [ "--skip=term::test::mock_term" ]; # broken on aarch64
postInstall = ''
mkdir $out/Applications
cp -r extra/osx/Alacritty.app $out/Applications
cp -r $out/bin $out/Applications/Alacritty.app/Contents/MacOS # the original script used ln -s instead of cp -r, seems launchpad dies when having symlinks inside the application?
installShellCompletion --zsh extra/completions/_alacritty
installShellCompletion --bash extra/completions/alacritty.bash
installShellCompletion --fish extra/completions/alacritty.fish
install -dm 755 "$out/share/man/man1"
# gzip -c extra/alacritty.man > "$out/share/man/man1/alacritty.1.gz"
# gzip -c extra/alacritty-msg.man > "$out/share/man/man1/alacritty-msg.1.gz"
install -Dm 644 alacritty.yml $out/share/doc/alacritty.yml
install -dm 755 "$terminfo/share/terminfo/a/"
tic -xe alacritty,alacritty-direct -o "$terminfo/share/terminfo" extra/alacritty.info
mkdir -p $out/nix-support
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
'';
dontPatchELF = true;
# passthru.tests.test = nixosTests.terminal-emulators.alacritty;
keyboard.bindings = import ./keybinds.nix { bind-broken-mac-keybinds = stdenv.isDarwin; };
};
in
{
enable = true;
settings = base-cfg;
package = if stdenv.isDarwin then alacritty-alt-patch else pkgs.alacritty;
package = pkgs.alacritty;
}

View File

@ -1,171 +1,42 @@
{ bind-broken-mac-keybinds }:
let
broken-options = [
{ key = ''Backslash''; mods = ''Option''; chars = ''|''; }
{ key = ''Backslash''; mods = ''Shift|Option''; chars = ''\\''; }
{ key = ''Key6''; mods = ''Option''; chars = ''^''; } # huh?
{ key = ''Minus''; mods = ''Shift|Option''; chars = ''_''; }
{ key = ''LBracket''; mods = ''Option''; chars = ''[''; }
{ key = ''LBracket''; mods = ''Shift|Option''; chars = ''{''; }
{ key = ''RBracket''; mods = ''Option''; chars = '']''; }
{ key = ''RBracket''; mods = ''Shift|Option''; chars = ''}''; }
{ key = ''Key2''; mods = ''Option''; chars = ''@''; }
];
ralts = [
{ key = ''A''; mods = ''Alt''; chars = ''\x1ba''; }
{ key = ''B''; mods = ''Alt''; chars = ''\x1bb''; }
{ key = ''C''; mods = ''Alt''; chars = ''\x1bc''; }
{ key = ''D''; mods = ''Alt''; chars = ''\x1bd''; }
{ key = ''E''; mods = ''Alt''; chars = ''\x1be''; }
{ key = ''F''; mods = ''Alt''; chars = ''\x1bf''; }
{ key = ''G''; mods = ''Alt''; chars = ''\x1bg''; }
{ key = ''H''; mods = ''Alt''; chars = ''\x1bh''; }
{ key = ''I''; mods = ''Alt''; chars = ''\x1bi''; }
{ key = ''J''; mods = ''Alt''; chars = ''\x1bj''; }
{ key = ''K''; mods = ''Alt''; chars = ''\x1bk''; }
{ key = ''L''; mods = ''Alt''; chars = ''\x1bl''; }
{ key = ''M''; mods = ''Alt''; chars = ''\x1bm''; }
{ key = ''N''; mods = ''Alt''; chars = ''\x1bn''; }
{ key = ''O''; mods = ''Alt''; chars = ''\x1bo''; }
{ key = ''P''; mods = ''Alt''; chars = ''\x1bp''; }
{ key = ''Q''; mods = ''Alt''; chars = ''\x1bq''; }
{ key = ''R''; mods = ''Alt''; chars = ''\x1br''; }
{ key = ''S''; mods = ''Alt''; chars = ''\x1bs''; }
{ key = ''T''; mods = ''Alt''; chars = ''\x1bt''; }
{ key = ''U''; mods = ''Alt''; chars = ''\x1bu''; }
{ key = ''V''; mods = ''Alt''; chars = ''\x1bv''; }
{ key = ''W''; mods = ''Alt''; chars = ''\x1bw''; }
{ key = ''X''; mods = ''Alt''; chars = ''\x1bx''; }
{ key = ''Y''; mods = ''Alt''; chars = ''\x1by''; }
{ key = ''Z''; mods = ''Alt''; chars = ''\x1bz''; }
{ key = ''A''; mods = ''Alt|Shift''; chars = ''\x1bA''; }
{ key = ''B''; mods = ''Alt|Shift''; chars = ''\x1bB''; }
{ key = ''C''; mods = ''Alt|Shift''; chars = ''\x1bC''; }
{ key = ''D''; mods = ''Alt|Shift''; chars = ''\x1bD''; }
{ key = ''E''; mods = ''Alt|Shift''; chars = ''\x1bE''; }
{ key = ''F''; mods = ''Alt|Shift''; chars = ''\x1bF''; }
{ key = ''G''; mods = ''Alt|Shift''; chars = ''\x1bG''; }
{ key = ''H''; mods = ''Alt|Shift''; chars = ''\x1bH''; }
{ key = ''I''; mods = ''Alt|Shift''; chars = ''\x1bI''; }
{ key = ''J''; mods = ''Alt|Shift''; chars = ''\x1bJ''; }
{ key = ''K''; mods = ''Alt|Shift''; chars = ''\x1bK''; }
{ key = ''L''; mods = ''Alt|Shift''; chars = ''\x1bL''; }
{ key = ''M''; mods = ''Alt|Shift''; chars = ''\x1bM''; }
{ key = ''N''; mods = ''Alt|Shift''; chars = ''\x1bN''; }
{ key = ''O''; mods = ''Alt|Shift''; chars = ''\x1bO''; }
{ key = ''P''; mods = ''Alt|Shift''; chars = ''\x1bP''; }
{ key = ''Q''; mods = ''Alt|Shift''; chars = ''\x1bQ''; }
{ key = ''R''; mods = ''Alt|Shift''; chars = ''\x1bR''; }
{ key = ''S''; mods = ''Alt|Shift''; chars = ''\x1bS''; }
{ key = ''T''; mods = ''Alt|Shift''; chars = ''\x1bT''; }
{ key = ''U''; mods = ''Alt|Shift''; chars = ''\x1bU''; }
{ key = ''V''; mods = ''Alt|Shift''; chars = ''\x1bV''; }
{ key = ''W''; mods = ''Alt|Shift''; chars = ''\x1bW''; }
{ key = ''X''; mods = ''Alt|Shift''; chars = ''\x1bX''; }
{ key = ''Y''; mods = ''Alt|Shift''; chars = ''\x1bY''; }
{ key = ''Z''; mods = ''Alt|Shift''; chars = ''\x1bZ''; }
{ key = ''Key1''; mods = ''Alt''; chars = ''\x1b1''; }
{ key = ''Key2''; mods = ''Alt''; chars = ''\x1b2''; }
{ key = ''Key3''; mods = ''Alt''; chars = ''\x1b3''; }
{ key = ''Key4''; mods = ''Alt''; chars = ''\x1b4''; }
{ key = ''Key5''; mods = ''Alt''; chars = ''\x1b5''; }
{ key = ''Key6''; mods = ''Alt''; chars = ''\x1b6''; }
{ key = ''Key7''; mods = ''Alt''; chars = ''\x1b7''; }
{ key = ''Key8''; mods = ''Alt''; chars = ''\x1b8''; }
{ key = ''Key9''; mods = ''Alt''; chars = ''\x1b9''; }
{ key = ''Key0''; mods = ''Alt''; chars = ''\x1b0''; }
{ key = ''Grave''; mods = ''Alt''; chars = ''\x1b`''; } # Alt + `
{ key = ''Grave''; mods = ''Alt|Shift''; chars = ''\x1b~''; } # Alt + ~
{ key = ''Period''; mods = ''Alt''; chars = ''\x1b.''; } # Alt + .
{ key = ''Key8''; mods = ''Alt|Shift''; chars = ''\x1b*''; } # Alt + *
{ key = ''Key3''; mods = ''Alt|Shift''; chars = ''\x1b#''; } # Alt + #
{ key = ''Period''; mods = ''Alt|Shift''; chars = ''\x1b>''; } # Alt + >
{ key = ''Comma''; mods = ''Alt|Shift''; chars = ''\x1b<''; } # Alt + <
{ key = ''Minus''; mods = ''Alt|Shift''; chars = ''\x1b_''; } # Alt + _
{ key = ''Key5''; mods = ''Alt|Shift''; chars = ''\x1b%''; } # Alt + %
{ key = ''Key6''; mods = ''Alt|Shift''; chars = ''\x1b^''; } # Alt + ^
{ key = ''Backslash''; mods = ''Alt''; chars = ''\x1b\\''; } # Alt + \
{ key = ''Backslash''; mods = ''Alt|Shift''; chars = ''\x1b|''; } # Alt + |
];
alt-arrows = [
{ key = ''Left''; mods = ''Option''; chars = ''\x1bb''; }
{ key = ''Right''; mods = ''Option''; chars = ''\x1bf''; }
];
ctrl-binds = [
# { key = ''A''; mods = ''Control''; chars = ''\x01''; }
{ key = ''A''; mods = ''Control''; chars = ''\x01''; }
{ key = ''B''; mods = ''Control''; chars = ''\x02''; }
{ key = ''C''; mods = ''Control''; chars = ''\x03''; }
{ key = ''D''; mods = ''Control''; chars = ''\x04''; }
{ key = ''E''; mods = ''Control''; chars = ''\x05''; }
{ key = ''F''; mods = ''Control''; chars = ''\x06''; }
{ key = ''G''; mods = ''Control''; chars = ''\x07''; }
{ key = ''H''; mods = ''Control''; chars = ''\x08''; }
{ key = ''I''; mods = ''Control''; chars = ''\x09''; }
{ key = ''J''; mods = ''Control''; chars = ''\x0A''; }
{ key = ''K''; mods = ''Control''; chars = ''\x0B''; }
{ key = ''L''; mods = ''Control''; chars = ''\x0C''; }
{ key = ''M''; mods = ''Control''; chars = ''\x0D''; }
{ key = ''N''; mods = ''Control''; chars = ''\x0E''; }
{ key = ''O''; mods = ''Control''; chars = ''\x0F''; }
{ key = ''P''; mods = ''Control''; chars = ''\x10''; }
{ key = ''Q''; mods = ''Control''; chars = ''\x11''; }
{ key = ''R''; mods = ''Control''; chars = ''\x12''; }
{ key = ''S''; mods = ''Control''; chars = ''\x13''; }
{ key = ''T''; mods = ''Control''; chars = ''\x14''; }
{ key = ''U''; mods = ''Control''; chars = ''\x15''; }
{ key = ''V''; mods = ''Control''; chars = ''\x16''; }
{ key = ''W''; mods = ''Control''; chars = ''\x17''; }
{ key = ''X''; mods = ''Control''; chars = ''\x18''; }
{ key = ''Y''; mods = ''Control''; chars = ''\x19''; }
{ key = ''Z''; mods = ''Control''; chars = ''\x1A''; }
{ key = ''Left''; mods = ''Alt''; chars = ''\u001bb''; }
{ key = ''Right''; mods = ''Alt''; chars = ''\u001bf''; }
];
tmux-binds = [
{ key = ''Period''; mods = ''Control''; chars = ''\x1D''; } # tmux escape
{ key = ''Period''; mods = ''Control''; chars = ''\u001D''; } # tmux escape
{ key = ''Period''; mods = ''Shift|Command''; chars = ''\x1D:''; }
{ key = ''Key0''; mods = ''Command''; chars = ''\x1D0''; }
{ key = ''Key1''; mods = ''Command''; chars = ''\x1D1''; }
{ key = ''Key2''; mods = ''Command''; chars = ''\x1D2''; }
{ key = ''Key3''; mods = ''Command''; chars = ''\x1D3''; }
{ key = ''Key4''; mods = ''Command''; chars = ''\x1D4''; }
{ key = ''Key5''; mods = ''Command''; chars = ''\x1D5''; }
{ key = ''Key6''; mods = ''Command''; chars = ''\x1D6''; }
{ key = ''Key7''; mods = ''Command''; chars = ''\x1D7''; }
{ key = ''Key8''; mods = ''Command''; chars = ''\x1D8''; }
{ key = ''Key9''; mods = ''Command''; chars = ''\x1D9''; }
{ key = ''Period''; mods = ''Shift|Command''; chars = ''\u001D:''; }
{ key = ''Key0''; mods = ''Command''; chars = ''\u001D0''; }
{ key = ''Key1''; mods = ''Command''; chars = ''\u001D1''; }
{ key = ''Key2''; mods = ''Command''; chars = ''\u001D2''; }
{ key = ''Key3''; mods = ''Command''; chars = ''\u001D3''; }
{ key = ''Key4''; mods = ''Command''; chars = ''\u001D4''; }
{ key = ''Key5''; mods = ''Command''; chars = ''\u001D5''; }
{ key = ''Key6''; mods = ''Command''; chars = ''\u001D6''; }
{ key = ''Key7''; mods = ''Command''; chars = ''\u001D7''; }
{ key = ''Key8''; mods = ''Command''; chars = ''\u001D8''; }
{ key = ''Key9''; mods = ''Command''; chars = ''\u001D9''; }
{ key = ''T''; mods = ''Command''; chars = ''\x1Dc''; }
{ key = ''R''; mods = ''Command''; chars = ''\x1D$''; }
{ key = ''W''; mods = ''Shift|Command''; chars = ''\x1D&''; } # kill window
{ key = ''W''; mods = ''Command''; chars = ''\x1Dx''; } # kill pane
{ key = ''T''; mods = ''Command''; chars = ''\u001Dc''; }
{ key = ''R''; mods = ''Command''; chars = ''\u001D$''; }
{ key = ''W''; mods = ''Shift|Command''; chars = ''\u001D&''; } # kill window
{ key = ''W''; mods = ''Command''; chars = ''\u001Dx''; } # kill pane
{ key = ''Left''; mods = ''Command''; chars = ''\x1Dp''; }
{ key = ''Right''; mods = ''Command''; chars = ''\x1Dn''; }
{ key = ''Left''; mods = ''Command''; chars = ''\u001Dp''; }
{ key = ''Right''; mods = ''Command''; chars = ''\u001Dn''; }
{ key = ''Right''; mods = ''Shift|Command''; chars = ''\x1D\x1b[C''; }
{ key = ''Left''; mods = ''Shift|Command''; chars = ''\x1D\x1b[D''; }
{ key = ''Right''; mods = ''Shift|Command''; chars = ''\u001D\u001b[C''; }
{ key = ''Left''; mods = ''Shift|Command''; chars = ''\u001D\u001b[D''; }
{ key = ''O''; mods = ''Command''; chars = ''\x1Dw''; } # ''open'', open a window
{ key = ''O''; mods = ''Command''; chars = ''\u001Dw''; } # ''open'', open a window
{ key = ''A''; mods = ''Command''; chars = ''\x1D;''; } # Last pane
{ key = ''A''; mods = ''Command''; chars = ''\u001D;''; } # Last pane
];
others = [
{ key = ''Escape''; chars = ''\x1B''; }
];
std-binds = tmux-binds;
mac-binds =
ralts
;
std-binds = alt-arrows ++ tmux-binds;
in
if bind-broken-mac-keybinds then
std-binds ++ mac-binds
else
std-binds