arch/private_dot_config/DankMaterialShell/plugins/calculator/README.md
lew 809b12203c Add .config/DankMaterialShell/firefox.css
Add .config/DankMaterialShell/plugin_settings.json
Add .config/DankMaterialShell/plugins/calculator/CalculatorLauncher.qml
Add .config/DankMaterialShell/plugins/calculator/CalculatorSettings.qml
Add .config/DankMaterialShell/plugins/calculator/README.md
Add .config/DankMaterialShell/plugins/calculator/calculator.js
Add .config/DankMaterialShell/plugins/calculator/.git/HEAD
Add .config/DankMaterialShell/plugins/calculator/.git/config
Add .config/DankMaterialShell/plugins/calculator/.git/index
Add .config/DankMaterialShell/plugins/calculator/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.idx
Add .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.rev
Add .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.pack
Add .config/DankMaterialShell/plugins/calculator/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/qalc
Add .config/DankMaterialShell/plugins/calculator/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/calculator/plugin.json
Add .config/DankMaterialShell/plugins/calculator/screenshot.png
Add .config/DankMaterialShell/plugins/calculator/test_precision.js
Add .config/DankMaterialShell/plugins/calculator/test_single.js
Add .config/DankMaterialShell/plugins/commandRunner/CommandRunner.qml
Add .config/DankMaterialShell/plugins/commandRunner/CommandRunnerSettings.qml
Add .config/DankMaterialShell/plugins/commandRunner/LICENSE
Add .config/DankMaterialShell/plugins/commandRunner/README.md
Add .config/DankMaterialShell/plugins/commandRunner/.git/HEAD
Add .config/DankMaterialShell/plugins/commandRunner/.git/config
Add .config/DankMaterialShell/plugins/commandRunner/.git/index
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.idx
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.rev
Add .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.pack
Add .config/DankMaterialShell/plugins/commandRunner/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/commandRunner/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/commandRunner/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/commandRunner/plugin.json
Add .config/DankMaterialShell/plugins/commandRunner/screenshot.png
Add .config/DankMaterialShell/plugins/dankActions.meta
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsWidget.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlerts.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlertsSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooks.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooksSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/README.md
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroSettings.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroWidget.qml
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/plugin.json
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/LICENSE
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/README.md
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/HEAD
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/config
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/index
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.idx
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.rev
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.pack
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/heads/master
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/remotes/origin/master
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.gitignore
Add .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncher.qml
Add .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncherSettings.qml
Add .config/DankMaterialShell/plugins/emojiLauncher/LICENSE
Add .config/DankMaterialShell/plugins/emojiLauncher/README.md
Add .config/DankMaterialShell/plugins/emojiLauncher/catalog.js
Add .config/DankMaterialShell/plugins/emojiLauncher/data/emojis.txt
Add .config/DankMaterialShell/plugins/emojiLauncher/data/math.txt
Add .config/DankMaterialShell/plugins/emojiLauncher/data/nerdfont.txt
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/HEAD
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/config
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/index
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.idx
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.rev
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.pack
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/emojiLauncher/plugin.json
Add .config/DankMaterialShell/plugins/emojiLauncher/screenshot.png
Add .config/DankMaterialShell/plugins/emojiLauncher/scripts/generate_catalog.py
Add .config/DankMaterialShell/plugins/dankActions
Add .config/DankMaterialShell/plugins/webSearch/LICENSE
Add .config/DankMaterialShell/plugins/webSearch/README.md
Add .config/DankMaterialShell/plugins/webSearch/WebSearch.qml
Add .config/DankMaterialShell/plugins/webSearch/WebSearchSettings.qml
Add .config/DankMaterialShell/plugins/webSearch/.git/HEAD
Add .config/DankMaterialShell/plugins/webSearch/.git/config
Add .config/DankMaterialShell/plugins/webSearch/.git/index
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/info/.keep
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.idx
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.rev
Add .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.pack
Add .config/DankMaterialShell/plugins/webSearch/.git/refs/heads/main
Add .config/DankMaterialShell/plugins/webSearch/.git/refs/remotes/origin/main
Add .config/DankMaterialShell/plugins/webSearch/.git/refs/tags/.keep
Add .config/DankMaterialShell/plugins/webSearch/plugin.json
Add .config/DankMaterialShell/plugins/webSearch/screenshot.png
Add .config/DankMaterialShell/settings.json
2025-12-12 05:12:42 +00:00

4 KiB

Calculator Plugin for DMS Launcher

RELEASE

A launcher plugin that evaluates mathematical expressions and copies results to the clipboard.

Calculator Plugin Screenshot

Features

  • Real-time calculation: Type mathematical expressions directly in the launcher
  • Default prefix: Uses = as the default trigger prefix (configurable)
  • Safe evaluation: Only allows mathematical operations, preventing code injection
  • Clipboard integration: Press Enter to copy the result to clipboard
  • Multiple operations: Supports +, -, *, /, ^, %, and parentheses

Installation

Via DMS

dms plugins install Calculator

Via DMS GUI

  • Mod + ,
  • Go to Plugins Tab
  • Choose Browse
  • Enable third party
  • install Calculator

Manually

cd ~/.config/DankMaterialShell/plugins
git clone https://github.com/rochacbruno/DankCalculator Calculator
  1. Open DMS Settings (Ctrl+,)
  2. Navigate to Plugins tab
  3. Click "Scan for Plugins"
  4. Enable the "Calculator" plugin with the toggle switch

Usage

With Default Settings (= Prefix)

  1. Open the launcher (Ctrl+Space)
  2. Type the = prefix followed by a mathematical expression: = 3 + 3
  3. The result (6) appears as a launcher item
  4. Press Enter to copy the result to clipboard

Customizing the Trigger

You can configure a different trigger prefix or disable it entirely in the settings:

  1. Open Settings → Plugins → Calculator
  2. Change the trigger to a custom value (e.g., calc, c, math)
  3. Or check "No trigger (always active)" to remove the prefix requirement
  4. In the launcher, type your configured trigger: calc 3 + 3 or just 3 + 3 (if no trigger)
  5. Press Enter to copy the result

Adding a keybinding (niri)

binds {
      Mod+Shift+C hotkey-overlay-title="Calculator" {
        spawn "dms" "ipc" "call" "spotlight" "openQuery" "=";
    }
}

Supported Operations

  • Addition: = 3 + 36
  • Subtraction: = 10 - 55
  • Multiplication: = 4 * 728
  • Division: = 20 / 45
  • Exponentiation: = 2 ^ 8256
  • Modulo: = 17 % 52
  • Parentheses: = (5 + 3) * 216
  • Decimals: = 3.14 * 26.28
  • Complex: = (10 + 5) * 2 - 3 / 329

Examples

Expression Result
= 3 + 3 6
= 100 / 4 25
= 2 ^ 10 1024
= (5 + 3) * 2 16
= 3.14159 * 2 6.28318
= 16 ^ 0.5 4 (square root)

Security

The calculator uses safe expression evaluation:

  • Only allows numbers, operators (+, -, *, /, ^, %), parentheses, and dots
  • Rejects any expressions with letters or special characters (except operators)
  • Prevents code injection by validating input before evaluation

Files

  • plugin.json - Plugin manifest
  • CalculatorLauncher.qml - Main launcher component
  • CalculatorSettings.qml - Settings UI
  • calculator.js - Safe expression evaluation logic
  • README.md - This file

Configuration

Settings are stored in ~/.config/DankMaterialShell/plugin_settings.json under the calculator plugin key:

{
  "pluginSettings": {
    "calculator": {
      "trigger": "=",
      "noTrigger": false
    }
  }
}

Troubleshooting

Calculator items don't appear:

  • Make sure the plugin is enabled in Settings → Plugins
  • Check that you're typing a valid mathematical expression
  • Try disabling "No trigger" and setting a specific trigger

Result shows wrong value:

  • JavaScript has floating-point precision limitations
  • Very large or very small numbers may use scientific notation

Copy to clipboard doesn't work:

  • Make sure your system clipboard is accessible
  • Check console for error messages

Version

1.0.0

Author

Bruno Cesar Rocha

License

Same as DankMaterialShell