From ffa13a9b9cda0c012d9d3793412104bb10c79ebe Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 14 Apr 2026 22:08:01 +0200 Subject: alacritty --- accounts/gkleen@sif/default.nix | 13 +++++++++++++ accounts/gkleen@sif/niri.nix | 21 +++++++++++++-------- accounts/gkleen@sif/systemd.nix | 28 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 8 deletions(-) (limited to 'accounts') diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index f4a121c4..ccb772e9 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix @@ -345,6 +345,19 @@ in { "kitty_mod+t" = "new_tab_with_cwd"; }; }; + alacritty = { + enable = true; + theme = "kitty"; + settings = { + font = { + normal = { + family = "Fira Mono"; + style = "Medium"; + }; + size = 10; + }; + }; + }; fuzzel = { enable = true; settings = { diff --git a/accounts/gkleen@sif/niri.nix b/accounts/gkleen@sif/niri.nix index 80abfc1a..a27b4137 100644 --- a/accounts/gkleen@sif/niri.nix +++ b/accounts/gkleen@sif/niri.nix @@ -6,7 +6,8 @@ let sleaf = name: arg: kdl.node name [arg] []; niri = cfg.package; - terminal = lib.getExe config.programs.kitty.package; + spawnTerminal = { command ? lib.getExe config.programs.zsh.package, extraArgs ? [] }: + [(lib.getExe config.programs.alacritty.package) "msg" "--socket" "/run/user/1000/alacritty.sock" "create-window"] ++ lib.toList extraArgs ++ ["--command" (lib.getExe' hostConfig.systemd.package "systemd-run") "--user" "--pty" "--same-dir" "--wait" "--collect" "--quiet" "--service-type=exec" "--expand-environment=no"] ++ lib.toList command; focus_or_spawn = pkgs.writeShellApplication { name = "focus-or-spawn"; @@ -425,8 +426,8 @@ in { } { name = "term"; key = "Mod+Control+Return"; - app-id = "kitty-scratch"; - spawn = [ "kitty" "--app-id" "kitty-scratch" ]; + app-id = "alacritty-scratch"; + spawn = spawnTerminal { extraArgs = ["--class" "alacritty-scratch"]; }; } { name = "edit"; match = [ { title = "^scratch$"; app-id = "^emacs$"; } ]; @@ -656,7 +657,8 @@ in { ]) (plain "window-rule" [ (sleaf "match" { app-id = "^kitty$"; }) - (sleaf "match" { app-id = "^kitty-play$"; }) + (sleaf "match" { app-id = "^alacritty$"; }) + (sleaf "match" { app-id = "^(kitty|alacritty)-play$"; }) (plain "default-column-width" [(sleaf "proportion" (1. / 3.))]) ]) @@ -677,7 +679,7 @@ in { (plain "default-column-width" [(sleaf "proportion" 1.)]) ]) (plain "window-rule" [ - (sleaf "match" { app-id = "^kitty-play$"; }) + (sleaf "match" { app-id = "^(kitty|alacritty)-play$"; }) (sleaf "open-on-workspace" "vid") (sleaf "open-focused" false) ]) @@ -754,7 +756,7 @@ in { (lib.mapAttrsToList bind (with config.lib.niri.actions; { "Mod+Slash".action = show-hotkey-overlay; - "Mod+Return".action = spawn terminal; + "Mod+Return".action = spawn (spawnTerminal {}); "Mod+Shift+Return".action = let nushellKitty = pkgs.symlinkJoin { @@ -784,9 +786,12 @@ in { })); "Mod+Alt+L".action = spawn (lib.getExe (pkgs.writeShellApplication { name = "queue-yt-dlp"; - runtimeInputs = with pkgs; [ wl-clipboard-rs config.programs.kitty.package ]; + runtimeInputs = with pkgs; [ wl-clipboard-rs ]; text = '' - exec -- kitty --app-id kitty-play --directory "$HOME"/media mpv "$(wl-paste)" + exec -- ${lib.concatStringsSep " " (spawnTerminal { + extraArgs = [ "--class" "alacritty-play" "--working-directory" "\"$HOME\"/media" ]; + command = ["mpv" "\"$(wl-paste)\""]; + })} ''; })); "Mod+Alt+M".action = spawn (lib.getExe' pkgs.screen-message "sm") "-n" "Fira Mono" "-a" "1" "-f" "#fff" "-b" "#000"; diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index 51671b20..2ccbaea0 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix @@ -389,6 +389,25 @@ in { WantedBy = lib.mkForce ["tray.target"]; }; }; + alacritty = { + Unit = { + Requisite = ["graphical-session.target"]; + After = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${lib.getExe pkgs.alacritty} --daemon --socket %t/alacritty-activated.sock"; + }; + }; + alacritty-proxy = { + Unit = { + Requires = ["alacritty.service" "alacritty-proxy.socket"]; + After = ["alacritty.service" "alacritty-proxy.socket"]; + }; + Service = { + Type = "notify"; + ExecStart = "${config.systemd.package}/lib/systemd/systemd-socket-proxyd %t/alacritty-activated.sock"; + }; + }; } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { Unit = { BindsTo = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; @@ -433,6 +452,15 @@ in { WantedBy = ["sockets.target"]; }; }; + "alacritty-proxy" = { + Socket = { + SocketMode = "0600"; + ListenStream = "%t/alacritty.sock"; + }; + Install = { + WantedBy = ["sockets.target"]; + }; + }; }; timers = { "sync-keepass@store.kdbx" = { -- cgit v1.2.3