Simple Shortcut Widget

Create a new widget from template

Select the menuitem "Create Widget..." from RainWidget's tray menu, it will auto create a new blank widget from template and open the widget's folder ,then you can see all the files of the new widget is "index.html" , "widget.json", we can modify them to build our own widgets.

Modify Widget Information

  1. You can modify the widget folder name "NewWidget" to any other you want,for excample "MyShortcut".

  2. Open the widget file "widget.json" with Notepad or Notepad++ , then you can see all the widget information and you can modify the name,author,widget size width/height to any other you want.

Add Shortcut Measure

  1. Found the "measures" json node in file "widget.json"

  2. Add a shortcut measure node code with this code and save and close this file:

"measures":{
  	"shortcut":{
  		"name":"shortcut1",  //use this name in index.html to get measure data
  		"title": "Notepad",  //shortcut display title 
  		"path": "c:/windows/notepad.exe",  //the filepath of shortcut
        "icon" : "img/icon.png", //the icon image filepath of shortcut
        "showCmd" : "3", //0=hide 1=ShowNormal 2=ShowMinisize 3=ShowMax
        "param" : "", //the param of shortcut
        //"directory" : "", //the startup directory path  
  	}
  }

Modify Widget UI

  1. Open the widget file "index.html" with Notepad or Notepad++

  2. Modify the text between <div id="widget"> and </div> to " {{ shortcut1.title }} ",then the code is: the "title" is one of the shortcut data tags, you can find all the data tags from here

  3. save and close this file

  4. Add this widget to your desktop or reload it (right click RainWidget's tray and select menuitem "reload"), then you can see the widget display the shortcut title "Notepad" on your desktop, click it will open the notepad.exe.

<div id="widget" v-bind:onClick="shortcut1.run"> {{ shortcut1.title }} </div>

Using Widget

  1. Add this widget to your desktop

  2. right click the widget and select menuitem "Settings" to open the widget setting window

  3. Switch to the "Shortut" tab page of setting window, config the shortcut title,path etc...

  4. Click "Apply" or "OK" button to save settings, the widget will auto update.

Last updated