Initial commit
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
commit
1071567f8d
5 changed files with 87 additions and 0 deletions
9
LICENSE
Normal file
9
LICENSE
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 vbatts
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
Makefile
Normal file
27
Makefile
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
SCRIPT_FILE = terminal-url-open
|
||||
DESKTOP_FILE = terminal-url-scheme-handler.desktop
|
||||
|
||||
.PHONY: default
|
||||
default: help
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo " - help - this text"
|
||||
@echo " - user-install - install the 'terminal://' handler for only $(USER)"
|
||||
@echo " - lint - run shellcheck"
|
||||
@echo " - get-default - see the xdg-settings default handler for 'terminal://' scheme"
|
||||
|
||||
user-install:
|
||||
mkdir -p ~/.local/bin && \
|
||||
ln -sf $(shell realpath $(SCRIPT_FILE)) ~/.local/bin && \
|
||||
mkdir -p ~/.local/share/applications && \
|
||||
ln -sf $(shell realpath $(DESKTOP_FILE)) ~/.local/share/applications/ && \
|
||||
update-desktop-database ~/.local/share/applications
|
||||
|
||||
lint:
|
||||
shellcheck $(SCRIPT_FILE)
|
||||
|
||||
get-default:
|
||||
xdg-settings get default-url-scheme-handler terminal
|
||||
|
38
README.md
Normal file
38
README.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# 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.
|
||||
|
||||
## install
|
||||
|
||||
```shell
|
||||
make user-install
|
||||
```
|
||||
|
||||
## development
|
||||
|
||||
happy to take contributions or enhancements.
|
||||
|
||||
This seems like something that ought to be built-in for most desktops.
|
||||
|
||||
|
||||
### lint
|
||||
|
||||
```shell
|
||||
make lint
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
## LICENSE
|
||||
|
||||
See [LICENSE](./LICENSE)
|
||||
|
6
terminal-url-open
Executable file
6
terminal-url-open
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -ue
|
||||
|
||||
dir="${1#terminal://}"
|
||||
|
||||
x-terminal-emulator -e "sh -c 'cd "${dir}" && \$SHELL'"
|
7
terminal-url-scheme-handler.desktop
Normal file
7
terminal-url-scheme-handler.desktop
Normal file
|
@ -0,0 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Terminal URL Scheme Handler
|
||||
Terminal=false
|
||||
Exec=terminal-url-open %u
|
||||
StartupNotify=false
|
||||
MimeType=x-scheme-handler/terminal;
|
Loading…
Reference in a new issue