Dialog configuration

From wikinotes

You can customize your preference for all dialog UIs.

Documentation

dialog keybindings https://man.archlinux.org/man/core/dialog/dialog.1.en#KEY_BINDINGS

Locations

~/.dialogrc user config
/usr/include/dlg_keys.h bindable commands
/usr/include/dlg_colors.h colour option names

Configuration

Defaults

dialog --create-rc ~/.dialogrc  # generate default dialogrc

Colours

  • you can define your own variables as options, then refer to them for real values
  • you can set options from /usr/include/dlg_colors.h (see #define DLGC_*_*, lowercasing, and removing DLGC_*_ to define variable)
# ~/.dialogrc

# define colours
# ex:   ${VARIABLE} = (FG,BG,ON/OFF)
# avail:
#   BLACK
#   RED
#   GREEN
#   YELLOW
#   BLUE
#   MAGENTA
#   CYAN
#   WHITE
button_active_color = (RED,CYAN,OFF)

# reference another variable
# ex:   ${VARIABLE} = ${OTHER_VARIABLE}
dialog_color = (BLACK,WHITE,OFF)
button_active_color = dialog_color

Keybindings

Basics

# bindkey ${WIDGET_OR_STAR} ${KEY} ${COMMAND}

bindkey formbox TAB form_NEXT
bindkey *

keys:

  • available keys are defined in /usr/include/curses.h (see #define KEY_*)
  • also accepts ANSI control characters
  • also accepts ASCII characters defined in octal \033

commands:

  • defined in /usr/include/dlg_keys.h (see DLGK_*, but use without DLGK_)

vi mode

# ~/.dialogrc

# list-items (j,k,g,G)
bindkey menubox \152 ITEM_NEXT
bindkey menubox \153 ITEM_PREV
bindkey menubox \147 ITEM_FIRST
bindkey menubox \107 ITEM_LAST

# menu-buttons (h,l)
bindkey menubox \150 FIELD_PREV
bindkey menubox \154 FIELD_NEXT