fish and wezterm

This commit is contained in:
Keisuke Hirata 2026-01-04 01:49:46 +09:00
parent d9d7402234
commit 9129863969
8 changed files with 151 additions and 3 deletions

View File

@ -25,11 +25,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1767391542, "lastModified": 1767437240,
"narHash": "sha256-qHXxJuFkQhggyeao/kQb6KcOjgz0Ky+ArfowRX1MHaE=", "narHash": "sha256-OA0dBHhccdupFXp+/eaFfb8K1dQxk61in4aF5ITGVX8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2f06b726061b7e1aa69f718e943da9ffcecd6397", "rev": "1cfa305fba94468f665de1bd1b62dddf2e0cb012",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -0,0 +1,6 @@
{ ... }:
{
programs.fish.enable = true;
xdg.configFile."fish/functions/fish_prompt.fish".source = ./functions/fish_prompt.fish;
}

View File

@ -0,0 +1,41 @@
function preexec --on-event fish_preexec
set -g _play_command_begin_time (date +%s%3N)
end
function postexec --on-event fish_postexec
set -l _status $status
if test -z $_play_command_begin_time
return
end
set -l code
if test $_status -eq 0
set_color green
set code "✔success:$_status"
else
set_color red
set code "✘error:$_status"
end
set -l took_time
set -l millis (echo (date +%s%3N)"-$_play_command_begin_time" | bc)
if test $millis -ge 10000
set took_time (echo "$millis/1000" | bc)s
else if test $millis -ge 1000
set took_time (echo "scale=2; $millis/1000" | bc)s
else
set took_time "$millis""ms"
end
echo -s -n $code\ (set_color magenta)\ 󱦟$took_time\n
end
function fish_prompt
set now_date (set_color cyan)(date +%H:%M:%S)
set who_n_where (set_color yellow)$USER::(prompt_hostname)
set pwd (prompt_pwd)
set enter_mark (set_color red)''(set_color yellow)''(set_color green)''
echo -e -s -n -- $now_date\ $who_n_where\ (set_color white)\|(set_color yellow)\ $pwd\n$enter_mark\
set_color normal
end

View File

@ -0,0 +1,6 @@
{ ... }:
{
programs.wezterm.enable = true;
xdg.configFile."wezterm/wezterm.lua".source = ./wezterm.lua;
}

View File

@ -0,0 +1,88 @@
local wezterm = require 'wezterm'
local config = {
enable_wayland = true,
force_reverse_video_cursor = true,
font_size = 12,
colors = {
foreground = '#dcd7ba',
background = 'rgba(31,31,31,0.2)',
cursor_bg = '#c8c093',
cursor_fg = '#c8c093',
cursor_border = '#c8c093',
selection_fg = '#c8c093',
selection_bg = '#2d4f67',
scrollbar_thumb = '#16161d',
split = '#16161d',
ansi = { '#090618', '#c34043', '#76946a', '#c0a36e', '#7e9cd8', '#957fb8', '#6a9589', '#c8c093' },
brights = { '#727169', '#e82424', '#98bb6c', '#e6c384', '#7fb4ca', '#938aa9', '#7aa89f', '#dcd7ba' },
indexed = { [16] = '#ffa066', [17] = '#ff5d62' },
tab_bar = {
background = 'rgba(31, 31, 40, 0.5)',
new_tab = {
bg_color = 'rgba(31, 31, 40, 0.5)',
fg_color = '#c8c093',
},
new_tab_hover = {
bg_color = 'rgba(31, 31, 40, 0.5)',
fg_color = '#c8c093',
intensity = 'Bold'
},
}
},
use_fancy_tab_bar = false,
show_tab_index_in_tab_bar = false,
keys = {
{ key = 'V', mods = 'CTRL', action = wezterm.action.PasteFrom 'Clipboard' },
}
}
local SOLID_LEFT_ARROW = wezterm.nerdfonts.pl_right_hard_divider
local SOLID_RIGHT_ARROW = wezterm.nerdfonts.pl_left_hard_divider
function tab_title(tab_info)
local title = tab_info.tab_title
-- if the tab title is explicitly set, take that
if title and #title > 0 then
return title
end
-- Otherwise, use the title from the active pane
-- in that tab
return tab_info.active_pane.title
end
wezterm.on(
'format-tab-title',
function(tab, tabs, panes, config, hover, max_width)
local bg_color = 'rgba(31, 31, 40, 0.5)'
local fg_color = '#c8c093'
local text_color = '#1f1f28'
if tab.is_active then
fg_color = '#2d4f67'
text_color = '#c8c093'
end
local title = wezterm.truncate_right(tab_title(tab), max_width - 4)
return {
{ Background = { Color = bg_color } },
{ Foreground = { Color = fg_color } },
{ Text = SOLID_LEFT_ARROW },
{ Background = { Color = fg_color } },
{ Foreground = { Color = text_color } },
{ Text = ' ' .. title .. ' ' },
{ Background = { Color = bg_color } },
{ Foreground = { Color = fg_color } },
{ Text = SOLID_RIGHT_ARROW },
}
end
)
return config

View File

@ -13,6 +13,9 @@
./display.nix ./display.nix
../../home-manager/wezterm
../../home-manager/fish
../../home-manager/vscode.nix ../../home-manager/vscode.nix
../../home-manager/direnv.nix ../../home-manager/direnv.nix
../../home-manager/firefox.nix ../../home-manager/firefox.nix

View File

@ -3,6 +3,8 @@
home.stateVersion = "25.05"; home.stateVersion = "25.05";
imports = [ imports = [
../../home-manager/direnv.nix ../../home-manager/direnv.nix
../../home-manager/wezterm
../../home-manager/fish
]; ];
home.packages = with pkgs; [ home.packages = with pkgs; [
]; ];

View File

@ -12,6 +12,8 @@
../../home-manager/fnott.nix ../../home-manager/fnott.nix
../../home-manager/direnv.nix ../../home-manager/direnv.nix
../../home-manager/obs-studio.nix ../../home-manager/obs-studio.nix
../../home-manager/wezterm
../../home-manager/fish
]; ];
hare.hyprland = { hare.hyprland = {
style = import ../../home-manager/hyprland/styles/thin.nix { inherit lib; }; style = import ../../home-manager/hyprland/styles/thin.nix { inherit lib; };