User Tools

Site Tools


other:dialog_terminal_tui

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
other:dialog_terminal_tui [2021/04/06 02:44]
nanodano
other:dialog_terminal_tui [2021/04/06 03:38] (current)
nanodano [.dialogrc file]
Line 5: Line 5:
 The official documentation and downloads are at [[https://invisible-island.net/dialog/#documentation]]. The official documentation and downloads are at [[https://invisible-island.net/dialog/#documentation]].
  
-More screenshots and examples are available at [[https://invisible-island.net/dialog/dialog-figures.html]].+More screenshots and examples of all widgets are available at [[https://invisible-island.net/dialog/dialog-figures.html]].
  
 ===== Install ===== ===== Install =====
Line 13: Line 13:
 <code bash> <code bash>
 apt install dialog apt install dialog
 +dpkg -L dialog
 dialog --version dialog --version
 dialog --help dialog --help
 +man dialog
 </code> </code>
  
Line 43: Line 45:
 </code> </code>
  
-Here is another example that shows how to get output a different way. The answer comes from [[https://askubuntu.com/questions/491509/how-to-get-dialog-box-input-directed-to-a-variable|StackOverflow Question 491509]] there is an example of how to grab the output. It creates a stream on unused descriptor 3 and then STDERR(2) is redirected to STDOUT(1), then STDOUT is redirected to the newly created stream 3.+Here is another example that shows how to get output a different way. This is out it is done in the examples in the source code.
  
 <code bash> <code bash>
-# https://askubuntu.com/questions/491509/how-to-get-dialog-box-input-directed-to-a-variable 
- 
 # Create temp stream for current shell # Create temp stream for current shell
 exec 3>&    exec 3>&   
  
 # Prompt with dialog and get response # Prompt with dialog and get response
-result=$(dialog --inputbox test 0 0 2>&1 1>&3)+user_text=$(dialog --inputbox Testing 0 0 2>&1 1>&3)
  
-# Store return code of dialog. 0 = success.+# Store return value of dialog process. 0 = success.
 # Check if it's 0 to confirm they didn't cancel # Check if it's 0 to confirm they didn't cancel
-exitcode=$?+exit_code=$?
  
 # Close the temp stream # Close the temp stream
Line 62: Line 62:
  
 # Print the results # Print the results
-echo $result $exitcode+Echo "Program exit code: $exit_code" 
 +echo "User input: $user_text"
 </code> </code>
  
 ===== Available options ===== ===== Available options =====
  
-Below you will find a list of all the options and menus available. Also refer to [[https://invisible-island.net/dialog/dialog-figures.html]]+Below you will find a list of all the options and menus available. Also refer to [[https://invisible-island.net/dialog/dialog-figures.html]] for screenshots and examples of all widgets. 
 + 
 +There are also numerous script examples in the [[https://invisible-island.net/dialog/#download|source code]] in a directory called ''samples/''
  
 <code> <code>
Line 136: Line 139:
 Auto-size with height and width = 0. Maximize with height and width = -1. Auto-size with height and width = 0. Maximize with height and width = -1.
 Global-auto-size if also menu_height/list_height = 0. Global-auto-size if also menu_height/list_height = 0.
 +</code>
 +
 +===== .dialogrc file =====
 +
 +You can specify settings in a ''~/.dialogrc'' file. There might also be one in your system under ''/etc/dialogrc''.
 +
 +To generate a default rc file, run the following command.
 +
 +<code bash>
 +# Create a ~/.dialogrc file
 +dialog --create-rc ~/.dialogrc
 +</code>
 +
 +Then you'll have an rc file with all the color and options populated for you to modify.
 +
 +==== Change colors ===
 +
 +If you want to see some example rc files, check in the [[https://invisible-island.net/dialog/#download|source code]] in a directory called ''samples/''. For example ''whiptail.rc''. Screenshots are available at [[https://invisible-island.net/dialog/dialog-figures.html#list_colors]]. Refer to the file ''dlg_colors.h'' in the source code for a list of available colors. There aren't a ton, but it looks like there is:
 +
 +  * ''BLACK''
 +  * ''WHITE''
 +  * ''CYAN''
 +  * ''BLUE''
 +  * ''YELLOW''
 +  * ''RED''
 +
 +Also make sure ''use_color = ON'' and not OFF.
 +
 +To override the default rc filename, set a ''DIALOGRC'' environment variable to specify the file you want to use.
 +
 +Here is a sample ''.dialogrc'' file that has DevDungeon-ish themed colors:
 +
 +<code text .dialogrc>
 +#
 +# Run-time configuration file for dialog
 +#
 +# Types of values:
 +#
 +# Number      <number>
 +# String      "string"
 +# Boolean    -  <ON|OFF>
 +# Attribute  -  (foreground,background,highlight?,underline?,reverse?)
 +
 +# Set aspect-ration.
 +aspect = 0
 +# Set separator (for multiple widgets output).
 +separate_widget = ""
 +# Set tab-length (for textbox tab-conversion).
 +tab_len = 0
 +# Make tab-traversal for checklist, etc., include the list.
 +visit_items = OFF
 +# Shadow dialog boxes? This also turns on color.
 +use_shadow = OFF
 +# Turn color support ON or OFF
 +use_colors = ON
 +screen_color = (CYAN,BLACK,ON)
 +shadow_color = (RED,RED,ON)
 +dialog_color = (CYAN,BLACK,OFF)
 +title_color = (CYAN,BLACK,ON)
 +border_color = (CYAN,BLACK,ON)
 +button_active_color = (BLACK,CYAN,ON)
 +button_inactive_color = dialog_color
 +button_key_active_color = button_active_color
 +button_key_inactive_color = (WHITE,BLACK,ON)
 +button_label_active_color = (WHITE,CYAN,ON)
 +button_label_inactive_color = (WHITE,BLACK,ON)
 +inputbox_color = dialog_color
 +inputbox_border_color = dialog_color
 +searchbox_color = dialog_color
 +searchbox_title_color = title_color
 +searchbox_border_color = border_color
 +position_indicator_color = title_color
 +menubox_color = dialog_color
 +menubox_border_color = border_color
 +item_color = dialog_color
 +item_selected_color = button_active_color
 +tag_color = title_color
 +tag_selected_color = button_label_active_color
 +tag_key_color = button_key_inactive_color
 +tag_key_selected_color = (CYAN,BLACK,ON)
 +check_color = dialog_color
 +check_selected_color = button_active_color
 +uarrow_color = (RED,BLACK,ON)
 +darrow_color = uarrow_color
 +itemhelp_color = (WHITE,BLACK,OFF)
 +form_active_text_color = button_active_color
 +form_text_color = (WHITE,CYAN,ON)
 +form_item_readonly_color = (CYAN,WHITE,ON)
 +gauge_color = title_color
 +border2_color = dialog_color
 +inputbox_border2_color = dialog_color
 +searchbox_border2_color = dialog_color
 +menubox_border2_color = dialog_color
 </code> </code>
other/dialog_terminal_tui.1617677089.txt.gz · Last modified: 2021/04/06 02:44 by nanodano