Can I substitute gnome-terminal for xterm to run codebox?

Home Forums cherrytree Can I substitute gnome-terminal for xterm to run codebox?

This topic contains 3 replies, has 2 voices, and was last updated by  eureka 1 month, 2 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #124512

    eureka
    Member

    I am exploring CherryTree document as a software installation manual.

    http://www.giuspen.com/cherrytreemanual/Inserting_Objects–From_the_Toolbar–Code_Box.html

    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.

    #124513

    eureka
    Member

    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.

    #124520

    Cosmo
    Member

    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>"

    • This reply was modified 1 month, 2 weeks ago by  Cosmo.
    #124522

    eureka
    Member

    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 ..

    https://scarygliders.net/2011/12/01/customize-xterm-the-original-and-best-terminal/

    and I added $HOME/.Xresources

    Then I read here.

    https://wiki.archlinux.org/index.php/X_resources#Xterm_resources

    To load file …

    xrdb ~/.Xresources

    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.

    https://wiki.actiona.tools/doku.php?id=:en:start

    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:

    actexec ~/cherrytree_scripts/gnome-terminal.ascr

    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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.