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.dirsrather 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 — seeclipboard_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 byEntryId::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_dirfor 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 forhyprforge-fileops, which needs it for the trash spec’s home trash ($XDG_DATA_HOME/Trash); mirrorsconfig_homeexactly; 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.tomlrather 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 — seehyprforge-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 isdrwx------— 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-traydon every poll so a toggle takes effect without restarting anything. - write_
atomic - Write
contentstopathatomically 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 makingwrite_atomicgeneric overAsRef<[u8]>. so every existing caller (all of which pass&str) keeps its exact signature.