Commit Graph

8 Commits

Author SHA1 Message Date
Sami Kankaristo
fb00b35266 Add ability to load a project by name or "on" key
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 "$@"
```
2025-06-17 13:40:01 +03:00
MasouShizuka
82febd5b45 fix: add @ to event name in yazi method 2025-06-14 22:19:16 +08:00
MasouShizuka
4bd79b3f94 fix: add saved event for save_last_and_quit function 2025-06-14 17:35:42 +08:00
MasouShizuka
568168c09e feat: add corresponding event when executing each function 2025-06-14 09:56:46 +08:00
MasouShizuka
96af237d22 refactor: migrate to yazi v25.5.28 2025-05-29 09:04:40 +08:00
MasouShizuka
4f11eccf83 refactor: migrate to yazi v25.2.26 2025-03-03 10:31:17 +08:00
MasouShizuka
4a69a7f7e6 feat: Add "project-loaded" dds event 2025-02-19 08:52:02 +08:00
MasouShizuka
ac57d0ac34 refactor: migrate to yazi v25.2.7 2025-02-10 10:07:32 +08:00