Skip to content

Commit

Permalink
Kitty: switching terminals (incomp. theme)
Browse files Browse the repository at this point in the history
  • Loading branch information
Icy-Thought committed Mar 10, 2024
1 parent f9f1df5 commit 27d1520
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 35 deletions.
18 changes: 7 additions & 11 deletions config/kitty/catppuccin-bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
SYMBOL_BG = as_rgb(int("96cdfb", 16))


def _draw_icon(screen: Screen, index: int, symbol: str = "") -> int:
def draw_icon(screen: Screen, index: int, symbol: str = "") -> int:
if index != 1:
return 0
return screen.cursor.x

cells = [
(SYMBOL_FG, SYMBOL_BG, symbol),
Expand All @@ -35,15 +35,14 @@ def _draw_icon(screen: Screen, index: int, symbol: str = "") -> int:

for fg, bg, cell in cells:
restore_fg, restore_bg = screen.cursor.fg, screen.cursor.bg
screen.cursor.fg = fg
screen.cursor.bg = bg
screen.cursor.fg, screen.cursor.bg = fg, bg
screen.draw(cell)
screen.cursor.fg, screen.cursor.bg = restore_fg, restore_bg

return screen.cursor.x


def _draw_right_status(screen: Screen, is_last: bool) -> int:
def draw_right_status(screen: Screen, is_last: bool) -> int:
if not is_last:
return screen.cursor.x

Expand All @@ -66,9 +65,9 @@ def _draw_right_status(screen: Screen, is_last: bool) -> int:
screen.cursor.fg = fg
screen.cursor.bg = bg
screen.draw(cell)

screen.cursor.fg = 0
screen.cursor.bg = 0

screen.cursor.x = max(screen.cursor.x, screen.columns - right_status_length)
return screen.cursor.x

Expand All @@ -83,12 +82,9 @@ def draw_tab(
is_last: bool,
extra_data: ExtraData,
) -> int:
_draw_icon(screen, index, symbol=SYMBOL)
draw_icon(screen, index, symbol=SYMBOL)
end = draw_tab_with_powerline(
draw_data, screen, tab, before, max_title_length, index, is_last, extra_data
)
_draw_right_status(
screen,
is_last,
)
draw_right_status(screen, is_last)
return end
2 changes: 1 addition & 1 deletion config/xmonad/xmonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ main =

myConfig =
def { modMask = mod4Mask
, terminal = "alacritty"
, terminal = "kitty"
, manageHook = namedScratchpadManageHook =<< liftX myScratchpads
, layoutHook = myLayoutHook
, borderWidth = 2
Expand Down
4 changes: 2 additions & 2 deletions hosts/thinkpad-e595/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
desktop = {
xmonad.enable = true;
terminal = {
default = "alacritty";
alacritty.enable = true;
default = "kitty";
kitty.enable = true;
};
editors = {
default = "emacsclient";
Expand Down
37 changes: 16 additions & 21 deletions modules/desktop/terminal/kitty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
pkgs,
...
}: let
inherit (builtins) toString;
inherit (builtins) concatStringsSep toString;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.modules) mkIf mkMerge;
in {
options.modules.desktop.terminal.kitty = let
Expand All @@ -17,19 +18,21 @@ in {
enable = true;
settings = {
term = "xterm-kitty";
repaint_delay = 10;
update_check_interval = 0;

sync_to_monitor = "yes";
update_check_interval = 0;
allow_remote_control = "no";
close_on_child_death = "no";
shell_integration = "no-cursor";
confirm_os_window_close = -1;

background_opacity = "0.8";
repaint_delay = 10;
disable_ligatures = "cursor";
adjust_line_height = "113%";
inactive_text_alpha = "1.0";
disable_ligatures = "cursor";
modify_font = concatStringsSep " " (mapAttrsToList (name: value: "${name} ${value}") {
cell_height = "110%";
});

enable_audio_bell = "no";
bell_on_tab = "no";
Expand Down Expand Up @@ -59,25 +62,17 @@ in {
scrollback_lines = 5000;
wheel_scroll_multiplier = 5;

initial_window_height = 28;
initial_window_width = 96;
remember_window_size = "yes";
resize_draw_strategy = "static";

window_border_width = 1;
window_margin_width = 0;
window_padding_width = 15;
window_padding_width = 10;
placement_strategy = "top-left";
draw_minimal_borders = "yes";

tab_bar_style = "custom";
tab_separator = ''""'';
tab_fade = "0 0 0 0";
tab_activity_symbol = "none";
tab_bar_edge = "top";
tab_bar_margin_height = "0.0 0.0";
active_tab_font_style = "bold-italic";
inactive_tab_font_style = "normal";
active_tab_font_style = "bold";
inactive_tab_font_style = "bold-italic";
tab_bar_min_tabs = 1;
};

Expand Down Expand Up @@ -119,11 +114,11 @@ in {
inherit (config.modules.themes.colors.main) bright normal types;
inherit (config.modules.themes.font.mono) size;
in ''
font_family Victor Mono SemiBold Nerd Font Complete
italic_font Victor Mono SemiBold Italic Nerd Font Complete
font_family VictorMono NF Medium
italic_font VictorMono NF Medium Italic
bold_font Victor Mono Bold Nerd Font Complete
bold_italic_font Victor Mono Bold Italic Nerd Font Complete
bold_font VictorMono NF SemiBold
bold_italic_font VictorMono NF SemiBold Italic
font_size ${toString size}
Expand All @@ -139,7 +134,7 @@ in {
inactive_tab_foreground ${types.fg}
inactive_tab_background ${types.bg}
selection_f oreground ${types.bg}
selection_foreground ${types.bg}
selection_background ${types.highlight}
color0 ${normal.black}
Expand Down

0 comments on commit 27d1520

Please sign in to comment.