Skip to content

Commit

Permalink
home-manage/destkop: move home-manager/{kitty,xterm}
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Sep 28, 2023
1 parent 2a6da56 commit 046816c
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 181 deletions.
2 changes: 0 additions & 2 deletions home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
./desktop
./emacs
./i3
./kitty.nix
./meta
./mpv
./nixpkgs.nix
./non-nix.nix
./sway
./theme
./xterm.nix
];

systemd.user.startServices = "sd-switch";
Expand Down
2 changes: 2 additions & 0 deletions home-manager/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
imports = [
./chromium.nix
./firefox.nix
./kitty.nix
./xterm.nix
];

options.home-manager.desktop.enable = lib.mkDefaultOption "desktop config";
Expand Down
98 changes: 98 additions & 0 deletions home-manager/desktop/kitty.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{ config, pkgs, lib, ... }:

{
options.home-manager.desktop.kitty.enable = lib.mkEnableOption "Kitty config" // {
default = config.home-manager.desktop.enable;
};

config = lib.mkIf config.home-manager.desktop.kitty.enable {
programs.kitty = {
enable = true;
keybindings = { "ctrl+shift+0" = "change_font_size all 0"; };
font = {
package = (pkgs.nerdfonts.override { fonts = [ "Hack" ]; });
name = "Hack Nerd Font";
};
settings = with config.theme.colors; {
# Font
font_size = "12.0";

# Colors
foreground = base05;
background = base00;
selection_background = base02;
selection_foreground = base05;
url_color = base04;
cursor = base05;
active_border_color = base01;
inactive_border_color = base03;
active_tab_background = base01;
active_tab_foreground = base04;
inactive_tab_background = base00;
inactive_tab_foreground = base05;
tab_bar_background = base00;
color0 = base00;
color1 = base08;
color2 = base0B;
color3 = base0A;
color4 = base0D;
color5 = base0E;
color6 = base0C;
color7 = base05;
color8 = base02;
color9 = base09;
color10 = base01;
color11 = base03;
color12 = base04;
color13 = base06;
color14 = base0F;
color15 = base07;

# Scrollback
scrollback_lines = 10000;
scrollback_pager = "${pkgs.page}/bin/page -f";

# Reduce lag
sync_to_monitor = false;
repaint_delay = 10;
input_delay = 0;

# Bell
visual_bell_duration = "0.0";
enable_audio_bell = false;
window_alert_on_bell = true;
bell_on_tab = true;

# Misc
editor =
if config.programs.neovim.enable then
"${config.programs.neovim.finalPackage}/bin/nvim"
else
"${pkgs.neovim}/bin/nvim";
strip_trailing_spaces = "smart";
clipboard_control =
"write-clipboard write-primary read-clipboard read-primary";
background_opacity = "0.9";

# Fix for Wayland slow scrolling
touch_scroll_multiplier = "5.0";

# For nnn
allow_remote_control = lib.mkIf config.programs.nnn.enable true;
listen_on = "unix:/tmp/kitty";
};
};

programs.zsh.initExtra = lib.mkIf config.programs.zsh.enable ''
# Do not enable those alias in non-kitty terminal
if [[ "$TERM" == "xterm-kitty" ]]; then
alias copy="kitty +kitten clipboard"
alias d="kitty +kitten diff"
alias icat="kitty +kitten icat"
alias paste="kitty +kitten clipboard --get-clipboard"
alias ssh="kitty +kitten ssh $@"
alias ssh-compat="TERM=xterm-256color \ssh"
fi
'';
};
}
93 changes: 93 additions & 0 deletions home-manager/desktop/xterm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{ config, pkgs, lib, ... }:

{
options.home-manager.desktop.xterm.enable = lib.mkEnableOption "Xterm config" // {
default = config.home-manager.desktop.enable;
};

config = lib.mkIf config.home-manager.desktop.xterm.enable {
home.packages = with pkgs; [ hack-font xterm ];

xresources.extraConfig = with config.theme.colors; ''
#define base00 ${base00}
#define base01 ${base01}
#define base02 ${base02}
#define base03 ${base03}
#define base04 ${base04}
#define base05 ${base05}
#define base06 ${base06}
#define base07 ${base07}
#define base08 ${base08}
#define base09 ${base09}
#define base0A ${base0A}
#define base0B ${base0B}
#define base0C ${base0C}
#define base0D ${base0D}
#define base0E ${base0E}
#define base0F ${base0F}
*foreground: base05
#ifdef background_opacity
*background: [background_opacity]base00
#else
*background: base00
#endif
*cursorColor: base05
*color0: base00
*color1: base08
*color2: base0B
*color3: base0A
*color4: base0D
*color5: base0E
*color6: base0C
*color7: base05
*color8: base03
*color9: base08
*color10: base0B
*color11: base0A
*color12: base0D
*color13: base0E
*color14: base0C
*color15: base07
! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt),
! use 'shell' template to set these if necessary
*color16: base09
*color17: base0F
*color18: base01
*color19: base02
*color20: base04
*color21: base06
! UXterm config
UXTerm.termName: xterm-256color
UXTerm.vt100.metaSendsEscape: true
UXTerm.vt100.backarrowKey: false
UXTerm.vt100.saveLines: 4096
UXTerm.vt100.bellIsUrgent: true
UXTerm.ttyModes: erase ^?
UXTerm.vt100.translations: #override \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD)
UXTerm.vt100.faceName: Hack:size=12
! Xterm config
XTerm.termName: xterm-256color
XTerm.vt100.metaSendsEscape: true
XTerm.vt100.backarrowKey: false
XTerm.vt100.saveLines: 4096
XTerm.vt100.bellIsUrgent: true
XTerm.ttyModes: erase ^?
XTerm.vt100.translations: #override \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD)
XTerm.vt100.faceName: Hack:size=12
'';
};
}
92 changes: 0 additions & 92 deletions home-manager/kitty.nix

This file was deleted.

87 changes: 0 additions & 87 deletions home-manager/xterm.nix

This file was deleted.

0 comments on commit 046816c

Please sign in to comment.