note: Hi There, I am a newbee on the forum, so if I have put this posting in the wrong section, let me know.
This is a little python3 helper program that provides a graphical menu to select optional editors. It come out of necessity for me, sometimes working on a markdown file in Sublime Edit 3 if code intensive, or alternatively in Typora if predominantly textual. The Joplin editor is good, but sometimes, if my page/file has lots of links, images, or other 'markdown stuff', it can get a bit messy to see the text clearly. Hence, I use Typora. For code intensive stuff, I sometimes like to use Sublime Editor as it has macro recording and playback. Enough rationale...
The Joplin Edit Choice program provides a simple graphical menu in tkinter that displays a list of buttons that when clicked, execute an editor program, accepting the filename to edit as the only command-line parameter.
This is not a 'plug -in' but an external program. It is set as Joplin's external Text Editor, and when
<CTRL>+<E> is pressed, instead of launching an editor, it launches this program in a small window. The program displays a vertical row of buttons, each corresponding to an editor choice. When you click a button, that editor is launched and the name and path to the Joplin markdown file is passed as the only parameter. You can edit with your editor of choice, hitting save as you edit exactly like you normally would with the external editor launched directly from Joplin. When you have finished with your external editor and close it, this little helper app closes, and as per normal, you are back in Joplin. Do not forget to again hit
<CTRL><E> to exit External Editing Mode in Joplin.
Of course, the little menu has an Exit option, so you can hit
<CTRL><E>, Exit, and
<CTRL><E>, over and over to have hours of procrastinatory fun. Not really, it is just to back out of the menu if you made a mistake.
This program when launched looks like this:
As you can tell, it's not very complex.
Let me know if you have any suggestions or changes that I might like. Otherwise, enjoy and write your little hearts out.
None of either. Do with it what you will. I hope it helps you in some way.
Joplin only passes a single argument to the external editor. For that reason, there is no point of executing full command-line argument processing. Only argv is of interest.
In my Linux system program is located at ~/bin/joplin_edit_choice.py on my computer, and is set in the Joplin application options as the external Text Editor Command.
#!/bin/python3 import tkinter as tk import os import sys author="Paul Thompson" email="email@example.com" version="18.104.22.168" lastUpdated="15 Sep 2021" # # Change the names of the editors throughout the program to # suit your editors of choice, and also change the paths to suit your # operating system application locations. Mine is Linux with standard # apt installations of typora, code, sublime-editor, and kate, so the # applications are located in /usr/bin . I would have included examples # for flatpak and snap applications, but they are a pain in the xxxx to # set up as external editors, so I avoid them. # typora='/usr/bin/typora ' sublime='/usr/bin/subl ' vscode='/usr/bin/code ' kate='/usr/bin/kate ' editFilename=sys.argv root = tk.Tk() v = tk.IntVar() v.set(1) # initializing the choice, i.e. Python languages = [("Typora", 101), ("Sublime Edit", 102), ("Visual Studio Code", 103), ("Kate", 104), ("Exit", 999)] def ShowChoice(): myChoice = v.get() if myChoice == 101: os.system(typora + editFilename) exit() if myChoice == 102: os.system(sublime + editFilename) exit() if myChoice == 103: os.system(vscode + editFilename) exit() if myChoice == 104: os.system(kate + editFilename) exit() if myChoice == 999: exit() tk.Label(root, text="""Editing markdown with:""", justify = tk.LEFT, padx = 20).pack() myChoice=0 for language, val in languages: myChoice = tk.Radiobutton(root, text=language, indicatoron = 0, width = 20, padx = 20, variable=v, command=ShowChoice, value=val).pack(anchor=tk.W) root.mainloop()