No description
Find a file
Vincent Batts 06303c12bd
*: switch to golang
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2024-05-25 11:41:39 -04:00
.gitignore *: switch to golang 2024-05-25 11:41:39 -04:00
go.mod *: switch to golang 2024-05-25 11:41:39 -04:00
go.sum *: switch to golang 2024-05-25 11:41:39 -04:00
LICENSE Initial commit 2024-05-23 22:00:46 -04:00
Makefile *: switch to golang 2024-05-25 11:41:39 -04:00
README.md *: switch to golang 2024-05-25 11:41:39 -04:00
terminal-url-open *: switch to golang 2024-05-25 11:41:39 -04:00
terminal-url-open.go *: switch to golang 2024-05-25 11:41:39 -04:00
terminal-url-scheme-handler.desktop Initial commit 2024-05-23 22:00:46 -04:00

terminal-url-handler

motivation

It would be great to put a link in my notes to the directory I working in on a project, and it opens a terminal right to there.

Something simple like a URI to the directory you had a terminal open.

install

This requires a golang compiler.

git clone https://github.com/vbatts/terminal-url-handler
cd terminal-url-handler
make user-install

examples

Say you keep a notebook/journal/whatever in an app that allows hyperlinks (markdown, html, etc.).

Create a link:

[terminal-url-handler](terminal://~/src/terminal-url-handler)

i.e. terminal-url-handler

<a href="terminal://~/src/terminal-url-handler">terminal-url-handler</a>

Types of URIs

multiple cases of URIs, and we are not dealing with query parameters. No shell execution.

  • terminal:///home/user
  • terminal://host:/home/user
  • terminal://host/home/user
  • terminal://user@host:/home/user
  • terminal://user@host:port/home/user

default terminal?

On most Linux desktops, the x-terminal-emulator is an update-alternatives symlink to a Terminal app like gnome-terminal or whatever.

To see alternatives for x-terminal-emulator, run:

$ update-alternatives --list x-terminal-emulator
/usr/bin/gnome-terminal.wrapper
/usr/bin/koi8rxterm
/usr/bin/lxterm
/usr/bin/uxterm
/usr/bin/xfce4-terminal.wrapper
/usr/bin/xterm

To change this, say to xfce4-terminal, run:

sudo update-alternatives --set x-terminal-emulator /usr/bin/xfce4-terminal.wrapper

development

happy to take contributions or enhancements.

This seems like something that ought to be built-in for most desktops.

XDG

all this business of x-scheme-handlers and desktop files, I am surprised there isn't a simple GUI that can help creating and indexing them.

Discovering x-scheme-handlers is a programatic enough, but is currently primarily from shell? Whatever.

https://portland.freedesktop.org/doc/xdg-settings.html

Future improvements?

  • if a user@host is included, then ssh to the host

LICENSE

See LICENSE