Tweety - An Integrated Terminal for your Browser
Features
- terminal tabs
- terminal panel in devtools
- terminal popup
- forward the chrome extension API to your shell
- bookmark commands
Installation
Warning
Windows is not supported at the moment.
Tweety is not distributed through the Chrome Web Store, as I don't think it would pass the review process. Instead, you can install it manually or using Homebrew.
Using Homebrew (recommended)
First install the tweety cli, and the extension manifest:
brew install --no-quarantine pomdtr/tap/tweety
# install the native messaging host manifest
tweety installThen, install the browser extension:
-
If you're using chrome:
- Go to
chrome://extensions/in your browser. - Enable "Developer mode" in the top right corner.
- Click on "Load unpacked".
- Select the
/opt/homebrew/share/tweety/extensions/chromeon macOS or/home/linuxbrew/.linuxbrew/share/tweety/extensions/chromeon Linux.
- Go to
-
If you're using firefox developer edition or the zen browser:
- Go to
about:configin your browser. - Set
xpinstall.signatures.requiredtofalse. - Go to
about:addons - Click on the gear icon in the top right corner and select "Install Add-on From File...".
- Select the
firefox.zipfile located in/opt/homebrew/share/tweety/extensions/firefox.zipon macOS or/home/linuxbrew/.linuxbrew/share/tweety/extensions/firefox.zipon Linux.
- Go to
You can upgrade tweety using brew update && brew upgrade tweety.
- On chrome, you can also click on the "Reload" button in the extensions page to reload the extension after upgrading.
- On firefox, you'll need to remove, then re-install the extension after upgrading.
Manual Installation
You can also install the extension manually by downloading the latest release from the releases page and extracting it to a directory of your choice.
You'll find the extension assets in the extensions directory of the extracted archive. You can then load the extension in your browser as described above.
Usage
Click on the extension icon in your browser toolbar to open a new terminal.
tweety command
Use the tweety command to create new terminal tabs, or interact with the chrome extension API.
Make sure to setup the completions using the tweety completion command.
Custom Commands
You can register custom subcommands for the tweety cli by creating executables in the ~/.config/tweety/commands directory. Each executable should be a single file and will be available as tweety <command-name>.
For example, you can create ~/.config/tweety/commands/copy-markdown-link.sh with the following content:
#!/bin/sh CURRENT_TAB=$(tweety tabs get) URL=$(echo "$CURRENT_TAB" | jq -r .url) TITLE=$(echo "$CURRENT_TAB" | jq -r .title) printf "[%s](%s)" "$TITLE" "$URL" | pbcopy
Then invoke it with tweety run copy-markdown-link to copy the current tab's title and URL as a markdown link to your clipboard.
You can also add commands to the context menu by adding a @tweety.contexts annotation to the top of your script:
#!/bin/sh # @tweety.title Open in archive.ph # @tweety.contexts ["page", "action"] TAB_URL=$(tweety tab query --active | jq -r .[0].url) tweety tab create --url "https://archive.ph/newest/$TAB_URL"
Apps
You can create new apps by adding executables to the ~/.config/tweety/apps directory. Each app should be a single executable file.
Each app is accessible at chrome-extensions://<extension-id>/terminal.html?mode=app&app=<app-name>, where <app-name> is the name of the executable file.
For example, I can create a file ~/.config/tweety/apps/htop.sh with the following content:
#!/bin/sh exec /opt/homebrew/bin/htop
And access it at chrome-extensions://pofgojebniiboodkmmjfbapckcnbkhpi/terminal.html?mode=app&app=htop or open it in a new tab using the tweety open htop command.
Configuration
You can find out the available themes by checking the internal/cmd/themes folder. The theme name corresponds to the name of the file without the .json extension.
