-

@ fiatjaf
2024-01-14 13:55:28
# Setting up a handler for `nostr:` links on your Desktop, even if you don't use a native client
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:
```python
#!/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`.