Marktab Actions: Automating Bookmark Workflows
Marktab actions allow you to automate custom workflows triggered by bookmark events. By defining rules in a marktab
file, you can execute shell commands, modify bookmarks, or integrate with external tools.
1. Getting Started
1.1. Location of Marktab File
The default marktab file is located at:
~/.config/gosuki/marktab
1.2. Basic Structure
Each line in the marktab file defines a rule with three components:
TRIGGER PATTERN COMMAND
- TRIGGER: A tag to watch for (e.g.,
notify
matches bookmarks with the tag#notify
) - PATTERN: A regex to match against the bookmark’s title or URL
- COMMAND: Shell command to execute (e.g.,
notify-send
,curl
)
2. Syntax Rules
2.1. Trigger
- Must be a single word (no spaces)
- Case-sensitive (e.g.,
notify
≠Notify
)
2.2. Pattern
- POSIX-compliant regex (no delimiters)
- Matches against:
- Bookmark title (
Title
) - Bookmark URL (
URL
)
- Bookmark title (
2.3. Command
- Executed in a shell (
sh -c
)
3. Example Rules
3.1. Basic Notification
notify .* notify-send "New Bookmark" "Added: $GOSUKI_TITLE"
This sends a desktop notification for any bookmark with the notify
tag.
3.2. URL Shortener Integration
shorten https://example.com 'curl -X POST -d "url=$GOSUKI_URL" https://api.shortener.com | xclip -selection clipboard'
Shortens bookmarks tagged with #shorten
and matching https://example.com
using an external API.
3.3. Archive Old Bookmarks
archive \.foo\.domain$ archive_box.sh
Archives bookmarks tagged #archive
and ending in .foo.domain
with a custom script that uses archive box
4. Environment Variables
Marktab actions have access to these variables:
Variable | Description |
---|---|
GOSUKI_URL | Bookmark URL |
GOSUKI_TITLE | Bookmark title |
GOSUKI_TAGS | Comma-separated tags |
GOSUKI_MODULE | Source module (e.g., firefox ) |
5. Troubleshooting
5.1. Common Errors
- Invalid regex: Ensure patterns use proper POSIX syntax
- Command not found: Verify shell commands exist in the environment
5.2. Debugging
Enable debug logs with:
GOSUKI_LOG_LEVEL=debug gosuki