XML menu files file format.

This file talk about menu files of AnotherTerminal. These menu files have all data about menus and toolbars.

Menus and toolbar contains menuitems. Each menuitem contains name, icon and tooltip of that menu item. Menuitems can also contains a text (command) to feed terminal or a python script.

1st case: Menu without toolbar

Look at this example:

1: <?xml version="1.0" encoding="UTF-8"?>
2: <terminalmenu>
3: 	<command>bash</command>
4: 	<title>Bash</title>
5: 	<menubar>
6: 		<menu name='List'>
7: 			<menuitem name='List of files'>
8: 				<command>ls -la</command>
9: 				<tooltip>List of all files.</tooltip>
10:			</menuitem>
11:			<menuitem name='Add 2+3'>
12:				<exec>output=2+3;</exec>
13:			</menuitem>
14:		</menu>
15:	</menubar>
16:</terminalmenu>

You can download it from here.

Line 1 is standard XML file begining.

Line 2 and 16: Every file has a starting <terminalmenu> tag and </terminalmenu> ending.

Line 3: <command> tag contains command to run in terminal. In this example bash shell will be running when this menu will be loaded.

Line 4: <title> tag sets title of terminal window.

Line 5 and 15: <menubar> tag insert a menubar in terminal indow. Only one menubar is allowed.

Line 6 and 14: <menu> tag insert a new menu in menubar.

Line 9: <tooltip> tag contains data to show in tooltips. Tooltips are shown in toolbar only.

Line 7 and 10: <menuitem> tag insert a new menu item in menu.

Line 8: <command> tag inside of <menuitem> tag feed terminal with data. In this example it sends 'ls' to terminal.

Line 12: <exec> tag inside of <menuitem> tag run its data as python script. Data in output variable is sent to terminal. Look at the picture bellow.

This is a screenshot of this menu:

In this picture you can see new menu 'List' (green square) and menu items 'List of files' and 'Add 2+3'. If you click over menu items, they will feed terminal with their data. If you press 'List of files' menuitem, it will feed terminal with 'ls -a' (yellow squares). If you press 'Add 2+3' menuitem, it will feed terminal with '5' (red squares). You can see window title 'Bash' and a bash session has been started inside terminal.

2nd case: Menu with toolbar

Look at this example.

It is like the previous example, but it adds a toolbar.

This is a screenshot of this menu with toolbar:

1: <?xml version="1.0" encoding="UTF-8"?>
2: <terminalmenu>
3:	<command>bash</command>
4:	<title>Bash</title>
5:	<toolbar>
6:		<menuitem name='List files' stockicon='gtk-find'>
7:				<command>ls</command>
8:				<tooltip>List of files.</tooltip>
9:		</menuitem>
10:		<menuitem name='Exit' stockicon='gtk-cancel'>
11:				<command>exit</command>
12:				<tooltip>Exit of bash</tooltip>
13:		</menuitem>
14:	</toolbar>
	
	...
	...

In order to insert the toolbar, you will need write <toolbar> tag (lines 5 and 14). Inside you must write your <menuitem> tags. You can use stockicon label, if you want to select icons for your items. Those icons must be stock items from GTK.

File dialog windows

You can show file dialog windows to select your files:

Look at this example:

1: <?xml version="1.0" encoding="UTF-8"?>
2: <terminalmenu>
3:	<command>bash</command>
4:	<title>Bash</title>
5:	<toolbar>
6:		<menuitem name='less file' stockicon='gtk-open' file_dialog_mode='open' file_dialog_replace_str='file'>
7:			<command>less "file"</command>
8:		</menuitem>
	
	...
	...

In line 6 there is two new labels inside of "menuitem" tag. These labels are "file_dialog_mode" and "file_dialog_replace_str".

"file_dialog_mode" is the mode of file dialog. It can be "open" (for select files) or "save" (for select files to save).

"file_dialog_replace_str" is a string. This string will be replaced by file path in "command" tag (line 7).

In this example, a file dialog will be opened to select a file. Then "file" string will be replaced by the path of selected file in "command" tag. This resulting command will be inserted in command line.