Marktab Actions
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/marktab1.2. Basic Structure
Each line in the marktab file defines a rule with three components:
# * * *
# | | |_____ shell command to execute
# | |_________ pattern to match on the url or title
# |____________ trigger keyword to detect in tags
TRIGGER PATTERN COMMAND- TRIGGER: A tag to watch for. Can be:
- A regular tag name:
notifymatches bookmarks with tag#notify - An action tag:
@archiveboxmatches bookmarks with action tag@archivebox
- A regular tag name:
- 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 (
Note
An empty pattern matches all bookmarks (trigger-only rules).
Example: notify '' notify-send "New Bookmark" "$GOSUKI_TITLE"
2.3. Command
- Executed in a shell (
sh -c)
2.4. Action Tags
Action tags (prefixed with @, e.g., @archivebox) are a special trigger type. When a rule fires, action tags are excluded from the GOSUKI_TAGS environment variable:
- A rule trigger
@archiveboxmatches bookmarks containing the action tag@archivebox - But
$GOSUKI_TAGSwill NOT include@archivebox— only non-action tags are included
This means if a bookmark has @archivebox and notify tags, the command receives $GOSUKI_TAGS=notify.
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
@archivebox \.foo\.domain$ archive_box.shArchives bookmarks tagged with the action tag @archivebox 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) |
$GOSUKI_RUN_ID | Unique run ID for this hook execution (4 chars) |
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