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 (
- 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.0.2"
Command-Line Usage
List Firefox Profiles
# List all Firefox profiles on your system
# Specify a custom Firefox profiles directory
View Configuration
# View all preferences for the default profile
# View preferences for a specific profile
# Query specific preferences by glob pattern
# Get a single preference (raw output)
# Read from stdin
|
# Output as JSON array
Library Usage
Basic Parsing
use parse_prefs_js;
use fs;
Query Preferences
use ;
use fs;
Profile Discovery
use list_profiles;
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, and typePrefType- 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 access
Core Functions:
parse_prefs_js()- Parse preference file contentsparse_prefs_js_file()- Parse directly from a file pathquery_preferences()- Filter preferences by glob patternslist_profiles()- List all Firefox profilesfind_profile_path()- Find a specific profile by nameget_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.