Skip to content

Add Variable Substitution to Page Title with Dynamic Favicon Support #270

@amgtree

Description

@amgtree

Description:
Enhance the existing title customization feature to support dynamic variables that automatically update based on the current calculation state. Additionally, provide the option to set the website favicon to match the primary recipe being calculated.

Current Limitation:
The title setting only accepts static text. Users managing multiple calculator tabs must manually update titles or rely on memory to distinguish between different calculations.

Proposed Variable System:

  • Unix-style token formatting (e.g., %item, %recipe, %rate)
  • Real-time updates as calculations change
  • Fallback values for empty states

Suggested Variables:

  • %item - Primary target item name
  • %recipe - Main recipe being calculated
  • %rate - Production rate with units
  • %buildings - Primary building type
  • %modules - Module configuration summary
  • %throughput - Total throughput summary
  • %belt - Selected belt type
  • %timestamp - Last calculation time
  • %targets - Number of build targets

Example Templates:

  • "Factorio: %item @ %rate""Factorio: Advanced Circuit @ 45.2/m"
  • "%recipe | %buildings""Advanced Circuit | Assembly Machine 3"
  • "[%belt] %item production""[Fast Belt] Advanced Circuit production"

Dynamic Favicon Feature:

  • Checkbox option "Use recipe icon as favicon"
  • Automatically updates favicon to match the primary recipe
  • Falls back to default Factorio icon when no recipe selected
  • Handles multi-target scenarios with primary target priority

Use Cases:

  • Multi-Tab Management: Quickly identify tabs by recipe/item in browser
  • Session Organization: Distinguish between different calculation sessions
  • Shared Screenshots: Contextual titles in screenshots and recordings
  • Visual Navigation: Recipe icons in browser tabs for instant recognition

Technical Implementation:

  • Template parsing system with validation
  • Real-time title updates on calculation changes
  • Favicon generation from existing sprite sheet
  • Graceful handling of undefined variables

User Interface:

  • Enhanced title input field with variable picker/helper
  • Preview of rendered title below input
  • Favicon toggle checkbox in settings
  • Variable reference documentation

Alternative Approaches:

  • Predefined template presets for common use cases
  • Context-sensitive variable suggestions
  • Advanced formatting options (truncation, padding)
  • Integration with browser bookmark naming

TL;DR: Replace static title input with dynamic template system supporting calculation variables, plus optional recipe-based favicon updates for better tab management.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions