gillescastel / inkscape-shortcut-manager

Inkscape shorcut manager
MIT License
360 stars 98 forks source link

Vim text insert not working in inkscape #28

Open Nespos958 opened 2 years ago

Nespos958 commented 2 years ago

Edit: This post formatted weird in several ways and I'm unsure of how to fix it so i apologize in advance

Hello, I cant seem to get the vim text feature inside of inkscape working. Every other feature seems to be working except this. It simply does nothing when 't' is pressed.

I have viewed all the information I could find on the gillescastel /inkscape-shortcut-manager section of this site including previous Issues posted but cant seem to figure out the problem.

Not sure what information one would need to help me but if it helps my OS is lubuntu, the terminal is alacritty, and i am runnning awesome wm.

I made a file called 'minimal-tex-vimrc' located at ~.vim/mininal-tex-vimrc

the file contains

set ft=tex " Quickly closing the window by jamming wq inoremap wq :wq nnoremap wq :wq inoremap qw :wq nnoremap qw :wq

     " Start insert mode between $$'s
     autocmd BufEnter * startinsert | call cursor(1, 2)

     nnoremap j gj
     nnoremap k

I also have config.py located at ~/inkscape-shortcut-manager/config.py this file contains

import sys import subprocess from pathlib import Path

def open_editor(filename): subprocess.run([ 'alacritty', '-geometry', '60x5', '-name', 'popup-bottom-center', '-e', "vim", f"{filename}", ]) def latex_document(latex): return r""" \documentclass[12pt,border=12pt]{standalone}

    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{textcomp}
    \usepackage{amsmath, amssymb}
    \newcommand{\R}{\mathbb R}

    \begin{document}
""" + latex + r"\end{document}"

config = {

For example '~/.config/rofi/ribbon.rasi' or None

'rofi_theme': None,
# Font that's used to add text in inkscape
'font': 'monospace',
'font_size': 10,
'open_editor': open_editor,
'latex_document': latex_document,

}

From https://stackoverflow.com/a/67692

def import_file(name, path): import importlib.util as util spec = util.spec_from_file_location(name, path) module = util.module_from_spec(spec) spec.loader.exec_module(module) return module

CONFIG_PATH = Path('~/.config/inkscape-shortcut-manager').expanduser()

if (CONFIG_PATH / 'config.py').exists(): userconfig = import_file('config', CONFIG_PATH / 'config.py').config config.update(userconfig)

I also have a file named external_rules located at ~/.config/awesome/external_rules this file contains

! /bin/bash

       wid=$1
       class=$2
     instance=$3

 if [ "$instance" = "popup-bottom-center" ]; then
         echo "state=floating"
         read W H <<< $(xdotool getdisplaygeometry)
        eval "$(xdotool getwindowgeometry --shell $wid )"
         xdotool windowmove $wid $(($W / 2 - $WIDTH / 2)) $(($H - $HEIGHT))
 fi

the last relevant file (i think) is main.py which is located at ~/inkscape-shortcut-manager/main.py This file is an unchanged version of the one provided. when it runs and i attempted to open the vim text box it outputted several times the following

USAGE: alacritty [OPTIONS] [SUBCOMMAND]

For more information try --help error: Found argument '-g' which wasn't expected, or isn't valid in this context

If you tried to supply `-g` as a value rather than a flag, use `-- -g`

Sorry if i added way too much garbage to this post but im really trying to make sure that there is enough info to work with. I am also extremely new to linux/vim/github/coding etc so also im sorry if the problem is obvious and im just being dumb.

Thank you.

Nespos958 commented 2 years ago

Update - i switched to qterminal from alacritty and the text in inkscape feature seems to be functional however it opens a window on half the screen and does not place me in insert mode, or between the cursors. the output of main.py is now

X protocol error: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x01400007), sequence_number = 202, major_opcode = 25, minor_opcode = 0 X protocol error: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x01400007), sequence_number = 203, major_opcode = 25, minor_opcode = 0 X protocol error: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x01400007), sequence_number = 207, major_opcode = 25, minor_opcode = 0 X protocol error: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x01400007), sequence_number = 208, major_opcode = 25, minor_opcode = 0 X protocol error: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x01400007), sequence_number = 213, major_opcode = 25, minor_opcode = 0 X protocol error: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x01400007), sequence_number = 214, major_opcode = 25, minor_opcode = 0 X protocol error: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x01400007), sequence_number = 215, major_opcode = 25, minor_opcode = 0

Nespos958 commented 2 years ago

update - i now switched from alacritty to urxvt and this is now what happens when I press t: