2017-01-07 19:16:26 +01:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
|
|
cfg = config.programs.gnome-terminal;
|
|
|
|
|
|
2020-09-28 22:56:48 +02:00
|
|
|
|
eraseBinding = types.enum [
|
|
|
|
|
"auto"
|
|
|
|
|
"ascii-backspace"
|
|
|
|
|
"ascii-delete"
|
|
|
|
|
"delete-sequence"
|
|
|
|
|
"tty"
|
|
|
|
|
];
|
|
|
|
|
|
2020-02-02 00:39:17 +01:00
|
|
|
|
backForeSubModule = types.submodule ({ ... }: {
|
|
|
|
|
options = {
|
|
|
|
|
foreground = mkOption {
|
|
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The foreground color.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
background = mkOption {
|
|
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The background color.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
profileColorsSubModule = types.submodule ({ ... }: {
|
|
|
|
|
options = {
|
|
|
|
|
foregroundColor = mkOption {
|
|
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The foreground color.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
backgroundColor = mkOption {
|
|
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The background color.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
boldColor = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The bold color, null to use same as foreground.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
palette = mkOption {
|
|
|
|
|
type = types.listOf types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The terminal palette.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
cursor = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr backForeSubModule;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The color for the terminal cursor.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
highlight = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr backForeSubModule;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The colors for the terminal’s highlighted area.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
profileSubModule = types.submodule ({ name, config, ... }: {
|
|
|
|
|
options = {
|
|
|
|
|
default = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Whether this should be the default profile.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
visibleName = mkOption {
|
|
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The profile name.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
colors = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr profileColorsSubModule;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The terminal colors, null to use system default.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
2020-04-10 15:56:47 +02:00
|
|
|
|
cursorBlinkMode = mkOption {
|
|
|
|
|
default = "system";
|
|
|
|
|
type = types.enum [ "system" "on" "off" ];
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The cursor blink mode.";
|
2020-04-10 15:56:47 +02:00
|
|
|
|
};
|
|
|
|
|
|
2020-02-02 00:39:17 +01:00
|
|
|
|
cursorShape = mkOption {
|
|
|
|
|
default = "block";
|
|
|
|
|
type = types.enum [ "block" "ibeam" "underline" ];
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The cursor shape.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
font = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The font name, null to use system default.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
allowBold = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = ''
|
2023-07-01 01:30:13 +02:00
|
|
|
|
If `true`, allow applications in the
|
2020-02-02 00:39:17 +01:00
|
|
|
|
terminal to make text boldface.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
scrollOnOutput = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Whether to scroll when output is written.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
showScrollbar = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Whether the scroll bar should be visible.";
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
scrollbackLines = mkOption {
|
|
|
|
|
default = 10000;
|
|
|
|
|
type = types.nullOr types.int;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = ''
|
2020-02-02 00:39:17 +01:00
|
|
|
|
The number of scrollback lines to keep, null for infinite.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2020-08-02 01:57:42 +02:00
|
|
|
|
|
|
|
|
|
customCommand = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = ''
|
2020-08-02 01:57:42 +02:00
|
|
|
|
The command to use to start the shell, or null for default shell.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
loginShell = mkOption {
|
|
|
|
|
default = false;
|
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Run command as a login shell.";
|
2020-08-02 01:57:42 +02:00
|
|
|
|
};
|
2020-09-28 22:56:48 +02:00
|
|
|
|
|
|
|
|
|
backspaceBinding = mkOption {
|
|
|
|
|
default = "ascii-delete";
|
|
|
|
|
type = eraseBinding;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = ''
|
2020-09-28 22:56:48 +02:00
|
|
|
|
Which string the terminal should send to an application when the user
|
2023-07-01 02:40:42 +02:00
|
|
|
|
presses the *Backspace* key.
|
|
|
|
|
|
|
|
|
|
`auto`
|
|
|
|
|
: Attempt to determine the right value from the terminal's IO settings.
|
|
|
|
|
|
|
|
|
|
`ascii-backspace`
|
|
|
|
|
: Send an ASCII backspace character (`0x08`).
|
|
|
|
|
|
|
|
|
|
`ascii-delete`
|
|
|
|
|
: Send an ASCII delete character (`0x7F`).
|
|
|
|
|
|
|
|
|
|
`delete-sequence`
|
|
|
|
|
: Send the `@7` control sequence.
|
|
|
|
|
|
|
|
|
|
`tty`
|
|
|
|
|
: Send terminal's "erase" setting.
|
2020-09-28 22:56:48 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-15 23:39:56 +02:00
|
|
|
|
boldIsBright = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Whether bold text is shown in bright colors.";
|
2021-06-15 23:39:56 +02:00
|
|
|
|
};
|
|
|
|
|
|
2020-09-28 22:56:48 +02:00
|
|
|
|
deleteBinding = mkOption {
|
|
|
|
|
default = "delete-sequence";
|
|
|
|
|
type = eraseBinding;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = ''
|
2020-09-28 22:56:48 +02:00
|
|
|
|
Which string the terminal should send to an application when the user
|
2023-07-01 02:40:42 +02:00
|
|
|
|
presses the *Delete* key.
|
|
|
|
|
|
|
|
|
|
`auto`
|
|
|
|
|
: Send the `@7` control sequence.
|
|
|
|
|
|
|
|
|
|
`ascii-backspace`
|
|
|
|
|
: Send an ASCII backspace character (`0x08`).
|
|
|
|
|
|
|
|
|
|
`ascii-delete`
|
|
|
|
|
: Send an ASCII delete character (`0x7F`).
|
|
|
|
|
|
|
|
|
|
`delete-sequence`
|
|
|
|
|
: Send the `@7` control sequence.
|
|
|
|
|
|
|
|
|
|
`tty`
|
|
|
|
|
: Send terminal's "erase" setting.
|
2020-09-28 22:56:48 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
2020-12-27 16:09:59 +01:00
|
|
|
|
|
|
|
|
|
audibleBell = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Turn on/off the terminal's bell.";
|
2020-12-27 16:09:59 +01:00
|
|
|
|
};
|
2021-06-15 23:39:56 +02:00
|
|
|
|
|
|
|
|
|
transparencyPercent = mkOption {
|
|
|
|
|
default = null;
|
|
|
|
|
type = types.nullOr (types.ints.between 0 100);
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Background transparency in percent.";
|
2021-06-15 23:39:56 +02:00
|
|
|
|
};
|
2020-02-02 00:39:17 +01:00
|
|
|
|
};
|
|
|
|
|
});
|
2017-01-07 19:16:26 +01:00
|
|
|
|
|
|
|
|
|
buildProfileSet = pcfg:
|
|
|
|
|
{
|
2020-12-27 16:09:59 +01:00
|
|
|
|
audible-bell = pcfg.audibleBell;
|
2017-01-07 19:16:26 +01:00
|
|
|
|
visible-name = pcfg.visibleName;
|
2021-06-15 23:39:56 +02:00
|
|
|
|
scroll-on-output = pcfg.scrollOnOutput;
|
2017-01-07 19:16:26 +01:00
|
|
|
|
scrollbar-policy = if pcfg.showScrollbar then "always" else "never";
|
|
|
|
|
scrollback-lines = pcfg.scrollbackLines;
|
|
|
|
|
cursor-shape = pcfg.cursorShape;
|
2020-04-10 15:56:47 +02:00
|
|
|
|
cursor-blink-mode = pcfg.cursorBlinkMode;
|
2020-08-02 01:57:42 +02:00
|
|
|
|
login-shell = pcfg.loginShell;
|
2020-09-28 22:56:48 +02:00
|
|
|
|
backspace-binding = pcfg.backspaceBinding;
|
|
|
|
|
delete-binding = pcfg.deleteBinding;
|
2020-08-02 01:57:42 +02:00
|
|
|
|
} // (if (pcfg.customCommand != null) then {
|
|
|
|
|
use-custom-command = true;
|
|
|
|
|
custom-command = pcfg.customCommand;
|
|
|
|
|
} else {
|
|
|
|
|
use-custom-command = false;
|
|
|
|
|
}) // (if (pcfg.font == null) then {
|
2020-02-02 00:39:17 +01:00
|
|
|
|
use-system-font = true;
|
|
|
|
|
} else {
|
|
|
|
|
use-system-font = false;
|
|
|
|
|
font = pcfg.font;
|
|
|
|
|
}) // (if (pcfg.colors == null) then {
|
|
|
|
|
use-theme-colors = true;
|
|
|
|
|
} else
|
|
|
|
|
({
|
|
|
|
|
use-theme-colors = false;
|
|
|
|
|
foreground-color = pcfg.colors.foregroundColor;
|
|
|
|
|
background-color = pcfg.colors.backgroundColor;
|
|
|
|
|
palette = pcfg.colors.palette;
|
|
|
|
|
} // optionalAttrs (pcfg.allowBold != null) {
|
|
|
|
|
allow-bold = pcfg.allowBold;
|
|
|
|
|
} // (if (pcfg.colors.boldColor == null) then {
|
|
|
|
|
bold-color-same-as-fg = true;
|
|
|
|
|
} else {
|
|
|
|
|
bold-color-same-as-fg = false;
|
|
|
|
|
bold-color = pcfg.colors.boldColor;
|
2021-06-15 23:39:56 +02:00
|
|
|
|
}) // optionalAttrs (pcfg.boldIsBright != null) {
|
|
|
|
|
bold-is-bright = pcfg.boldIsBright;
|
|
|
|
|
} // (if (pcfg.colors.cursor != null) then {
|
2020-02-02 00:39:17 +01:00
|
|
|
|
cursor-colors-set = true;
|
|
|
|
|
cursor-foreground-color = pcfg.colors.cursor.foreground;
|
|
|
|
|
cursor-background-color = pcfg.colors.cursor.background;
|
|
|
|
|
} else {
|
|
|
|
|
cursor-colors-set = false;
|
|
|
|
|
}) // (if (pcfg.colors.highlight != null) then {
|
|
|
|
|
highlight-colors-set = true;
|
|
|
|
|
highlight-foreground-color = pcfg.colors.highlight.foreground;
|
|
|
|
|
highlight-background-color = pcfg.colors.highlight.background;
|
|
|
|
|
} else {
|
|
|
|
|
highlight-colors-set = false;
|
2021-06-15 23:39:56 +02:00
|
|
|
|
}) // optionalAttrs (pcfg.transparencyPercent != null) {
|
|
|
|
|
background-transparency-percent = pcfg.transparencyPercent;
|
|
|
|
|
use-theme-transparency = false;
|
|
|
|
|
use-transparent-background = true;
|
|
|
|
|
}));
|
2020-02-02 00:39:17 +01:00
|
|
|
|
|
|
|
|
|
in {
|
2021-06-15 23:39:56 +02:00
|
|
|
|
meta.maintainers = with maintainers; [ kamadorueda rycee ];
|
2017-09-26 23:40:31 +02:00
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
|
options = {
|
|
|
|
|
programs.gnome-terminal = {
|
2023-07-02 01:45:18 +02:00
|
|
|
|
enable = mkEnableOption "Gnome Terminal";
|
2017-01-07 19:16:26 +01:00
|
|
|
|
|
|
|
|
|
showMenubar = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
type = types.bool;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "Whether to show the menubar by default";
|
2017-01-07 19:16:26 +01:00
|
|
|
|
};
|
|
|
|
|
|
2019-02-24 05:53:46 +01:00
|
|
|
|
themeVariant = mkOption {
|
|
|
|
|
default = "default";
|
2020-05-10 16:20:40 +02:00
|
|
|
|
type = types.enum [ "default" "light" "dark" "system" ];
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "The theme variation to request";
|
2019-02-24 05:53:46 +01:00
|
|
|
|
};
|
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
|
profile = mkOption {
|
2020-02-02 00:39:17 +01:00
|
|
|
|
default = { };
|
2017-05-10 00:20:15 +02:00
|
|
|
|
type = types.attrsOf profileSubModule;
|
2023-07-02 01:45:18 +02:00
|
|
|
|
description = "A set of Gnome Terminal profiles.";
|
2017-01-07 19:16:26 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2021-05-30 22:47:03 +02:00
|
|
|
|
home.packages = [ pkgs.gnome.gnome-terminal ];
|
2017-01-10 00:35:54 +01:00
|
|
|
|
|
2020-02-02 00:39:17 +01:00
|
|
|
|
dconf.settings = let dconfPath = "org/gnome/terminal/legacy";
|
|
|
|
|
in {
|
|
|
|
|
"${dconfPath}" = {
|
|
|
|
|
default-show-menubar = cfg.showMenubar;
|
|
|
|
|
theme-variant = cfg.themeVariant;
|
|
|
|
|
schema-version = 3;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
"${dconfPath}/profiles:" = {
|
|
|
|
|
default = head (attrNames (filterAttrs (n: v: v.default) cfg.profile));
|
|
|
|
|
list = attrNames cfg.profile;
|
|
|
|
|
};
|
|
|
|
|
} // mapAttrs'
|
|
|
|
|
(n: v: nameValuePair ("${dconfPath}/profiles:/:${n}") (buildProfileSet v))
|
|
|
|
|
cfg.profile;
|
2019-01-03 16:35:15 +01:00
|
|
|
|
|
2020-06-14 12:20:12 +02:00
|
|
|
|
programs.bash.enableVteIntegration = true;
|
|
|
|
|
programs.zsh.enableVteIntegration = true;
|
2017-01-07 19:16:26 +01:00
|
|
|
|
};
|
|
|
|
|
}
|