ffcv
Firefox Configuration Viewer - Parse and query Firefox preference files with ease.
ffcv is both a command-line tool and a Rust library for working with Firefox's prefs.js configuration files. It provides a structured way to parse, query, and understand Firefox settings across all platforms (Linux, macOS, Windows).
Features
- Complete Parsing - Handles all Firefox preference types:
- User preferences (
user_pref) - Default preferences (
pref) - Locked preferences (
lock_pref) - Sticky preferences (
sticky_pref)
- User preferences (
- Firefox Default Preferences - Extract and merge Firefox's built-in default preferences from omni.ja:
- Built-in defaults from omni.ja archives
- Global defaults from greprefs.js
- User preferences from prefs.js
- Proper precedence handling (built-ins < globals < user)
- Source tracking for each preference
- Firefox Installation Discovery - Automatic Firefox installation detection:
- Cross-platform support (Linux, macOS, Windows)
- Multiple Firefox version support (ESR, Release, Beta)
- Version detection from application.ini
- Powerful Querying - Filter preferences using glob patterns like
"network.*"or"browser.*.enabled" - Cross-Platform - Automatic Firefox profile discovery on Linux, macOS, and Windows
- Rich Data Types - Supports boolean, integer, float, string, and null values
- Type-Safe API - Convenience trait for easy value type checking and extraction
- Simple Interface - All public types and functions available at crate root
- Human-Readable Explanations - Optional explanations for what preferences do
- Flexible Output - JSON output with customizable formatting
- Well-Tested - Comprehensive test coverage with robust error handling
Installation
Command-Line Tool
Install via cargo:
This installs the ffcv binary for viewing Firefox configurations from your terminal.
Library Usage
Add to your Cargo.toml:
[]
= "1.1.0"
Command-Line Usage
List Firefox Profiles
# List all Firefox profiles on your system
# Specify a custom Firefox profiles directory
List Firefox Installations
# List detected Firefox installations
# List all Firefox installations (including multiple versions)
# Show detailed information about each installation
View Configuration
# View all preferences (includes Firefox defaults by default)
# View preferences for a specific profile
# Query specific preferences by glob pattern
# Get a single preference (raw output)
# View all preferences including built-in defaults
# View only user-modified preferences (default behavior)
# Specify custom Firefox installation directory
# Read from stdin
|
# Output as JSON (includes source information)
# Output as simple JSON object (no source information)
Library Usage
Basic Parsing
use parse_prefs_js;
use fs;
Query Preferences
use ;
use fs;
Profile Discovery
use list_profiles;
Firefox Installation Discovery
use find_firefox_installation;
Merge All Preferences
use ;
Working with Preference Values
use ;
Finding a Specific Profile
use find_profile_path;
API Design
ffcv provides a clean, simplified API with all public types and functions available at the crate root:
Core Types:
PrefEntry- A single preference entry with key, value, type, and sourcePrefType- The type of preference (User, Default, Locked, Sticky)PrefValue- The value of a preference (Bool, Int, Float, String, Null)PrefValueExt- Convenience trait for type-safe value accessPrefSource- Where a preference came from (BuiltIn, GlobalDefault, User, SystemPolicy)FirefoxInstallation- Metadata about a Firefox installationMergedPreferences- Combined preferences from multiple sources
Core Functions:
parse_prefs_js()- Parse preference file contentsparse_prefs_js_file()- Parse directly from a file pathquery_preferences()- Filter preferences by glob patternsmerge_all_preferences()- Merge preferences from all sourceslist_profiles()- List all Firefox profilesfind_profile_path()- Find a specific profile by namefind_firefox_installation()- Auto-detect Firefox installationget_prefs_path()- Get the prefs.js path for a profile
All functions return Result<T, Error> for proper error handling.
Preference Types
Firefox uses several types of preferences:
- User Preferences (
user_pref) - Set by the user - Default Preferences (
pref) - Application defaults - Locked Preferences (
lock_pref) - Administratively locked, cannot be changed - Sticky Preferences (
sticky_pref) - User preferences that persist across updates
Each preference has a value type:
- Boolean (
true/false) - Integer (64-bit)
- Float (64-bit)
- String (including JSON-encoded data)
- Null
Environment Variables
ffcv respects the following environment variables for Firefox profile discovery:
FIREFOX_BIN- Path to Firefox binaryMOZ_PROFILES_DIR- Custom Firefox profiles directoryPROGRAMFILES- Windows Program Files directory (for Firefox detection)HOME- User home directory (Unix-like systems)APPDATA- Application Data directory (Windows)
Documentation
Full API documentation is available on docs.rs.
To build and view the documentation locally:
Platform Support
ffcv is tested and supported on:
- Linux (x86_64, ARM64)
- macOS (x86_64, ARM64/Apple Silicon)
- Windows (x86_64)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is dual-licensed under either:
- MIT License (LICENSE-MIT.txt or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE-2.0.txt or http://www.apache.org/licenses/LICENSE-2.0)
You may choose either license for your use.
Version 1.0
ffcv provides a stable and well-tested API. The library offers a clean, simplified interface with comprehensive Firefox preference parsing capabilities. All public types and functions are available at the crate root for easy importing.
Acknowledgments
Built for the Rust community to make Firefox configuration management easier and more programmatic.
Inspired by the need for better tools to understand and manage Firefox's extensive preference system.