Woxplugin

Developing a plugin for WOX - an open source 'launcher' for windows

First of all you need to install the Wox launcher and figure out how it works: press alt+space and WOX should apear on center of the screen

The WOX launcher is automatically started and you can close it by clicking the WOX icon next to the clock in the lower roght corner. Try and type 'settings' in the launcher and and choose 'settings' for WOX. a window will open and you can see which plugins that already exists in the default installation and you can cahnge the theme and other details.

In order to build your own plugin you need to create a .dll file and a short json file that describe the details of your plugin. You can read all the details in the documentation or follow my short tutorial where I build a small plugin that enables a built-in text-to-speech feature in windows. I found som details missing in the documentation but together with the hello world example It is quit easy to build your own plugin.

My plugin in action

How to build a plugin:

Step 1: Create a 'Class Library'

Start your Visual Studio and create a Class library - Choose

Step 2: install a nuget package

You need to install the nuget package called 'wox.plugin' - that package will you provide you with the necessary interface 'Wox.IPlugin'. If you haven't installed nuget packages before you can find see how it's done here: https://docs.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-studio

Step 3: Rename Class1 and implement the Plugin interface

https://github.com/Wox-launcher/Wox/tree/master/Plugins/HelloWorldCSharp

Your .dll Component

using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
using Wox.Plugin;
public class Main : IPlugin
    {
        public List<Result> Query(Query query)
        {
            List<Result> results = new List<Result>();
            Result result = new Result();

            result.Title = "Say";
            String sentence = query.RawQuery.Substring(4);
            result.SubTitle = sentence;
            result.Action = e =>
            {
                // Initialize a new instance of the SpeechSynthesizer.
                SpeechSynthesizer synth = new SpeechSynthesizer();

                // Configure the audio output.
                synth.SetOutputToDefaultAudioDevice();

                // Speak a string.
                synth.Speak(sentence);

                return false;
            };

            results.Add(result);
            return results;

        }

        public void Init(PluginInitContext context)
        {

        }
    }
}

plugin.json

{
    "ID":"CEA0FDFC6D3B4085823D60DC76F54321",
    "ActionKeyword":"say",
    "Name":"sayPlugin",
    "Description":"using windows SpeechSynthesizer to talk",
    "Author":"Ebbe Vang",
    "Version":"1.0.0",
    "Language":"csharp",
    "Website":"evang.dk",
    "ExecuteFileName":"SayPlugin.dll",
    "IcoPath":"say.png"
}

Feel free to take a look at my plugin on github