New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

electron-command-palette

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-command-palette

A nice-looking command palette for Electron

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Electron Command Palette

A nice-looking command palette for Electron

npm version Build Status XO code style Repo Status

PRESENTATION GIF

Features

  • Searchable
  • Highly customizable *
  • Show Title - Description - Shortcut and Category
  • Register local shortcuts *
  • Register custom actions on click *

* planned feature

FEATURE IMAGE

Installation

$ npm install --save electron-command-palette

Usage

Mandatory

renderer.js :

const CmdPalette = require("electron-command-palette");

let palette = new CmdPalette();

Add commands

const cmds       = require("./commands.json");

//JSON style
palette.add(cmds);

//inline style
palette.add({
    "title": "New project",
    "category": "Project",
    "description": "Create a new project from scratch",
    "shortcut": "CmdOrCtrl+Shift+N",
    "action": "newproject"
})

commands.json :

[
  {
    "title": "New project",
    "category": "Project",
    "description": "Create a new project from scratch",
    "shortcut": "CmdOrCtrl+Shift+N",
    "action": "newproject"
  },
  {
      "title": "Title",
      "category": "Optional categoty",
      "description": "optional description",
      "shortcut": "Electron accelerator",
      "action": "Name of the function previously registered"
    }
]

Register functions

renderer.js:

const functions  = require("./functions");

//Module style
palette.register(functions);

//Inline style
palette.register("saveproject", function() {
	Project.save();
});

functions.js:

module.exports = [
	{
		"key"   : "newproject",
		"action": function () {
			console.log("Save project");
		}
	},
	{
		"key"   : "openproject",
		"action": function () {
			console.log("Open project");
		}
	}
];

Display

palette.show();
palette.hide();

TODO

  • Tidy repo
  • Register functions
  • register shortcuts
  • Trigger correct action on click
  • Fix bad fuzzy search
  • Customization options (position, CSS classes, themes)

Contributors

License

MIT © Armaldio

Keywords

command-palette

FAQs

Package last updated on 24 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts