World Conquest Chronicles

World Conquest Chronicles

Motivator, v1.2.1

The utility for repeatedly displaying notifications in the standard OS way.

Use a delay relative to the last displaying for displaying notifications on a schedule; make optional automatic generation of a task name; support for hiding the app name.

Change Log

  • use for displaying notifications on a schedule:
  • make optional:
    • automatic generation of a task name, if it was not specified;
    • add a sequential number to duplicated task names;
    • support for seconds in the cron specification;
  • support for hiding the app name.

Features

  • support for several different tasks for displaying notifications:
    • for each task:
      • support for displaying a task name:
        • automatic generation of a task name, if it was not specified (optionally);
        • add a sequential number to duplicated task names (optionally);
      • support for displaying an icon for each notification:
        • an icon can be specified for:
          • a notification;
          • a task;
          • the entire config;
        • for each notification, the first specified icon is selected in the order above;
      • use for displaying notifications on a schedule:
        • the cron specification:
          • support for seconds in the cron specification (optionally);
        • a delay relative to the last displaying:
      • random selection of a notification for displaying;
      • support for the Spintax format in notifications;
  • support for variable substitution in notifications:
    • use the format of the os.Expand() function;
    • use one common list of variables to substitute in all notifications of all tasks;
  • built-in support for running in the background:
    • the console command for starting and restarting;
    • the console command for stopping;
    • the console command for checking of the current running status.

Config

Format of the config in the JSON Schema format:

{
  "type": "object",
  "required": ["tasks"],
  "properties": {
    "icon": {
      "type": "string",
      "description": "the path to the icon file"
    },
    "tasks": {
      "type": "array",
      "minItems": 1,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "required": ["cron", "phrases"],
            "properties": {
              "name": {
                "type": "string"
              },
              "useOriginalName": {
                "type": "boolean",
                "default": false
              },
              "icon": {
                "type": "string",
                "description": "the path to the icon file"
              },
              "cron": {
                "type": "string",
                "description": "in the format of the `cron` specification"
              },
              "phrases": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "required": ["text"],
                  "properties": {
                    "icon": {
                      "type": "string",
                      "description": "the path to the icon file"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": ["delay", "phrases"],
            "properties": {
              "name": {
                "type": "string"
              },
              "useOriginalName": {
                "type": "boolean",
                "default": false
              },
              "icon": {
                "type": "string",
                "description": "the path to the icon file"
              },
              "delay": {
                "type": "string",
                "description": "in the format of the `time.ParseDuration()` function"
              },
              "phrases": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "required": ["text"],
                  "properties": {
                    "icon": {
                      "type": "string",
                      "description": "the path to the icon file"
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        ]
      }
    },
    "variables": {
      "type": "object",
      "patternProperties": {
        "[A-Za-z0-9_]": {
          "type": "string"
        }
      }
    },
    "hideAppName": {
      "type": "boolean",
      "default": false
    },
    "useOriginalTaskName": {
      "type": "boolean",
      "default": false
    }
  }
}

Example of the config:

{
  "icon": "assets/power_fist.png",
  "tasks": [
    {
      "name": "Greetings",
      "icon": "assets/tube_only_please.png",
      "cron": "*/5 * * * * *",
      "phrases": [
        {
          "icon": "assets/no_transistor.png",
          "text": "$GREETING $SUBJECT, {hope {you're|you are} {okay|good}|have a nice day}"
        },
        {
          "text": "$GREETING{ $SUBJECT|}, how are you today?"
        }
      ]
    },
    {
      "name": "Rare Notifications",
      "cron": "* * * * *",
      "phrases": [
        {
          "text": "Rare notification"
        }
      ]
    },
    {
      "name": "Pangrams",
      "delay": "10s",
      "phrases": [
        {
          "text": "The {slow|quick} {fox|deer} {gracefully |}jumps over the {sleeping|lazy} dog"
        }
      ]
    },
    {
      "name": "",
      "useOriginalName": true,
      "delay": "10s",
      "phrases": [
        {
          "text": "The notification with an empty task name"
        }
      ]
    }
  ],
  "variables": {
    "GREETING": "{Hello|Hey}",
    "SUBJECT": "world"
  },
  "hideAppName": false,
  "useOriginalTaskName": false
}

Repository

Link: https://github.com/thewizardplusplus/motivator/tree/v1.2.1.

Content: code.

License: MIT.