Tagged: codeblock shell automation
29 October 2017 at 15:35 #124512
I am exploring CherryTree document as a software installation manual.
The idea is to embed codeblocks within descriptive text blocks.
However I prefer to use gnome-terminal instead of the default xterm.
In Edit > Preferences > Plain Text and Code I can see the default command ..
xterm -hold -geometry 180x45 -e "<command>"
How can I substitute gnome-terminal for xterm?
I have tried some variants of command with no success. I can launch gnome-terminal but I want code to run in gnome-terminal.29 October 2017 at 21:01 #124513
I have an added requirement related to my interest in running content of codebox in any selected node.
If I have selected a given node, whether or not it holds codebox(s), how can I capture the path to the selected node?
I require to pass this node path as a variable to scripts in codeboxes or external scripts.30 October 2017 at 10:33 #124520
What you want is doable on this way:
At first create in gnome-terminal a new profile, I call it here CherryTree. Do not(!) make this profile as a default profile.
Now change the properties of this profile to not auto-close after executing a command. You can also change the size of the terminal window in this profile as you like it.
Now open the CT settings and enter this command:
gnome-terminal --window-with-profile=CherryTree -e "<command>"
30 October 2017 at 12:43 #124522
- This reply was modified 4 months, 3 weeks ago by Cosmo.
Thank you @cosmo for the idea.
I tried an experiment but I see this in Terminal when I launch a codebox
“The child process exited normally with status 0.”
The profile is definitely CherryTree.
But then I realised it is pointless changing the default command in CherryTree if I aim to share a CherryTree document with other CherryTree users. They would have to change their default settings.
So next I explored how to improve the styling of xterm output to be close to that of gnome-terminal.
I read this old suggestion ..
and I added $HOME/.Xresources
Then I read here.
To load file …
But then I decided to opt for external automation scripts to run whatever workflow I want, without adapting CherryTree.
For this I’m using Actiona which is found in Ubuntu software centre. There is also a Windows version.
I created an Actiona script, extension *.ascr, which runs these five “actions” in sequence as an automation script:
(1) run detached command: gnome terminal
(2) pause: 1 second
(3) write text into open gnome-terminal: ls & disown
(note: the “ls” is the example command to run and “disown” detaches the gnome-terminal from the launching xterm session)
(4) hit enter key twice to paste and run
(5) run detached command: killall -e xterm
(note: this command kills the launching xterm session running in the background leaving only gnome-terminal in focus)
To execute the script I placed this in an sh codebox:
The command actexec allows the path to an *.ascr to be set as an argument.
Now selecting the codebox (default preferences for xterm) and hitting F5 launches the intermediary automation script and I end up with gnome-terminal running with contents from “ls” command.
This might appear to be a long winded approach but using automation scripts in this way avoids the need to make changes to CherryTree.
I plan now to use automation scripts for other purposes such as uploading CherryTree nodes into a remote XML database.
I see CherryTree as the “client” to a backend database.
You must be logged in to reply to this topic.