From c1c31463117c87fb1fb53ff33cb08096211a2f44 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 12 Feb 2023 16:43:55 +0000 Subject: [PATCH 1/7] home: zsh: always enable VTE integration --- home/zsh/default.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/home/zsh/default.nix b/home/zsh/default.nix index bd26903..646b6e3 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -84,11 +84,8 @@ in reset-agent = "gpg-connect-agent updatestartuptty /bye"; }; - # Enable VTE integration when using one of the affected shells - enableVteIntegration = - builtins.any (name: config.my.home.terminal.program == name) [ - "termite" - ]; + # Enable VTE integration + enableVteIntegration = true; }; # Fuzzy-wuzzy From d25922ef15dc628c4502fb236d9af8b041b19fcb Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 12 Feb 2023 16:46:18 +0000 Subject: [PATCH 2/7] home: packages: remove 'termite.terminfo' --- home/packages/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/home/packages/default.nix b/home/packages/default.nix index 84c1253..0cfa3b3 100644 --- a/home/packages/default.nix +++ b/home/packages/default.nix @@ -22,6 +22,5 @@ in file mosh ripgrep - termite.terminfo ] ++ cfg.additionalPackages); } From b6bbe5a01e5ea0a88865cfca6695ee7f60a75024 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 12 Feb 2023 16:53:18 +0000 Subject: [PATCH 3/7] home: firefox: tridactyl: move cursor in editor This means that the cursor in vim will be in the same position as the one in the input form. --- home/firefox/tridactyl/tridactylrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/firefox/tridactyl/tridactylrc b/home/firefox/tridactyl/tridactylrc index 711bf6f..4dbf7bb 100644 --- a/home/firefox/tridactyl/tridactylrc +++ b/home/firefox/tridactyl/tridactylrc @@ -6,7 +6,7 @@ colorscheme dark " Make tridactyl open Vim in my prefered terminal " FIXME: make it follow my prefered terminal -set editorcmd termite --class tridactyl_editor -e 'vim %f' +set editorcmd termite --class tridactyl_editor -e "vim %f '+normal!%lGzv%c|'" " }}} " Binds {{{ From f89e10fdca81564754f3007015282d7d807d49a2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 12 Feb 2023 16:46:49 +0000 Subject: [PATCH 4/7] home: terminal: add alacritty --- home/terminal/alacritty/default.nix | 57 +++++++++++++++++++++++++++++ home/terminal/default.nix | 3 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 home/terminal/alacritty/default.nix diff --git a/home/terminal/alacritty/default.nix b/home/terminal/alacritty/default.nix new file mode 100644 index 0000000..a729d79 --- /dev/null +++ b/home/terminal/alacritty/default.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.home.terminal; +in +{ + config = lib.mkIf (cfg.program == "alacritty") { + programs.alacritty = { + enable = true; + + settings = { + env = { + # DPI scaling means the font is way too big otherwise + WINIT_X11_SCALE_FACTOR = "1.0"; + }; + + font = { + size = 9; + }; + + colors = { + primary = { + background = cfg.colors.background; + foreground = cfg.colors.foreground; + + bright_foreground = cfg.colors.foregroundBold; + }; + + cursor = { + cursor = cfg.colors.cursor; + }; + + normal = { + black = cfg.colors.black; + red = cfg.colors.red; + green = cfg.colors.green; + yellow = cfg.colors.yellow; + blue = cfg.colors.blue; + magenta = cfg.colors.magenta; + cyan = cfg.colors.cyan; + white = cfg.colors.white; + }; + + bright = { + black = cfg.colors.blackBold; + red = cfg.colors.redBold; + green = cfg.colors.greenBold; + yellow = cfg.colors.yellowBold; + blue = cfg.colors.blueBold; + magenta = cfg.colors.magentaBold; + cyan = cfg.colors.cyanBold; + white = cfg.colors.whiteBold; + }; + }; + }; + }; + }; +} diff --git a/home/terminal/default.nix b/home/terminal/default.nix index 68ff44e..20f36b5 100644 --- a/home/terminal/default.nix +++ b/home/terminal/default.nix @@ -10,13 +10,14 @@ let in { imports = [ + ./alacritty ./termite ]; options.my.home = with lib; { terminal = { program = mkOption { - type = with types; nullOr (enum [ "termite" ]); + type = with types; nullOr (enum [ "alacritty" "termite" ]); default = null; example = "termite"; description = "Which terminal to use for home session"; From 4f883b019832ddecd883b60004c22efe4c6a2202 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 12 Feb 2023 17:12:19 +0000 Subject: [PATCH 5/7] home: terminal: remove DPI workaround And instead change the font size to be *about* right. --- home/terminal/alacritty/default.nix | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/home/terminal/alacritty/default.nix b/home/terminal/alacritty/default.nix index a729d79..760162a 100644 --- a/home/terminal/alacritty/default.nix +++ b/home/terminal/alacritty/default.nix @@ -8,13 +8,8 @@ in enable = true; settings = { - env = { - # DPI scaling means the font is way too big otherwise - WINIT_X11_SCALE_FACTOR = "1.0"; - }; - font = { - size = 9; + size = 5.5; }; colors = { From e8a46ae2487a6289946076aa0b9f6d0c860489e3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 12 Feb 2023 17:33:45 +0000 Subject: [PATCH 6/7] home: firefox: tridactyl: use preferred terminal Thankfully, alacritty and termite both use the same command line arguments for this. If I ever want to use another one, I might have to make the logic a bit more robust. --- home/firefox/tridactyl/default.nix | 15 +++++++++++++-- home/firefox/tridactyl/tridactylrc | 3 +-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/home/firefox/tridactyl/default.nix b/home/firefox/tridactyl/default.nix index fd8e3fb..2a37d26 100644 --- a/home/firefox/tridactyl/default.nix +++ b/home/firefox/tridactyl/default.nix @@ -1,9 +1,20 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let cfg = config.my.home.firefox.tridactyl; in { config = lib.mkIf cfg.enable { - xdg.configFile."tridactyl/tridactylrc".source = ./tridactylrc; + xdg.configFile."tridactyl/tridactylrc".source = pkgs.substituteAll { + src = ./tridactylrc; + + editorcmd = lib.concatStringsSep " " [ + # Use my configured terminal + config.my.home.terminal.program + # Make it easy to pick out with a window class name + "--class tridactyl_editor" + # Open vim with the cursor in the correct position + ''-e "vim %f '+normal!%lGzv%c|'"'' + ]; + }; }; } diff --git a/home/firefox/tridactyl/tridactylrc b/home/firefox/tridactyl/tridactylrc index 4dbf7bb..200b74e 100644 --- a/home/firefox/tridactyl/tridactylrc +++ b/home/firefox/tridactyl/tridactylrc @@ -5,8 +5,7 @@ colorscheme dark " Make tridactyl open Vim in my prefered terminal -" FIXME: make it follow my prefered terminal -set editorcmd termite --class tridactyl_editor -e "vim %f '+normal!%lGzv%c|'" +set editorcmd @editorcmd@ " }}} " Binds {{{ From b4d050a5f89ebd9e56c68a17368a43f0aae96a4f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 12 Feb 2023 17:35:14 +0000 Subject: [PATCH 7/7] machines: aramis: home: migrate to 'alacritty' --- machines/aramis/home.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/machines/aramis/home.nix b/machines/aramis/home.nix index bac77f4..cdacf04 100644 --- a/machines/aramis/home.nix +++ b/machines/aramis/home.nix @@ -23,8 +23,8 @@ mpv.enable = true; # Network-Manager applet nm-applet.enable = true; - # Termite terminal - terminal.program = "termite"; + # Terminal + terminal.program = "alacritty"; # Zathura document viewer zathura.enable = true; };