Published multiple files
Some checks failed
Build and Deploy Quartz / build (push) Has been cancelled
Some checks failed
Build and Deploy Quartz / build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
{"publish":true,"title":"qutebrowser","created":"2026-01-19T18:10:16.270-07:00","modified":"2026-01-19T18:15:29.016-07:00","tags":["web"],"cssclasses":""}
|
||||||
|
---
|
||||||
|
|
||||||
|
One of the gifts I have received from a career in tech is some gnarly RSI. It sucks. My life is considerably better the more I can use a keyboard and the less I can use a mouse. For the longest time the biggest obstacle for me was the web browser, all of which seemed to lean on the mouse over anything else. I recently discovered [qutebrowser](https://www.qutebrowser.org/) though and it is an absolute game changer. It has some limitations, and occasionally I have to jump to Vivaldi or similar to get something working. For the most part though it is now my daily driver and I love it.
|
||||||
79
content/10-19 LIFE/13 TECH SETUP/13.11 APPS/urlref.md
Normal file
79
content/10-19 LIFE/13 TECH SETUP/13.11 APPS/urlref.md
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
---
|
||||||
|
{"publish":true,"title":"urlref","created":"2026-01-19T18:15:38.889-07:00","modified":"2026-01-19T18:40:10.504-07:00","tags":["web","note_taking"],"cssclasses":""}
|
||||||
|
---
|
||||||
|
|
||||||
|
As an avid user of pen and paper for note taking I have had endless trouble figuring out how to store url's without having to write them out in full. I seem to have found a solution to this issue with [urlref](https://benjaminhollon.com/musings/urlref/) from the fantastic [Benjamin Hollon](https://polymaths.social/@amin). I did have a little bit of fun setting up for myself though so I am documenting here in case it is helpful to anyone, including future me.
|
||||||
|
## Installation
|
||||||
|
### Install Nim
|
||||||
|
**Arch Linux:**
|
||||||
|
```bash
|
||||||
|
sudo pacman -S nim nimble
|
||||||
|
```
|
||||||
|
**Other distributions:**
|
||||||
|
See https://nim-lang.org/install.html
|
||||||
|
### Build
|
||||||
|
```bash
|
||||||
|
cd urlref
|
||||||
|
nimble build
|
||||||
|
```
|
||||||
|
### Install system-wide (optional)
|
||||||
|
```bash
|
||||||
|
nimble install
|
||||||
|
```
|
||||||
|
This installs the binary to `~/.nimble/bin/`. Ensure it's in your PATH:
|
||||||
|
```bash
|
||||||
|
export PATH="$HOME/.nimble/bin:$PATH"
|
||||||
|
```
|
||||||
|
## Usage
|
||||||
|
### Create a short reference
|
||||||
|
```bash
|
||||||
|
urlref create "https://example.com/some/long/url"
|
||||||
|
# Output: ABC
|
||||||
|
```
|
||||||
|
### Start the redirect server
|
||||||
|
```bash
|
||||||
|
urlref
|
||||||
|
```
|
||||||
|
The server runs on port 9873. Visiting `http://localhost:9873/ABC` redirects to the original URL.
|
||||||
|
## Examples
|
||||||
|
### systemd service
|
||||||
|
```bash
|
||||||
|
[Unit]
|
||||||
|
Description=URL Reference Redirect Server
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=%h/.nimble/bin/urlref
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
|
```
|
||||||
|
### qutebrowser Integration
|
||||||
|
This [[10-19 LIFE/13 TECH SETUP/13.11 APPS/qutebrowser]] integration works for me, you are on your own for other browsers!
|
||||||
|
#### Userscript
|
||||||
|
Should live at `~/.local/share/qutebrowser/userscripts`
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
# Qutebrowser userscript to shorten the current URL using urlref
|
||||||
|
|
||||||
|
shortcode=$(~/.nimble/bin/urlref create "$QUTE_URL")
|
||||||
|
|
||||||
|
if [ -n "$shortcode" ]; then
|
||||||
|
echo "message-info 'Shortcode: $shortcode'" >> "$QUTE_FIFO"
|
||||||
|
echo "yank inline $shortcode" >> "$QUTE_FIFO"
|
||||||
|
else
|
||||||
|
echo "message-error 'Failed to create shortcode'" >> "$QUTE_FIFO"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
Bind it to a key
|
||||||
|
```python
|
||||||
|
config.bind('ar', 'spawn --userscript urlref-shorten')
|
||||||
|
```
|
||||||
|
|
||||||
|
Add a custom search engine
|
||||||
|
```python
|
||||||
|
c.url.searchengines['r'] = 'http://localhost:9873/{}'
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user