mirror of
https://github.com/Ascyii/projects.yazi.git
synced 2026-01-01 11:34:24 -05:00
The "load" action now accepts an argument, which is used to find a
project by name/description or the "on" keyboard key.
This can be used to create a keybinding to load a specific project (here
named "Default"):
```yaml
{ on = [ "P", "P" ], run = "plugin projects 'load Default'", desc = "Load the 'Default'project" },
```
It can also be used to start Yazi with a specific project using a
script:
```bash
#!/bin/bash
#
# Open a project in Yazi.
#
# https://yazi-rs.github.io/docs/plugins/utils/#ya.emit
# https://github.com/MasouShizuka/projects.yazi
#
export yaziProject="$1"
shift
if [ -z "$yaziProject" ]; then
>&2 echo "ERROR: The first argument must be a project"
exit 64
fi
# Generate random Yazi client ID (DDS / `ya emit` uses `YAZI_ID`)
export YAZI_ID=$RANDOM
# Use Yazi's DDS to run a plugin command after Yazi has started
# (the nested subshell is only to suppress "Done" output for the job)
( (sleep 0.1; ya emit plugin projects "load $yaziProject") &)
# Run Yazi with the generated client ID
yazi --client-id $YAZI_ID "$@"
```
27 KiB
27 KiB