Bin Scripts

Bin Scripts Reference

All scripts in bin/ are invoked via hey .<script> (e.g. hey .lock). The dev hey resolves them from the working tree via the lib/hey symlink; the system hey resolves them from $DOTFILES_HOME/bin/ (nix store). See toolchain.md for the full resolution mechanism.

WM & Desktop Integration

ScriptDescription
lock.zshUnified screen lock dispatcher — routes to hyprlock/niri lock/swaylock based on active WM
open-term.zshSingleton terminal orchestrator for tmux sessions. Opens or focuses existing terminal
clone-term.zshOpen a new terminal in the cwd of the currently focused window
picker.zshGrab a color from screen (hyprpicker on Hyprland, niri equivalent)
screenshot.zshCapture and optionally edit screenshots to clipboard + file. Supports region/window/output/screen
screencast.zshRecord screen region to clipboard as webm/mp4/gif
screendraw.zshToggle drawing overlay on screen
slurp.zshSelect a monitor/region/window with slurp (Wayland region selector)
get-window.zshSelect a window with slurp and query its metadata
get-activeworkspace.zshReturn the { id, name } of the currently active workspace
set-monitors.zshEnable given monitors, disable the rest. --on/--off per output
toggle-zoom.zshToggle screen zoom (magnification) at given scale
toggle-notifications.zshToggle do-not-disturb mode (WM-aware)

Keybindings & Launcher

ScriptDescription
keybinds.zshParse docs/keybindings.md and display searchable rofi menu of all keybindings
toggle-caffeine.zshToggle caffeine mode — prevents auto-suspend and auto-hibernate
quitactive.zshKill (close) the currently selected/focused window

Media & Screen Capture Sub-commands

osd.d/ — On-Screen Display (via hey .osd)

ScriptDescription
osd.d/volume.zshShow/adjust volume OSD
osd.d/brightness.zshShow/adjust brightness OSD
osd.d/toggle.zshToggle mute/mic mute with OSD feedback

scratch.d/ — Scratch Terminals

ScriptDescription
scratch.d/termDrop-down scratch terminal
scratch.d/emacsDrop-down scratch Emacs frame

Event Hooks (hooks/)

Invoked by hey hook <name>. Searches host-specific, WM-specific, then global hooks.

HookDescription
hooks/battery.zshReact to battery level changes (low battery warning, charge status)
hooks/idle.zshReact to idle timeout (dim screen, lock, suspend)
hooks/gamemode.zshEnable/disable performance mode for gaming (CPU governor, GPU clock)

AI & LLM Tools

ScriptDescription
commit-gen.zshGenerate conventional commit messages from staged git diff via local LLM. --funny for humor, --copy to clipboard
roast.zshAI-generated system roast from system info
fortune.zshAI developer fortune or tip of the day (--tip for practical tips)
ascii-art-plot.zshGenerate ASCII art via LLM
translate.zshTerminal translator using local Ollama model (translategemma). -s SRC -t TARGET

Dev & System

ScriptDescription
tmpfs-usage.zshScan ~/.cache, ~/.config, ~/.local for actual tmpfs usage. Skips bind mounts (persist) and nix store symlinks. -a show all, -t 1M filter by threshold
arch.zshEnter the Arch Linux Distrobox container
waydroid.zshManage Waydroid Android container — start, stop, show, status, init, register
start-usb-test.zshBoot a UEFI VM from USB device for testing (e.g. lab-nomad)
lsiommu.zshList IOMMU groups for PCI passthrough
export-env.zshPropagate env vars to systemd user services or tmux sessions
set-monitors.zshEnable/disable monitors by output name
hypr-ws.zshManage Hyprland relative workspaces per monitor (1-9). Actions: workspace, movetoworkspace, movetoworkspacesilent

Media & Utilities

ScriptDescription
ytdl.zshDownload audio from YouTube URL via yt-dlp to ~/downloads/music
qr.zshGenerate QR code from text/file to terminal
scan-qr.zshScan QR code from screen region
termcolors.shPrint a terminal color spectrum test pattern (24-bit true color)
get-font.zshReturn the primary terminal font. --xft for Xft format, -c condensed, -s size only, -n name only
play-sound.zshPlay a notification sound by name from the theme’s sound directory
optimize.zshLosslessly optimize images and PDFs. -l lossy, -h help
screenshot.zshCapture screenshots. Modes: region, window, output, screen. -s/--swappy for Swappy editor, -o for optimize
fetch-daily-wallpaper.zshDownload daily wallpaper from bing (default), nature, science, or random
fortune.zshDisplay a random fortune or developer tip
timein.zshOpen time.is for a given city/location
when.zshDisplay human-readable duration since/until a datetime

Maintenance & Diagnostics

ScriptDescription
fleet-check.zshComprehensive systemd health check across the fleet. --help for full service table. Catches failed AND stuck (auto-restart) services
checklist-email.zshVerify email infrastructure: port 25 outbound, PTR, DKIM key, Cloudflare token, MX/SPF/DKIM/DMARC DNS records
analyze-firefox.zshParse Firefox user.js for conflicts, anti-patterns, and performance issues. --auto, --profile DIR, --nix HOST
setup-kanidm.zshInteractive Kanidm bootstrap helper. Run on lab-matrix after first deploy. --help for step-by-step guide
manage-email-dns.zshManage email DNS records (MX, SPF, DKIM, DMARC) via Cloudflare API

Helpers (rarely called directly)

ScriptDescription
autoclicker.zshRapid auto-clicker (needs xdotool) — mainly for idle games
slurp.zshWrapper around slurp for region/window/output selection. Used by screenshot/screencast/etc

Resolution & Execution Flow

hey .<script> [args...]


dispatch-1 (init.janet)

    resolve() searches:
    1. hosts/$HOST/bin/<script>.{janet,zsh,sh}
    2. config/$WM/bin/<script>.{janet,zsh,sh}
    3. $DOTFILES_HOME/bin/<script>.{janet,zsh,sh}


    os/execute <script> [args] :p
    (passes environment with PATH and DOTFILES_HOME)

Dev vs System Resolution

AspectDev (hey build hey)System (/run/current-system/sw/bin/hey)
DOTFILES_HOMEDerived from lib/hey symlink in JANET_TREE$DOTFILES_HOME env var (nix store path)
Script sourceWorking tree (~/toolkits/.../dotfiles_dev/bin/)Nix store (/nix/store/...source/bin/)
New scriptsAvailable immediately after writingRequires hey sync to deploy
Works from any dirYes (symlink-based detection)Yes (env var)

Path Search Priority

The resolve() function searches in this order:

  1. Host-specific: $DOTFILES_HOME/hosts/$HOST/bin/ — machine overrides
  2. WM-specific: $DOTFILES_HOME/config/$WM/bin/ — compositor overrides
  3. Global: $DOTFILES_HOME/bin/ — shared implementations

Each base is searched for extensions in order: .janet, .zsh, .sh, "" (no extension).