• Stars
    star
    182
  • Rank 211,154 (Top 5 %)
  • Language
    Common Lisp
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Common Lisp tool for automating tasks for Unix power-users.

Powerlisp

Common Lisp tool for automating tasks for Unix power-users.

Abstract

Powerlisp is a simple and flexible tool which helps you automate your work. With the aid of dmenu or rofi, this Lisp script allows you to:

  • Navigate directly to your favorite websites, in your favorite browser (including incognito mode);
  • Search the web on your favorite search engine (and switch search engines as well);
  • Use flexible configuration files written on Lisp, provided by hygienic user bindings;
  • Create your own menus, submenus and input, while allowing you to extend it from within the user bindings, in any way you want;
  • Hack it any way you’d want and make it yours!

This tool is written with dmenu and/or rofi in mind, plus notify-send for desktop notifications, and only runs using the sbcl compiler. While it is certainly possible to use other implementations, those may require implementation-specific extensions, which is what I am using.

I opted for this instead of using any external, cross-implementation package (such as Quicklisp) for performance reasons.

Motivation

Back in the day, I used to have a simple tool written in Bash which would allow me to open menus and nest them just like you see. The purpose was just to store my favorite websites and perform searches on the internet, without directly opening the browser in order to do so.

Turns out this approach wasn’t very flexible, and extremely hackish; this made me realize that bash is also not a language you would want to mess up with, when things get heated, due to its lack of easy support to trivial tasks such as string manipulation and this sort of thing.

At this point, there were two things I could do: either switch to a shell which gives me better scripting capabilities, or use an actual programming language to rewrite this tool altogether. As you can see, I chose the latter.

So, why Lisp? Well, because I could, and also to prove a point. Most tools nowadays are written in Javascript or Python, two languages which can be much slower than Common Lisp at times. However, Common Lisp is a perfectly functional and powerful language, albeit a little old. Plus, I just did not want to choose those languages, since we see them running everywhere, even though sometimes it is not the best use case. Instead, I went ahead and start taking advantage of CL’s scripting support, something that was already being used on tools such as Roswell, for example.

And so the first version of this tool arised, though it was a bit lacking; but little by little, I started adding things to my taste, which I felt would improve my workflow.

Usage

All you need to do is invoke the script using a command line:

sbcl --script /path/to/powerlisp.lisp --no-linedit

You can input this command on your favorite tool for managing keybindings, which is native on window managers such as openbox, for example. On my end, I use sxhkd for configuring keybindings, and so I have a shortcut which spawns this very line of code.

Make sure you have Steel Bank Common Lisp (sbcl) installed. It should work on any newer version (currently runs well under version 1.4.10).

Make sure you have dmenu installed as well. You can also use rofi, though using it will require a few lines of configuration; see the Wiki for examples.

Hacking it

As stated before, Powerlisp is highly hackable.

There are some functions, macros and variables which any user may want to change; they will be better documented on the Wiki, so make sure you check it out. Below I’ve listed all of them in their order of appearance and cathegory, for a quick reference.

Breaking changes have been stated on the CHANGELOG file, so you should probably look at it as well.

;;; Global, customizable variables
*browser-command*
*browser-incognito-flag*
*notify-command*
*launcher-prompt*
*launcher-command*
*launcher-on-bottom*
*launcher-rofi-emulate-dmenu*
*launcher-font*
*launcher-bg*
*launcher-fg*
*launcher-sel-bg*
*launcher-sel-fg*
*default-search-engine*
*rerun-main-menu* ; only change when using submenus

;;; Runtime variables, do not change directly
*search-engines*
*favorite-websites*
*subcommands*
*incognito-mode*

;;; User customization API
;; Functions
(powerlisp-add-favorite atom url)
(powerlisp-add-multi-favorites favorites-list)
(powerlisp-add-search-engine atom query-parts)
(powerlisp-add-multi-search-engines engines-list)
(powerlisp-add-command command callback)
(powerlisp-add-multi-commands commands-list)
(powerlisp-spawn-menu prompt alist)
(powerlisp-notify text &optional title)
(powerlisp-call-browser website)
(powerlisp-call-external program-path &rest arguments...)

;; Macros
(powerlisp-request-user-input &optional prompt)
(with-powerlisp-user-input (&optional prompt) &body body...)
(with-powerlisp-options-menu (prompt alist) &body body...)
(with-powerlisp-menu (prompt alist) &body body...)

More Repositories

1

believe

A Bel Lisp interpreter built with C, written as a book/literate program (archived)
TeX
51
star
2

sonic-lisp-engine

Sonic The Hedgehog Engine, written in Common Lisp as a literate program
Common Lisp
21
star
3

wasm-demo-rs

A basic example of Rust compiled to WebAssembly, using Rust's own native tools.
Rust
19
star
4

org-abntex2

Modelo para documentos LaTeX com abnTeX2 em Org Mode
TeX
19
star
5

opengames

Pequenos jogos de exemplo com código aberto
Common Lisp
15
star
6

cl-rest-server-example

Exemplo de servidor REST totalmente feito em Common Lisp para consultas futuras (em progresso)
Common Lisp
12
star
7

cl-ann

Artificial Neural Network implementation in Common Lisp
Common Lisp
9
star
8

emacs-org-dotfiles

My Emacs dotfiles, written in Org.
Emacs Lisp
8
star
9

super-brickbreak-rs

Rust/WASM port of SuperBrickBreak
Rust
7
star
10

sonic-lisp-old

Clone of Sonic The Hedgehog engine, made in Common Lisp (mirror from GitLab)
Common Lisp
6
star
11

game-sketch

Common Lisp system for creating sketches, inspired by the Processing 2.x API.
Common Lisp
5
star
12

lulzcoin

The most unimaginably useless cryptocurrency ever created ¯\_(ツ)_/¯
Rust
4
star
13

study

Repositório de anotações de aulas e exercícios resolvidos
C++
4
star
14

majestic-lisp

Majestic Lisp book and implementation, in Brazillian Portuguese.
Rust
4
star
15

zig-lisp

Experimenting with building a Lisp on Zig
Zig
4
star
16

cl-jackc

Jack compiler for the nand2tetris Hack platform
Common Lisp
4
star
17

BasicPlatformer

A basic platformer engine example, based on Sonic The Hedgehog. Uses OficinaFramework.
C++
3
star
18

cl-hackvmtr

VM Translator for the nand2tetris Hack platform
Common Lisp
3
star
19

cl-hackasm

Assembler for the nand2tetris Hack platform
Common Lisp
3
star
20

minerva-system

Minerva System is a study on building ERP-like systems with Rust, Flutter, microservices and Kubernetes. Not a commercial project whatsoever!
Rust
3
star
21

kernel

Bare bones toy kernel
C
3
star
22

YASWEG

A static website generator, written in Guile Scheme.
Scheme
3
star
23

harmonograph

Shows Lissajous curves like an harmonograph.
Common Lisp
3
star
24

9mine

Console Minesweeper clone for Plan 9
C
2
star
25

loko-kernel

Toy kernel built atop Loko Scheme
Scheme
2
star
26

winforth

A Forth implementation built using Visual C++ 6.0 on a Windows 98
C++
2
star
27

lispgj2018

ODS: Orbit Defense Strikeforce -- My entry on Lisp Game Jam 2018.
Common Lisp
2
star
28

graphtool

Tool for representing and dealing with weighted graphs, study purposes only. Built in Common Lisp.
Common Lisp
2
star
29

projeto-POO-2020-5

Projeto Final da disciplina de Programação Orientada a Objetos - Semestre 2020/5 - UFVJM
Java
2
star
30

LandOfLisp

Keeps track of my progress on the exercises of the book Land of Lisp.
Common Lisp
2
star
31

sleepsorts

A collection of implementations for Sleepsort.
Common Lisp
2
star
32

diophantine

Genetic algorithm for solving diophantine equations
Common Lisp
2
star
33

wasm-platformer-rs

Yup, a platformer game written in Rust/WASM.
Rust
2
star
34

website

Source code from my website after being moved to GitHub.
CSS
2
star
35

robby-lisp

Lisp implementation of Robby, the Soda-Can-Collecting Robot
Common Lisp
1
star
36

MyLain-rs

The Very Useful, Personal Assistant for Smart Homes -- Rust port
Rust
1
star
37

GodotPlatformer

Example platformer game, developed using Godot Engine.
GDScript
1
star
38

blockchain-rs

Blockchain implementation for study purposes
Rust
1
star
39

automaton

General-purpose automaton visualizer (WIP)
C++
1
star
40

CWorlds

[DEPRECATED!] Very old Sonic Worlds C++ port wannabe
C++
1
star
41

majestic-mode

Emacs major mode for Majestic Lisp
Emacs Lisp
1
star
42

docker-emacs-export

Docker configuration for a lightweight Emacs configuration (used in exports)
Emacs Lisp
1
star
43

sagittarius

Gemini browser for Plan 9 [work in progress]
C
1
star
44

data-structures

Implementação de estruturas de dados em C.
C
1
star
45

some-sorta-lisp

Some sort of Lisp thing
C
1
star
46

k8s

Config for utilitaries I run on Kubernetes
1
star
47

3dengine.fs

Attempt to build a Doom-like renderer in Forth
C
1
star
48

studium

The Studium 2D Game Engine (work-in-progress)
C
1
star
49

abntex2unifei

Uma extensão do abntex2 para a Unifei - Itabira.
TeX
1
star
50

MinervaFrontend

Delphi front-end for Minerva.rs
Pascal
1
star
51

my-os

Operational system written in Rust from scratch, based on the guide by Philipp Oppermann. Not a serious project.
Rust
1
star
52

techimera-k8s

Aplicação REST rápida feita em Common Lisp para apresentar conceitos de Kubernetes
Common Lisp
1
star
53

psxtoolchain

PlayStation 1 (PSX) Docker toolchain for building projects and ISO images
Dockerfile
1
star
54

SuperBrickBreak

Fast-paced breakout clone featuring 20+ levels - online version.
JavaScript
1
star