Advanced Calculator - ArunPrakashG/native-launcher GitHub Wiki
Advanced Calculator
The Advanced Calculator plugin extends Native Launcher with powerful natural language calculation capabilities beyond basic math expressions.
Overview
Command Prefixes: @calc, @convert, @time, @currency
Priority: 850 (high priority for calculation results)
Enabled: Automatically when calculator plugin is enabled
Features
🕐 Time Calculations
Calculate past and future dates with natural language queries.
Past Times
1 second ago
5 minutes ago
2 hours ago
3 days ago
350 days ago
2 years ago
Output Formats:
- Local time:
2024-10-21 14:30:00 - UTC time:
2024-10-21 18:30:00 UTC - Unix timestamp:
1729527000
Future Times
in 30 seconds
in 10 minutes
in 2 hours
in 5 days
5 weeks from now
in 1 year
Example:
Query: "1 hour ago"
Results:
→ 2024-10-21 21:30:00 (Local time) • Press Enter to copy
→ 2024-10-21 01:30:00 UTC (UTC time) • Press Enter to copy
→ Unix timestamp: 1729557000 • Press Enter to copy
📏 Unit Conversions
Convert between different units with natural language.
Time Units
Syntax: [value] [from_unit] to [to_unit]
Examples:
150 days to years → 0.41 years
500 minutes to hours → 8.33 hours
24 hours to days → 1.00 day
365 days to years → 1.00 year
Supported Units:
second(s),minute(s),hour(s),day(s),week(s),month(s),year(s)- Aliases:
s,sec,m,min,h,hr,d,w,y
Distance Units
Examples:
5 km to miles → 3.1069 miles
100 feet to meters → 30.48 meters
10 miles to km → 16.0934 km
50 inches to cm → 127.00 cm
Supported Units:
- Metric:
mm,cm,m,km - Imperial:
inch(es),foot/feet,yard(s),mile(s) - Aliases:
in,ft,yd,mi
Weight Units
Examples:
100 pounds to kg → 45.36 kg
500 grams to ounces → 17.64 oz
2 tons to kg → 1814.37 kg
5 kg to pounds → 11.02 lb
Supported Units:
- Metric:
mg,g,kg - Imperial:
oz,lb,ton(s) - Full names:
milligram,gram,kilogram,ounce,pound
Temperature
Examples:
32 fahrenheit to celsius → 0.00°C
100 celsius to fahrenheit → 212.00°F
273 kelvin to celsius → -0.15°C
-40 fahrenheit to celsius → -40.00°C
Supported Units: celsius, fahrenheit, kelvin (or c, f, k)
💱 Currency Conversions
Convert between major world currencies.
Syntax: [amount] [FROM] to [TO]
Examples:
100 USD to EUR → 92.00 EUR
50 GBP to JPY → 9,419 JPY
1000 INR to USD → 12.03 USD
25 EUR to CAD → 36.96 CAD
Supported Currencies:
- 🇺🇸 USD - US Dollar
- 🇪🇺 EUR - Euro
- 🇬🇧 GBP - British Pound
- 🇯🇵 JPY - Japanese Yen
- 🇨🇳 CNY - Chinese Yuan
- 🇮🇳 INR - Indian Rupee
- 🇨🇦 CAD - Canadian Dollar
- 🇦🇺 AUD - Australian Dollar
- 🇨🇭 CHF - Swiss Franc
- 🇰🇷 KRW - South Korean Won
Note: Currently uses static 2024 exchange rates. Live API integration planned for future releases.
🌍 Timezone Information
Get current time in different timezones.
Query: "now in UTC"
Results:
→ Local: 2024-10-21 22:30:00 BST • Press Enter to copy
→ UTC: 2024-10-22 01:30:00 UTC • Press Enter to copy
Future enhancements planned:
- Specific timezone conversions ("5pm EST to PST")
- Multiple timezone display
- DST-aware calculations
Clipboard Integration
One-Press Copy
All time calculation results can be copied to clipboard with a single keypress:
- Type your query (e.g., "1 hour ago")
- Navigate to desired result
- Press
Enterto copy - Desktop notification confirms copy
- Paste anywhere with
Ctrl+V
Desktop Notifications
When you copy a result, you'll see:
🔔 Copied to Clipboard
2024-10-21 22:30:00
Requirements
Clipboard functionality requires wl-clipboard package:
# Ubuntu/Debian
sudo apt install wl-clipboard
# Arch Linux
sudo pacman -S wl-clipboard
# Fedora
sudo dnf install wl-clipboard
Usage Tips
Natural Language
The plugin is forgiving with natural language:
- "5 km to miles" = "5 kilometers to mile" = "5km to mi"
- Plural/singular both work: "1 day" = "1 days"
- Case-insensitive (except currency codes)
Command Prefixes
You can explicitly trigger the plugin:
@calc 150 days to years
@convert 5 km to miles
@time 1 hour ago
@currency 100 USD to EUR
Instant Results
No need for prefixes - just start typing:
- Results appear inline with other search results
- Calculator results scored high for visibility
- Subtitle hints show "Press Enter to copy"
Decimal Values
All conversions support decimal values:
5.5 km to miles
100.50 USD to EUR
0.5 days to hours
Configuration
The advanced calculator is automatically enabled when the calculator plugin is enabled in config.toml:
[plugins]
calculator = true # Enables both basic and advanced calculator
Common Use Cases
Travel Planning
5 hours from now → Flight arrival time
10 miles to km → Distance conversion
100 USD to EUR → Currency exchange
Cooking & Recipes
350 fahrenheit to celsius → Oven temperature
500 grams to pounds → Ingredient weight
Fitness Tracking
5 km to miles → Running distance
150 pounds to kg → Body weight
3 hours ago → Workout start time
Project Planning
30 days to weeks → Project duration
5 hours to minutes → Time estimation
350 days ago → Project start date
International Communication
now in UTC → Current time for global team
100 EUR to USD → Invoice conversion
Keyboard Shortcuts
| Key | Action |
|---|---|
Enter |
Copy result to clipboard + show notification |
Ctrl+C |
Copy result to clipboard + show notification |
↑ / ↓ |
Navigate between results |
Esc |
Close launcher |
Troubleshooting
No Results Shown?
- Check spelling of units
- Ensure "to" is between units (not "-", ">", etc.)
- For currency, use 3-letter codes (USD, not Dollar)
- For time queries, include "ago" or "in"/"from now"
Wrong Results?
- Currency rates are static (2024) - live rates coming soon
- Month = 30 days, Year = 365 days (approximate)
- Temperature conversions use standard formulas
- Check decimal separator (use dot: 5.5, not comma: 5,5)
Plugin Not Working?
- Ensure calculator plugin is enabled in config
- Rebuild:
cargo build --release - Check logs:
RUST_LOG=debug ./native-launcher
Clipboard Not Working?
- Install wl-clipboard:
sudo apt install wl-clipboard - Check if wl-copy is in PATH:
which wl-copy - Test manually:
echo "test" | wl-copy && wl-paste
Technical Details
Performance
- Startup impact: <1ms (no initialization overhead)
- Query latency: <1ms for all calculation types
- Memory footprint: ~100KB (currency rates HashMap)
- Clipboard copy: One-shot command execution, no background processes
Implementation
- Time parsing: Regex patterns for natural language
- Unit conversion: Intermediate base unit (seconds, meters, grams)
- Currency: Direct rate multiplication with USD as base
- Scoring: 9500 (primary), 9400 (secondary), 9300 (tertiary)
File Structure
src/plugins/advanced_calc.rs # Main plugin implementation
tests/advanced_calc_tests.rs # Comprehensive test suite
docs/ADVANCED_CALCULATOR.md # Complete documentation
docs/QUICK_REFERENCE_ADVANCED_CALC.md # Quick reference card
examples/clipboard_demo.sh # Usage demonstration
Future Enhancements
Planned Features
-
Live Currency Rates
- Integrate with exchangerate-api.com
- Cache rates with refresh intervals
- Show last update time
-
Extended Timezone Support
- Named timezone conversions
- "5pm EST to PST" queries
- DST-aware calculations
-
More Unit Types
- Volume (liters, gallons, cups)
- Area (square meters, acres)
- Speed (mph, km/h, knots)
- Data (bytes, KB, MB, GB, TB)
-
Expression Evaluation
- Combine with basic calculator
- Chain conversions
- Percentage calculations
-
Historical Calculations
- Days between dates
- Business days calculator
- Age calculations
Examples Gallery
Time Calculations

Unit Conversions

Currency Exchange

See Also
- Plugin System - Overview of all plugins
- Keyboard Shortcuts - Complete keyboard reference
- Configuration - Customizing calculator behavior
Need Help?
- Documentation: See docs/ADVANCED_CALCULATOR.md
- Examples: Run
examples/advanced_calculator_examples.sh - Issues: Report on GitHub Issues
- Discussions: Ask on GitHub Discussions
Last Updated: October 2025
Plugin Version: 0.1.0
Status: Stable