From aee32f411301a77ec3c210f69f35e37cfd556937 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 5 Apr 2024 01:17:53 +0200 Subject: [PATCH] Add yazi (terminal filemgr) --- .../terminal/file-managers/default.nix | 6 + .../terminal/file-managers/yazi/default.nix | 41 +++++ .../file-managers/yazi/theme/icons.nix | 147 ++++++++++++++++++ .../file-managers/yazi/theme/manager.nix | 64 ++++++++ .../file-managers/yazi/theme/status.nix | 46 ++++++ 5 files changed, 304 insertions(+) create mode 100644 home/programs/terminal/file-managers/default.nix create mode 100644 home/programs/terminal/file-managers/yazi/default.nix create mode 100644 home/programs/terminal/file-managers/yazi/theme/icons.nix create mode 100644 home/programs/terminal/file-managers/yazi/theme/manager.nix create mode 100644 home/programs/terminal/file-managers/yazi/theme/status.nix diff --git a/home/programs/terminal/file-managers/default.nix b/home/programs/terminal/file-managers/default.nix new file mode 100644 index 0000000..6885c97 --- /dev/null +++ b/home/programs/terminal/file-managers/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./yazi + ]; +} + diff --git a/home/programs/terminal/file-managers/yazi/default.nix b/home/programs/terminal/file-managers/yazi/default.nix new file mode 100644 index 0000000..e9c6e2a --- /dev/null +++ b/home/programs/terminal/file-managers/yazi/default.nix @@ -0,0 +1,41 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + ./theme/icons.nix + ./theme/manager.nix + ./theme/status.nix + ]; + + home.packages = [pkgs.exiftool]; + + programs.yazi = { + enable = true; + + enableBashIntegration = config.programs.bash.enable; + enableZshIntegration = config.programs.zsh.enable; + + settings = { + manager = { + layout = [1 4 3]; + sort_by = "alphabetical"; + sort_sensitive = true; + sort_reverse = false; + sort_dir_first = true; + linemode = "none"; + show_hidden = false; + show_symlink = true; + }; + + preview = { + tab_size = 2; + max_width = 600; + max_height = 900; + cache_dir = "${config.xdg.cacheHome}/yazi"; + }; + }; + }; +} + diff --git a/home/programs/terminal/file-managers/yazi/theme/icons.nix b/home/programs/terminal/file-managers/yazi/theme/icons.nix new file mode 100644 index 0000000..fb46856 --- /dev/null +++ b/home/programs/terminal/file-managers/yazi/theme/icons.nix @@ -0,0 +1,147 @@ +{ + programs.yazi.theme.icons = { + # Default + "*" = ""; + "*/" = "󰉋"; + + # Home + ".config/" = ""; + ".ssh/" = "󰢬"; + "Desktop/" = ""; + "Development/" = ""; + "Documents/" = ""; + "Downloads/" = "󰉍"; + "Library/" = ""; + "Movies/" = ""; + "Music/" = "󱍙"; + "Pictures/" = "󰉏"; + "Videos/" = ""; + "Public/" = ""; + + # Git + ".git/" = ""; + ".gitignore" = ""; + ".gitmodules" = ""; + ".gitattributes" = ""; + + # Dotfiles + ".DS_Store" = ""; + ".bashrc" = ""; + ".bashprofile" = ""; + ".zshrc" = ""; + ".zshenv" = ""; + ".zprofile" = ""; + ".vimrc" = ""; + + # Text + "*.txt" = ""; + "*.md" = ""; + "*.rst" = ""; + COPYING = "󰿃"; + LICENSE = "󰿃"; + + # Archives + "*.zip" = ""; + "*.tar" = ""; + "*.gz" = ""; + "*.7z" = ""; + "*.bz2" = ""; + "*.xz" = ""; + + # Documents + "*.csv" = ""; + "*.doc" = ""; + "*.doct" = ""; + "*.docx" = ""; + "*.dot" = ""; + "*.ods" = ""; + "*.ots" = ""; + "*.pdf" = ""; + "*.pom" = ""; + "*.pot" = ""; + "*.ppm" = ""; + "*.pps" = ""; + "*.ppt" = ""; + "*.potx" = ""; + "*.ppmx" = ""; + "*.ppsx" = ""; + "*.pptx" = ""; + "*.xlc" = ""; + "*.xlm" = ""; + "*.xls" = ""; + "*.xlt" = ""; + "*.xlsm" = ""; + "*.xlsx" = ""; + + # Audio + "*.mp3" = ""; + "*.flac" = ""; + "*.wav" = ""; + "*.aac" = ""; + "*.ogg" = ""; + "*.m4a" = ""; + "*.mp2" = ""; + + # Movies + "*.mp4" = ""; + "*.mkv" = ""; + "*.avi" = ""; + "*.mov" = ""; + "*.webm" = ""; + + # Images + "*.jpg" = ""; + "*.jpeg" = ""; + "*.png" = ""; + "*.gif" = ""; + "*.webp" = ""; + "*.avif" = ""; + "*.bmp" = ""; + "*.ico" = ""; + "*.svg" = ""; + "*.xcf" = ""; + "*.HEIC" = ""; + + # Programming + "*.c" = ""; + "*.cpp" = ""; + "*.h" = ""; + "*.hpp" = ""; + "*.rs" = ""; + "*.go" = ""; + "*.py" = ""; + "*.hs" = ""; + "*.js" = ""; + "*.ts" = ""; + "*.tsx" = ""; + "*.jsx" = ""; + "*.rb" = ""; + "*.php" = ""; + "*.java" = ""; + "*.sh" = ""; + "*.fish" = ""; + "*.swift" = ""; + "*.vim" = ""; + "*.lua" = ""; + "*.html" = ""; + "*.css" = ""; + "*.sass" = ""; + "*.scss" = ""; + "*.json" = ""; + "*.toml" = ""; + "*.yml" = ""; + "*.yaml" = ""; + "*.ini" = ""; + "*.conf" = ""; + "*.lock" = ""; + "*.nix" = ""; + Containerfile = "󰡨"; + Dockerfile = "󰡨"; + + # Misc + "*.bin" = ""; + "*.exe" = ""; + "*.pkg" = ""; + }; +} + diff --git a/home/programs/terminal/file-managers/yazi/theme/manager.nix b/home/programs/terminal/file-managers/yazi/theme/manager.nix new file mode 100644 index 0000000..13acca3 --- /dev/null +++ b/home/programs/terminal/file-managers/yazi/theme/manager.nix @@ -0,0 +1,64 @@ +{ + programs.yazi.theme.manager = { + cwd = {fg = "cyan";}; + + # Hovered + hovered = { + fg = "black"; + bg = "lightblue"; + }; + + preview_hovered = { + fg = "black"; + bg = "lightblue"; + }; + + # Find + find_keyword = { + fg = "yellow"; + italic = true; + }; + find_position = { + fg = "magenta"; + bg = "reset"; + italic = true; + }; + + # Marker + marker_selected = { + fg = "lightgreen"; + # bg = "lightgreen"; + }; + marker_copied = { + fg = "lightyellow"; + # bg = "lightyellow"; + }; + marker_cut = { + fg = "lightred"; + # bg = "lightred"; + }; + + # Tab + tab_active = { + fg = "black"; + bg = "lightblue"; + }; + tab_inactive = { + fg = "white"; + bg = "darkgray"; + }; + tab_width = 1; + + # Border; + border_symbol = "│"; + border_style = {fg = "gray";}; + + # Offset; + folder_offset = [1 0 1 0]; + preview_offset = [1 1 1 1]; + + # Highlighting; + syntect_theme = ""; + }; +} + diff --git a/home/programs/terminal/file-managers/yazi/theme/status.nix b/home/programs/terminal/file-managers/yazi/theme/status.nix new file mode 100644 index 0000000..8393f1a --- /dev/null +++ b/home/programs/terminal/file-managers/yazi/theme/status.nix @@ -0,0 +1,46 @@ +{ + programs.yazi.theme.status = { + separator_open = "█"; + separator_close = "█"; + separator_style = { + fg = "darkgray"; + bg = "darkgray"; + }; + + # Mode; + mode_normal = { + fg = "black"; + bg = "lightblue"; + bold = true; + }; + mode_select = { + fg = "black"; + bg = "lightgreen"; + bold = true; + }; + mode_unset = { + fg = "black"; + bg = "lightmagenta"; + bold = true; + }; + + # Progress; + progress_label = {bold = true;}; + progress_normal = { + fg = "blue"; + bg = "black"; + }; + progress_error = { + fg = "red"; + bg = "black"; + }; + + # Permissions; + permissions_t = {fg = "blue";}; + permissions_r = {fg = "lightyellow";}; + permissions_w = {fg = "lightred";}; + permissions_x = {fg = "lightgreen";}; + permissions_s = {fg = "darkgray";}; + }; +} +