-
Notifications
You must be signed in to change notification settings - Fork 100
/
config.py
50 lines (41 loc) · 1.27 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
import subprocess
from pathlib import Path
def open_editor(filename):
subprocess.run([
'urxvt',
'-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)