QR Codes
Dux Shell
QR Codes
The dms qr command generates QR codes from text, stdin, or saved WiFi networks. Codes render directly in the terminal, export as PNG files, or copy straight to the clipboard — making it useful both interactively and from scripts or plugins.
Quick Start
# Render in the terminal
dms qr "https://example.com"
# Save a PNG
dms qr "https://example.com" -o code.png
# Pipe PNG bytes anywhere
dms qr "https://example.com" > code.png
# Share your WiFi
dms qr wifi MyNetwork
Input Sources
| Source | Command |
|---|---|
| Argument | dms qr "some text" |
| Stdin (piped) | echo -n "data" | dms qr |
| Stdin (explicit) | dms qr - |
| Saved WiFi network | dms qr wifi <ssid> |
Output Destinations
Output is automatic by default: a terminal render when stdout is a TTY, raw PNG bytes when piped. Destinations can be combined freely.
| Flag | Description |
|---|---|
--output / -o | Save a PNG to a file |
--stdout | Write PNG bytes to stdout |
--clipboard | Copy the PNG image to the clipboard |
--copy-text | Copy the source text to the clipboard |
--render | Force terminal rendering |
--no-render | Never render to the terminal |
When PNG bytes go to stdout and --render is also set, the terminal render goes to stderr so the streams stay separate:
dms qr "text" --stdout --render > code.png # PNG in file, preview on screen
Encoding Options
| Flag | Description |
|---|---|
--ecc | Error correction level: L, M, Q, H (default M, or H with --logo) |
--qr-version | Force QR symbol version 1-40 (default: auto) |
Higher error correction makes the code denser but more damage-resistant. H survives ~30% obstruction, which is why it becomes the default when a logo is overlaid.
Styling Options
PNG
| Flag | Description |
|---|---|
--module-size | Pixels per module, 1-255 (default: auto) |
--fg | Dark module color (#RGB or #RRGGBB) |
--bg | Light module color (#RGB or #RRGGBB) |
--transparent | Transparent background (overrides --bg) |
--border | Border width in pixels (default: auto) |
--shape | Module shape: square (default) or circle |
--logo | Center a PNG/JPEG logo on the code |
--logo-scale | Max logo size as 1/N of the code (default: 5) |
# Themed, rounded modules with a logo
dms qr "https://danklinux.com" \
--shape circle \
--fg '#1a1b26' --bg '#c0caf5' \
--logo ~/Pictures/logo.png \
-o branded.png
A logo larger than 1/N of the final image is skipped by the renderer. If your logo doesn't appear, raise --module-size or --logo-scale.
Circle modules are an aesthetic choice — modern phone scanners read them fine, but some older decoders only handle square modules.
Terminal
| Flag | Description |
|---|---|
--invert | Swap colors (for light terminals) |
--quiet-zone | Margin around the code in modules (default: 2) |
--fg / --bg | Override the render colors |
Terminal rendering paints both polarities explicitly, so codes scan correctly on dark and light terminal themes alike. If a scanner still struggles, try --invert.
WiFi QR Codes
dms qr wifi builds a code that joins a network when scanned.
# Pull the saved password from the running DMS shell
dms qr wifi MyNetwork
# Fully offline with an explicit password
dms qr wifi MyNetwork -p 'hunter2'
# Open network
dms qr wifi CoffeeShop --security nopass
| Flag | Short | Description |
|---|---|---|
--password | -p | WiFi password (builds offline, no shell needed) |
--security | Security type: WPA (default), WEP, nopass | |
--hidden | Mark the network as hidden |
Without --password, the saved credentials are fetched from the running DMS shell — the same mechanism the network panel uses. Special characters in SSIDs and passwords are escaped automatically.
All output and styling flags work here too:
dms qr wifi MyNetwork --clipboard --no-render
dms qr wifi MyNetwork -o guest-wifi.png --module-size 16
Scripting & Plugins
Since piped output is raw PNG and errors go to stderr with a non-zero exit code, dms qr composes cleanly:
# QR of the current clipboard contents
dms clipboard paste | dms qr
# Show a file's contents as a code in a notification-sized PNG
dms qr - < token.txt --module-size 8 -o /tmp/token.png
# Feed another tool without touching disk
dms qr "otpauth://totp/..." --stdout | imv -
All Options
| Flag | Short | Description |
|---|---|---|
--ecc | Error correction: L, M, Q, H (default M, or H with --logo) | |
--qr-version | Force QR symbol version 1-40 (0 = auto) | |
--output | -o | Write a PNG to this file |
--stdout | Write PNG bytes to stdout | |
--clipboard | Copy the PNG image to the clipboard | |
--copy-text | Copy the source text to the clipboard | |
--render | Force terminal rendering | |
--no-render | Never render to the terminal | |
--invert | Swap colors (for light terminals) | |
--quiet-zone | Terminal margin in modules (default: 2) | |
--module-size | PNG pixels per module (0 = auto) | |
--fg | Dark module color (#RGB or #RRGGBB) | |
--bg | Light module color (#RGB or #RRGGBB) | |
--transparent | Transparent PNG background | |
--border | PNG border in pixels (-1 = auto) | |
--shape | PNG module shape: square, circle | |
--logo | Center a PNG/JPEG logo on the PNG output | |
--logo-scale | Max logo size as 1/N of the code (0 = default of 5) | |
--help | -h | Show help |