Posted: 28.01.2023 02:30
это скорее всего реализуемо с помощью AutoKey под Linux и AutoHotKey под Windows
Discuss releases, report bugs and wishes
http://synwrite.sourceforge.net/forums/
для этого программа должна перехватчик буфера ставить.Желательно в CudaText включать опцию перехвата буфера обмена.
Как это реализовано в Clipboard Indicator Gnome extention, Parcellite, Qlipper, Clipman, CopyQ и т.п.
dimon40001 wrote:это скорее всего реализуемо с помощью AutoKey под Linux и AutoHotKey под Windows
AutoKey is a scripting application for Linux. It lets you automate repetitive and trivial operations on your computer so you can perform them quickly and efficiently.
Some of the tasks where AutoKey serves well include text expansion, correcting typos, launching programs, and inserting boilerplate texts. Besides, you can also use it to run custom scripts to automate complex system actions on your machine.
That said, though, AutoKey can be intimidating to its first-time users. To this end, here's a guide to help you install, set up, and use AutoKey on Linux.
What Is AutoKey?
AutoKey is a free and open-source desktop automation utility for Linux. It allows you to automate various repetitive operations on your computer using hotkeys or trigger phrases so you can perform them efficiently.
Вопрос.main Alexey wrote: для этого программа должна перехватчик буфера ставить.
Code: Select all
import time
import sys
import pyperclip
# Based on https://github.com/bolapara/clipboardToTxt pull request.
# By preloading last_paste with the existing clipboard we avoid saving
# something from the clipboard that was put there when this tool was not
# running. That way you can safely kill it when copying a password and
# restart it afterwards and it will not steal your sensitive paste.
last_paste = pyperclip.paste().strip()
while True:
time.sleep(0.1)
paste = pyperclip.paste().strip()
if paste != last_paste:
try:
with open('clipboard.txt', 'a') as f:
f.write('{}\n$\n'.format(paste))
last_paste = paste
except Exception as e:
sys.stderr.write("Error: {}".format(e))
break
Там есть примеры использование CudaText API в консоли.You can enter commands from CudaText API
Code: Select all
>>> t1 = ed
>>> =t1
<Editor h:0 id:19 title:"CudaText.wiki" gr:0 tab:18>
Code: Select all
>>> =t1
<Editor h:0 id:13 title:"lsp_md.json" gr:0 tab:12>
self - конкретный экземпляр класса?self - параметр который нужен для классов. вам он не нужен.
Code: Select all
from gi.repository import Gtk, Gdk
Code: Select all
import gi
gi.require_version("Gtk", "3.0")
Code: Select all
pip3 install PyGObject
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: PyGObject in /usr/lib/python3/dist-packages (3.42.1)
Requirement already satisfied: pycairo>=1.16.0 in /usr/lib/python3/dist-packages (from PyGObject) (1.20.1)
Code: Select all
sudo apt install python3-gi
Уже установлен пакет python3-gi самой новой версии (3.42.1-0ubuntu1).
python3-gi помечен как установленный вручную.