/inkscape-shortcut-manager-py

Clone of castel.dev's Inkscape shortcut manager for Mac

Primary LanguagePython

A extensible shortcuts manager for inkscape based on Gilles Castell workflow see here.

This is a combination of neovim plugin + python script. You can add this as neovim plugin and it just works*

neovim plugin provides lua functions

    vim.call('plug#begin', '~/.config/nvim/plugged')
    		Plug '~/.config/nvim/plugged/figures-manager'
    vim.call('plug#end')

    local illustrate = require('illustrate')
    local illustrate_finder = require('illustrate.finder')
    vim.keymap.set('n', '<leader>fc', function() illustrate.create_and_open_svg() end, {})
    vim.keymap.set('n', '<leader>fo', function() illustrate.open_under_cursor() end, {})
    vim.keymap.set('n', '<leader>fs', function() illustrate_finder.search_create_copy_and_open() end, {})

and the python script provides shortcuts to customize figures via keycombinations as mentioned in pic below.

  • Key-Cords to quickly format the figures created (refer figure below)
  • t opens neovim to quickly type equations (useful with ultisnips/luasnip)
  • grave toggles the shortcut-manager (useful in cases when you just want to type)
  • Quickly save / reuse styles
  • Quickly save / reuse objects

https://castel.dev/post/lecture-notes-2/

Implementation Details

This is python based shortcut-manager and requires pyObjC, pyObjC-core installed to allow listening and capturing system level keyboard events via Apple's Quartz-framework quartz-event-services, and performing actions only when frontmost window is inkscape via AppKit-framework (see ns-workspace). The tapped keys are not passed back to system if some action is performed via script, in cases otherwise, all keys are passed back to system. Script doesn't interact with inkscape, but only pastes svg styles to selected object.

*Note: This script may contain certain hardcoded paths, constants - in config file. Edit config file before you proceed. If you're familiar with python, feel free to dig in for more and extend or provide a suggestion.