feat: add caleastia shell

This commit is contained in:
danny 2025-08-19 23:28:52 +08:00
parent b9a369436d
commit 146418764e
20 changed files with 926 additions and 286 deletions

View file

@ -1,17 +1,15 @@
{
inputs,
config,
system,
pkgs,
lib,
...
}:
let
yaziPlugins = pkgs.fetchFromGitHub {
owner = "yazi-rs";
repo = "plugins";
rev = "86d28e4fb4f25f36cc501b8cb0badb37a6b14263";
hash = "sha256-m/gJTDm0cVkIdcQ1ZJliPqBhNKoCW1FciLkuq7D1mxo=";
rev = "main";
hash = "sha256-TUS+yXxBOt6tL/zz10k4ezot8IgVg0/2BbS8wPs9KcE=";
};
in
{
@ -20,10 +18,14 @@ in
enable = true;
package = inputs.yazi.packages.${system}.default;
shellWrapperName = "y";
enableFishIntegration = false;
enableFishIntegration = true;
plugins = {
toggle-panel = ''${yaziPlugins}/toggle-panel.yazi'';
toggle-pane = ''${yaziPlugins}/toggle-pane.yazi'';
mount = ''${yaziPlugins}/mount.yazi'';
zoom = ''${yaziPlugins}/zoom'';
vcs-files = ''${yaziPlugins}/vcs-files'';
git = ''${yaziPlugins}/git'';
};
flavors = {
@ -42,9 +44,81 @@ in
};
};
settings = {
plugin.prepend_fetchers = [
{
id = "git";
name = "*";
run = "git";
}
{
id = "git";
name = "*/";
run = "git";
}
];
input = {
cursor_blink = true;
};
opener = {
edit = [
{
run = ''''\${EDITOR:=nvim} "$@"'';
desc = "$EDITOR";
block = true;
}
{
run = ''code "$@"'';
orphan = true;
}
];
player = [
{ run = ''mpv --force-window "$@"''; }
];
};
};
keymap = {
mgr = {
prepend_keymap = [
# Git Changes
{
on = [
"g"
"c"
];
run = "plugin vcs-files";
desc = "Show Git file changes";
}
# Image zoom
{
on = "+";
run = "plugin zoom 1";
desc = "Zoom in hovered file";
}
{
on = "-";
run = "plugin zoom -1";
desc = "Zoom out hovered file";
}
# Mount Manager
{
on = "M";
run = "plugin mount";
desc = "Launch mount manager";
# Usage
# Key binding Alternate key Action
# q - Quit the plugin
# k ↑ Move up
# j ↓ Move down
# l → Enter the mount point
# m - Mount the partition
# u - Unmount the partition
# e - Eject the disk
}
# Toggle Maximize Preview
{
on = "T";
@ -66,6 +140,7 @@ in
"r"
];
run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"'';
desc = "Go to git root";
}
# Drag and Drop
{
@ -92,16 +167,6 @@ in
initLua =
# lua
''
-- Show symlink in status bar
Status:children_add(function(self)
local h = self._current.hovered
if h and h.link_to then
return " -> " .. toString(h.link_to)
else
return ""
end
end, 3300, Status.LEFT)
-- Show user/group of files in status bar
Status:children_add(function()
local h = cx.active.current.hovered
@ -116,14 +181,6 @@ in
" ",
}
end, 500, Status.RIGHT)
-- Show username and hostname in header
Header:children_add(function()
if ya.target_family() ~= "unix" then
return ""
end
return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
end, 500, Header.LEFT)
'';
};
};
@ -131,36 +188,4 @@ in
home.packages = with pkgs; [
ueberzugpp
];
# xdg.portal = {
# enable = lib.mkForce true;
# extraPortals = [ pkgs.xdg-desktop-portal-termfilechooser ];
# config = {
# common.default = [
# "hyprland"
# "gtk"
# ];
# common = {
# "org.freedesktop.impl.portal.FileChooser" = "termfilechooser";
# };
# hyprland.default = [
# "hyprland"
# "gtk"
# ];
# hyprland."org.freedesktop.impl.portal.FileChooser" = [ "termfilechooser" ];
# };
# };
# xdg.configFile."xdg-desktop-portal-termfilechooser/config" = {
# force = true;
# text = ''
# [filechooser]
# cmd=TERMCMD='${config.programs.ghostty.package}/bin/ghostty --title=file_chooser -e "bash -c ${pkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh"'
# default_dir=$HOME
# open_mode = suggested
# save_mode = last
# '';
# };
# home.sessionVariables.TERMCMD = "${config.programs.ghostty.package}/bin/ghostty --title=file_chooser";
}