fiatjaf on Nostr: # Setting up a handler for `nostr:` links on your Desktop, even if you don't use a ...
This is the most barebones possible, it will just open a web browser at https://nostr.guru/
with the contents of the nostr:
link.
Create this file at ~/.local/share/applications/nostr-opener.desktop
:
[Desktop Entry]
Exec=/home/youruser/nostr-opener %u
Name=Nostr Browser
Type=Application
StartupNotify=false
MimeType=x-scheme-handler/nostr;
(Replace “youruser” with your username above.)
This will create a default handler for nostr:
links. It will be called with the link as its first argument.
Now you can create the actual program at ~/nostr-opener
. For example:
#!/usr/bin/env python
import sys
import webbrowser
nip19 = sys.argv[1][len('nostr:'):]
webbrowser.open(f'https://nostr.guru/{nip19}')
Remember to make it executable with chmod +x ~/nostr-opener
.
Published at
2024-01-14 13:55:28Event JSON
{
"id": "2e950ded426e86b6b358444e207e1eaea46e4fc1e175933b8b3a3fb17ae0ba66",
"pubkey": "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d",
"created_at": 1705240528,
"kind": 30023,
"tags": [
[
"d",
"33ec0995"
],
[
"title",
"Setting up a handler for `nostr:` links on your Desktop, even if you don't use a native client"
],
[
"published_at",
"1675175880"
],
[
"t",
"nostr"
]
],
"content": "\n# Setting up a handler for `nostr:` links on your Desktop, even if you don't use a native client\n\nThis is the most barebones possible, it will just open a web browser at `https://nostr.guru/` with the contents of the `nostr:` link.\n\nCreate this file at `~/.local/share/applications/nostr-opener.desktop`:\n\n```\n[Desktop Entry]\nExec=/home/youruser/nostr-opener %u\nName=Nostr Browser\nType=Application\nStartupNotify=false\nMimeType=x-scheme-handler/nostr;\n```\n\n(Replace \"youruser\" with your username above.)\n\nThis will create a default handler for `nostr:` links. It will be called with the link as its first argument.\n\nNow you can create the actual program at `~/nostr-opener`. For example:\n\n```python\n#!/usr/bin/env python\n\nimport sys\nimport webbrowser\n\nnip19 = sys.argv[1][len('nostr:'):]\nwebbrowser.open(f'https://nostr.guru/{nip19}')\n```\n\nRemember to make it executable with `chmod +x ~/nostr-opener`.\n",
"sig": "59131fd3371427ab49a23f5057d6580ea361abf74d965eb47d249177924e3553693932fe7b7c106a2d99bae73481c42841ce6e86eb6be4a6dac68f3ec150a5b7"
}