Skip to content

shouhanzen/CommandPalette

Repository files navigation

Palette

Using Palette, you can do anything from just your keyboard. Open websites, applications, games, control your music, and open/manage windows all from the same place, with a simple sequence of keypresses. No more wondering if Windows Start Menu supports what you want to do.

Summon Palette at will with a keyboard shortcut (Ctrl-Shift-Alt-P by default). Dismiss it with any number of actions. Palette seeks to be as inobtrusive and hidden as possible. Use command tags and Palette's complex character matching features to quickly find your command in a short sequence of characters (find out more here). I made this project in the hopes of accelerating my workflow, and I hope it can do the same for you.

image

Features

As of right now, Palette can:

  • Open websites (acting as a unified bookmark system)
  • Run scripts in shells like Powershell and Git Bash
  • Control your Spotify
  • Run applications
  • Open and close windows

Controls

# Opening and Hiding the Palette:
Ctrl+Shift+Alt+P (Windows)
Option+Shift+P (MacOS)

Enter executes the highlighted command
Tab tabs through the available commads
Esc hides the Palette
Ctrl+R refreshes the Palette and reloads the commands

Installation

Palette is currently available on Windows and Mac. Go ahead and download from the Releases section!

Architecture

Palette contains an Electron client that serves the GUI, alongside a Python FastAPI server that provides and executes commands. The Electron renderer uses Next JS to build its UI.

image

The Palette client can GET commands from the backend and tell the backend to execute a command with POST run-command. When the Palette client spawns, it will spin up the backend server. But in the case that the UI creates before the backend is alive, the client will repeatedly ping the backend's health endpoint, and retrieve the backend's provided commands when it comes to life.

The Palette client's frontend is generated by Next JS and packaged into the Electron application.

Developing

First, pull the repo.

Backend setup

Create the python virtual environment (in /backend, most likely). Install pip requirements from /backend/requirements.txt

Commands to do so:

cd backend
python -m venv .venv

source .venv/bin/activate # mac/linux
source .venv/Scripts/activate # windows

pip install -r requirements.txt

You can now start the backend with the following command.

# In /
make backend

This will spawn the FastAPI server with reload enabled, meaning changes made to the source code will trigger hot reloads.

Frontend setup

Electron uses Node JS so we will need at least Node 14. Perform the following commands to install the required node modules.

cd frontend
npm install

To start the frontend, run

# In /
make frontend

This will spawn the NextJS dev server and the Electron client. In a moment, you should see the Palette appear on screen.

Go to tutorials/ to see a couple of tutorials on ways you can contribute to this project.

TODO

  • Make it so you can spawn the Palette backend separately, and connect Palette clients to it
  • Permit Palette clients to connect to multiple Palette backends
  • Persist command MRU to disk