Hello
Can command be passed to internal terminal from LUA plugin or C plugin ? Something like geany.launch ("internal trminal","mc")
Thanks
If you mean the built-in terminal tab then AFAIK access to it is not available to plugins.
#! /usr/bin/env lua -- echo ls cd
sel=geany.selection() -- geany.launch ('xfce4-terminal', '--hold', '-e', 'man '..sel)
-- get geany bash pid local handle = io.popen([[bash -c 'pid=$(pgrep geany) && pstree -p $pid | grep -oP "(?<=bash().*?(?=))" | head -n 1']]) local geany_bash_pid = handle:read("*a") handle:close() geany.status("Geany bash pid is: "..geany_bash_pid)
-- get pts pid which = geany_bash_pid for i=0,10 do
local handle = io.popen([[bash -c 'ps -t pts/]]..i..[[ | sed -n "2p" | grep -oP "(?<= ).*?(?=pts/)" | sed "s/ //g"']]) local pts_pid = handle:read("*a") handle:close() geany.status("PTS pid is: "..pts_pid)
if string.find(pts_pid, geany_bash_pid) then geany_bash_pts = i geany.status("FOUND IT !: "..geany_bash_pts) break end end
-- send geany selection with man command to geany's internal terminal by using open-source utility ttyecho -- ttyecho stackoverflow info: https://stackoverflow.com/questions/24725051/execute-a-command-in-another-te... -- ttyecho original article: http://www.humbug.in/2010/utility-to-send-commands-or-data-to-other-terminal... -- ttyecho original article (web.archive): https://web.archive.org/web/20240324125143/http://www.humbug.in/2010/utility... -- ttyecho original sources: https://github.com/osospeed/ttyecho -- ttyecho fork sources: https://github.com/andreabenini/ttyEcho -- ttyecho executable need to be modified after building from sources for execution without root (attention! - check sources!) -- modification: sudo chown root:root ttyecho && sudo chmod u+s ttyecho local handle = io.popen([[bash -c '~/.config/geany/plugins/helpers/ttyecho -n /dev/pts/]]..geany_bash_pts..[[ man\ ]]..sel..[[']]) handle:close()
Closed #1373 as completed.
github-comments@lists.geany.org