79 lines
2.4 KiB
Markdown
79 lines
2.4 KiB
Markdown
# TTYverse Extensions
|
|
|
|
This directory contains bundled extensions for TTYverse, the command-line fediverse client.
|
|
|
|
## Extension Loading
|
|
|
|
TTYverse uses a simple XDG-compliant extension system. Extensions are only loaded from:
|
|
|
|
**`~/.local/share/ttyverse/extensions/`** (XDG_DATA_HOME/ttyverse/extensions)
|
|
|
|
Extensions are loaded with the `-exts` flag:
|
|
```bash
|
|
perl ttyverse.pl -exts=soundpack
|
|
perl ttyverse.pl -exts=extension1,extension2
|
|
```
|
|
|
|
## Managing Extensions
|
|
|
|
Use the included management script to enable/disable bundled extensions:
|
|
|
|
```bash
|
|
# Show available and enabled extensions
|
|
./extensions/manage-extensions.sh list
|
|
|
|
# Enable an extension (creates symlink in XDG directory)
|
|
./extensions/manage-extensions.sh enable soundpack
|
|
|
|
# Disable an extension (removes from XDG directory)
|
|
./extensions/manage-extensions.sh disable soundpack
|
|
|
|
# Check extension status
|
|
./extensions/manage-extensions.sh status soundpack
|
|
```
|
|
|
|
## Available Extensions
|
|
|
|
### soundpack.pl
|
|
Plays notification sounds for different types of posts (timeline, replies, DMs, mentions, search results).
|
|
|
|
**Configuration options** (add to `~/.config/ttyverse/ttyverse.rc`):
|
|
```
|
|
extpref_sound_command=paplay # Sound player (paplay, play, ogg123, etc.)
|
|
extpref_soundpack=default # Sound pack name
|
|
```
|
|
|
|
**Sound files location**: `~/.local/share/ttyverse/sounds/default/`
|
|
- `default.ogg` - Regular timeline posts
|
|
- `mention.ogg` - Mentions of your username
|
|
- `dm.ogg` - Direct messages
|
|
- `me.ogg` - Your own posts
|
|
- `follow.ogg` - New followers
|
|
- `boost.ogg` - Your posts boosted
|
|
- `favourite.ogg` - Your posts favourited
|
|
- `poll.ogg` - Poll notifications
|
|
- `announcement.ogg` - Server announcements
|
|
|
|
## Installing Custom Extensions
|
|
|
|
1. Copy your extension `.pl` file to `~/.local/share/ttyverse/extensions/`
|
|
2. Load it with `-exts=yourextension`
|
|
|
|
## Extension Development
|
|
|
|
Extensions are Perl modules that hook into TTYverse's event system. Key variables:
|
|
|
|
- `$data` - XDG data directory (`~/.local/share/ttyverse`)
|
|
- `$config` - XDG config directory (`~/.config/ttyverse`)
|
|
- `$store` - Extension workspace (persistent storage)
|
|
- `$silent` - Silent mode flag
|
|
- `$stdout` - Output filehandle
|
|
|
|
Extensions can define these functions:
|
|
- `$notifier` - Called for new posts
|
|
- `$heartbeat` - Called periodically
|
|
- `$handle` - Called for user commands
|
|
- `$prepost` - Called before posting
|
|
- `$postpost` - Called after posting
|
|
|
|
Set `$store->{'loaded'} = 1;` at the end of your extension. |