# FBInk Integration Guide

## What is FBInk?

FBInk is a tool for drawing text and images on e-ink displays. It's commonly bundled with KOReader and other Kobo mods.

## Check if FBInk is installed

```bash
ssh root@192.168.88.110
which fbink
# or
fbink --version
```

If not installed, it usually comes with KOReader at `/usr/local/koreader/fbink`

## Basic Usage in Scripts

### Show a message
```bash
fbink -pm "Hello, World!"
```

### Show message at specific position
```bash
fbink -pm -y 10 "Message at row 10"
```

### Clear the screen
```bash
fbink -s
```

### Show without refresh (faster)
```bash
fbink -q -pm "Quick message"
```

## Common Options

- `-pm` - Print centered (middle)
- `-q` - Quiet mode (no verbose output)
- `-y N` - Print at row N
- `-s` - Clear screen
- `-h` - Refresh (full screen)
- `-f` - Flash (for animations)

## Testing FBInk

SSH into your Kobo and try:
```bash
fbink -pm "Testing FBInk!"
sleep 2
fbink -s  # Clear it
```

## Enhanced sync_highlights.sh

The `sync_highlights_with_fbink.sh` script shows:
- "Syncing highlights..." while running
- "✓ Synced N highlights!" on success
- "✗ Sync failed! Check log" on error

Auto-clears after 2-3 seconds so it doesn't clutter the screen.

## Installation

Replace your existing sync script:
```bash
scp sync_highlights_with_fbink.sh root@192.168.88.110:/usr/local/bin/sync_highlights.sh
ssh root@192.168.88.110 chmod +x /usr/local/bin/sync_highlights.sh
```

## Custom Messages

You can customize the messages in the script:

```bash
# Change this line:
$FBINK -q -pm -y 10 "✓ Synced $COUNT highlights!"

# To something like:
$FBINK -q -pm -y 10 "📚 $COUNT new highlights saved!"
```

## Advanced: Progress Bar

For future enhancements, FBInk can show progress bars:
```bash
fbink -pm -P 50  # Show 50% progress
```

Could be useful if syncing takes a while!

## Fallback Behavior

The script automatically detects if FBInk is available. If not found, it runs silently (just logs to file). So it works either way!
