From 0430bc98787ebf6361095d911e5d6a539fb15bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sun, 21 Jan 2024 21:09:39 +0100 Subject: [PATCH] fix(sway): Change default terminal to alacritty Wezterm doesn't work well in sway-git --- home/gui/default.nix | 3 ++- home/gui/sway-config.nix | 11 +++++++++-- home/options.nix | 24 +++++++++++++++--------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/home/gui/default.nix b/home/gui/default.nix index 703b459..abd9e81 100644 --- a/home/gui/default.nix +++ b/home/gui/default.nix @@ -37,13 +37,14 @@ in programs.waybar.systemd.enable = true; programs.waybar.settings = import ./waybar-settings.nix { inherit config lib; }; # Terminal - programs.wezterm.enable = true; + programs.wezterm.enable = cfg.terminal == "wezterm"; programs.wezterm.extraConfig = '' config = {} config.hide_tab_bar_if_only_one_tab = true config.window_padding = { left = 1, right = 1, top = 1, bottom = 1 } return config ''; + programs.alacritty.enable = cfg.terminal == "alacritty"; # PDF reader programs.zathura.enable = true; # Auto start sway diff --git a/home/gui/sway-config.nix b/home/gui/sway-config.nix index c3ce7fc..4db5782 100644 --- a/home/gui/sway-config.nix +++ b/home/gui/sway-config.nix @@ -2,8 +2,15 @@ let cfg = config.jhome.gui.sway; modifier = "Mod4"; - terminal = "wezterm"; - menu = "${pkgs.fuzzel}/bin/fuzzel --terminal 'wezterm start'"; + terminal = config.jhome.gui.terminal; + termCmd = + if terminal == "wezterm" then + "wezterm start" + else if terminal == "alacritty" then + "alacritty -e" + else + builtins.abort "no command configured for ${terminal}"; + menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'"; # currently, there is some friction between sway and gtk: # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland # the suggested way to set gtk settings is with gsettings diff --git a/home/options.nix b/home/options.nix index a24641a..770807a 100644 --- a/home/options.nix +++ b/home/options.nix @@ -32,14 +32,14 @@ let tempInfo.options.hwmon-path = lib.mkOption { description = "Path to the hardware sensor whose temperature to monitor."; - type = lib.types.str; + type = types.str; example = "/sys/class/hwmon/hwmon2/temp1_input"; }; sway.options = { background = lib.mkOption { description = lib.mdDoc "The wallpaper to use."; - type = lib.types.path; + type = types.path; default = builtins.fetchurl { url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png"; sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc"; @@ -54,24 +54,24 @@ let you can switch TTYs when logging in by using CTRL+ALT+F2 (for TTY2, F3 for TTY3, etc). ''; - type = lib.types.bool; + type = types.bool; default = true; example = false; }; exec = lib.mkOption { description = "Run commands when starting sway."; default = { }; - type = lib.types.submodule { + type = types.submodule { options = { once = lib.mkOption { description = lib.mdDoc "Programs to start only once (`exec`)."; - type = lib.types.listOf lib.types.str; + type = types.listOf types.str; default = [ ]; example = [ "signal-desktop --start-in-tray" ]; }; always = lib.mkOption { description = lib.mdDoc "Programs to start whenever the config is sourced (`exec_always`)."; - type = lib.types.listOf lib.types.str; + type = types.listOf types.str; default = [ ]; example = [ "signal-desktop --start-in-tray" ]; }; @@ -85,12 +85,18 @@ let tempInfo = lib.mkOption { description = lib.mdDoc "Temperature info to display in the statusbar."; default = null; - type = lib.types.nullOr (lib.types.submodule tempInfo); + type = types.nullOr (types.submodule tempInfo); }; sway = lib.mkOption { description = "Sway window manager configuration."; default = { }; - type = lib.types.submodule sway; + type = types.submodule sway; + }; + terminal = lib.mkOption { + description = "The terminal emulator to use."; + default = "alacritty"; + example = "wezterm"; + type = types.enum [ "wezterm" "alacritty" ]; }; }; in @@ -128,7 +134,7 @@ in gui = lib.mkOption { description = lib.mdDoc "Jalil's default GUI configuration."; default = { }; - type = lib.types.submodule gui; + type = types.submodule gui; }; }; };