Code Monkey home page Code Monkey logo

inkscape-shortcut-manager's Introduction

Inkscape shortcut manager

A shortcut manager that speeds up drawing (mathematical) figures in Inkscape.

Problem

I write my lecture notes in LaTeX and I want to draw figures in real time, i.e. while the lecturer is drawing on the blackboard. While the figures I want to draw quite simple, drawing them in Inkscape with default shortcuts takes too much time to keep up with a fast paced lecture. My goal is to draw figures like this:

Elliptic curve

Complex Analysis

Solution

I created a custom shortcut manager that intercepts all keyboard events sent to Inkscape windows giving me full control of user input. The script has the following features

  • Press clusters of keys (key chords) to apply common styles. Pressing d+a gives a dotted arrow, f+s fills the selection in gray and adds a stroke. You want a circle that's dotted and filled? Press f + d. Try pressing combinations of s, a, d, g, h, x, e, b, f, w. Being able to combine these common styles by pressing key chords feels quite intuitive after a while.
  • Save custom styles and objects. Press Shift+S or Shift+A to give a style or object a name. Use it by pressing s or a and typing the name. For common styles that aren't covered by the key chords, this comes in handy.
  • Use your editor to write LaTeX. Pressing t opens an instance of vim (or any editor you want). Write some LaTeX, close it, and the shortcut manager pastes the text in the figure. Pressing Shift+T does the same but renders the LaTeX as an svg and adds it to the document.
  • Ergonomic shortcuts for frequently used functions. Press w for pencil, x to toggle snapping, f for Bézier, z to undo, Shift+z to delete and ` to dis/enable the shortcut manager.

For more details and context, feel free to read my blog post.

Installing

Note that this script only works on GNU/Linux using Python ≥ 3.6. It also has the following dependencies:

  • Xlib python library to intercept keyboard events
  • pdflatex and pdf2svg to render LaTeX in Inkscape
  • xclip to access the clipboard
  • rofi for a selection dialog when saving styles and objects

Use the shortcut manager by running python3 main.py and opening an Inkscape window.

Configuration

You can configure the shortcut manager by creating a file located at ~/.config/inkscape-shortcut-manager/config.py. You can override the rofi theme, font, editor, as well as the LaTeX template that's being used. It's merged with the default config located at config.py. An example configuration file is located in the examples directory.

Related

inkscape-shortcut-manager's People

Contributors

gillescastel avatar feynmanliang avatar nashalex avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.