| Crates.io | ghosttext-any |
| lib.rs | ghosttext-any |
| version | 0.2.1 |
| created_at | 2021-02-06 01:44:47.693353+00 |
| updated_at | 2023-07-13 02:32:12.029731+00 |
| description | A GhostText server for any $EDITOR |
| homepage | |
| repository | https://github.com/newsch/ghosttext-any/ |
| max_upload_size | |
| id | 351375 |
| size | 92,031 |
A GhostText server for any $EDITOR.
Built on idanarye's ghost-text-file.
GhostText-Any allows you to edit any text box in your browser (Firefox/Chromium-based) with anything you can set your $EDITOR to.
It does this by saving any edit request from the GhostText extension (sent over a WebSocket) as a file and opening said file with your preferred $EDITOR. Whenever the file is written to or your $EDITOR closes, the contents are sent back to the browser. Whenever the textbox is updated in your browser, the file is updated with the new text.
Want to reply to the comments on any website with ed? Go right ahead.
To use it:
cargo install ghosttext-any (requires cargo/rust)gtany in a terminal.$EDITOR is opened in the same terminal with the content of the textbox. Write, quit, and the same content will be updated in your browser.By default, gtany only spawns a single instance at a time (based on the assumption that your $EDITOR uses the terminal it's spawned in, and you don't want multiple instances fighting over /dev/tty). If you'd like multiple concurrent instances to be spawned, use the -m/--multi flag.
If you don't have $EDITOR set or you'd like to run something else, you can specify a command to run with the -e/--editor flag.
For example, if you'd like to spawn a new terminal window with your $EDITOR whenever you use GhostText, you could use a command like this:
gtany --multi --editor "x-terminal-emulator -e $EDITOR"
(If you don't use a Unix-y OS or do but not with X11 or do but not with a terminal emulator that supports -e, you'll need to figure something else out).
If you use a Linux distribution with systemd, you can run GhostText-Any as a socket-activated service, where systemd watches the GhostText port and only starts GhostText-Any when you use the browser extension. Combined with the --idle-timeout flag, it will automatically start up and shut down when the browser extension is closed.
cargo install ghosttext-any --features systemdgtany.socket and gtany.service, to ~/.config/systemd/user/ExecStart field in gtany.service to call your preferred $EDITOR.systemctl --user daemon-reloadsystemctl --user enable gtany.socketsystemctl --user status gtany.{socket,service}