Repository navigation
Custom Actions
The Custom Actions plugin adds commands of your own to the context menu. Switch it on in Settings → Plugins → Custom actions.
Every file in ~/.config/ski/actions/ is one menu entry:
| File | Entry |
|---|---|
A .json file |
A command defined in JSON (see below) |
| An executable script (any language, with the executable permission) | The script itself; the entry is named after the file |
Settings → Plugins → Custom actions → Open actions folder opens the folder. New action creates a .json file from a template. Ski reads the folder again when a file in it is added, removed, edited or made executable; no restart is needed. Files that cannot be used are listed in Settings → Plugins with the reason.
{
"name": "Convert to WebP",
"command": "for f in \"$@\"; do cwebp \"$f\" -o \"${f%.*}.webp\"; done",
"extensions": ["jpg", "png"]
}| Key | Type | Meaning |
|---|---|---|
name |
text | The label in the menu. Empty: the file name. |
command |
text | Shell code, run with sh -c. Required. |
extensions |
list of text | Show the entry only when every selected item has one of these extensions (with or without the dot, any letter case). Empty: any item. |
files_only |
true or false | Show the entry only for files |
dirs_only |
true or false | Show the entry only for folders |
single |
true or false | Show the entry only when exactly one item is selected |
- The working directory is the open folder.
- The selected items are the arguments:
"$@"in a JSON command,$1,$2… in a script. -
SKI_SELECTED_FILESholds the selected paths, one per line. -
SKI_CURRENT_DIRholds the open folder.
The action runs in the background. When it finishes, the folder is read again, so files it created appear. A failed action shows "name failed: error" in a toast.
Open a terminal editor on the selected file:
{ "name": "Edit in Vim", "command": "kitty vim \"$1\"", "files_only": true, "single": true }A script, ~/.config/ski/actions/Make thumbnails (executable):
#!/bin/sh
for f in "$@"; do
magick "$f" -resize 256x256 "thumb-$(basename "$f")"
done