Skip to main content

Crate hyprforge_paths

Crate hyprforge_paths 

Source
Expand description

Where Hyprforge keeps things, and how it writes them.

Every app in the suite needs these two answers and nothing else from them: which directory is mine, and how do I replace a file without ever leaving a half-written one on disk. Neither question has anything to do with Hyprland, a GUI toolkit, or Lua, so neither does this crate — it has no dependencies at all.

Paths that are Hyprland-specific (hypr/hyprforge/*.lua, the generated config artifacts) live in hyprforge-core instead.

user_dirs is the one module with a third answer — where your Pictures and Downloads are — and it belongs here for the same reason: two apps ask it, and it needs nothing but std.

Modules§

user_dirs
The XDG user directories — Documents, Downloads, Pictures, Music, Videos, Desktop — read from ~/.config/user-dirs.dirs rather than hardcoded, so a sidebar built on a machine set up in another language shows that language’s own folder names instead of a translated set of English guesses sitting next to directories that don’t exist.

Functions§

appearance_toml_path
The Appearance module’s stored settings, read when resolving the shared theme.
clipboard_dir
Where the clipboard manager keeps its history. Its own subdirectory, not a file directly under hyprforge_config_dir(), because the index is one file but image content is one file per entry — see clipboard_images_dir — and both need a directory to live in.
clipboard_image_path
The path for one clipboard entry’s image bytes, keyed by its EntryId (as returned by EntryId::as_str) so the index and the file agree on which entry a file belongs to without either side having to store the other’s full path.
clipboard_images_dir
Where clipboard image bytes are kept, one file per entry, named by its content hash. Inlining a screenshot’s bytes into the index as base64 would make that file unreadable by eye, unparseable at any real size, and would mean rewriting the whole index — text entries included — every time a single image is added or evicted.
clipboard_index_path
The clipboard history’s index: ids, timestamps, pins, text content and image references. Never image bytes themselves — see clipboard_images_dir for why those live elsewhere.
config_home
$XDG_CONFIG_HOME, falling back to ~/.config.
data_home
$XDG_DATA_HOME, falling back to ~/.local/share — the XDG base directory for user-specific data, as opposed to config. Added for hyprforge-fileops, which needs it for the trash spec’s home trash ($XDG_DATA_HOME/Trash); mirrors config_home exactly; per the XDG spec a relative value is invalid and must be treated as unset.
emojimenu_toml_path
The emoji picker’s own preferences — currently just the default skin tone a long-press (or its keyboard equivalent) sets. Lives beside tray.toml/appearance.toml rather than the picker inventing its own directory, for the same reason every other single-file Hyprforge setting does: one place a person restoring their dotfiles from a backup already knows to look. A missing file here is first-run, never an error — see hyprforge-emojimenu::config’s own doc for how it tells that apart from a file that exists but will not parse.
files_config_toml_path
The file browser’s hand-written configuration — key bindings, and later menus and behaviour switches.
files_session_toml_path
The tabs the file browser had open when it last closed, and which one was in front — what it reopens on next time.
files_toml_path
The file browser’s remembered state — sort order, view mode, whether the preview pane is on, window size. Same one-file-beside-the-others convention as tray.toml/emojimenu.toml.
hyprforge_config_dir
$XDG_CONFIG_HOME/hyprforge — canonical storage for all Hyprforge-owned config (display profiles, window-rules TOML).
lock_toml_path
The lock screen’s theme, written by Settings and read by hyprforge-lock. The greeter cannot use this one — it runs as its own user and a home directory is drwx------ — so it reads an exported copy instead.
media_config_toml_path
The image viewer’s hand-written configuration — its key bindings.
media_toml_path
The image viewer’s remembered state — window size, and whether the filmstrip and info panel are showing.
tray_toml_path
Which tray icons the user wants, written by Settings and re-read by hyprforge-trayd on every poll so a toggle takes effect without restarting anything.
write_atomic
Write contents to path atomically and durably: write a sibling temp file, flush it to disk, rename over the target, then flush the directory.
write_atomic_bytes
The same guarantee as write_atomic, for content that is not text — clipboard image bytes, specifically. Kept as a second entry point rather than making write_atomic generic over AsRef<[u8]>. so every existing caller (all of which pass &str) keeps its exact signature.