Widgets

As shown in this screenshot from the section on the menu, most of the screen space in the HUD-like menu is reserved for widgets.

menu UI

Widgets come in two variations: built-in lua scripts and external clients that identify as widgets. The external client support is currently experimental and not supported / activated in the main code, so right now, it is reserved for ‘future changes’.

The source path durden/widgets/*.lua is scanned for widgets during startup. These provide a list of menu paths or trigger functions that will be evaluated as the menu is navigated. These widgets are intended to show additional / optional contextual information and controls.

For instance, this widget is activated when interactively mapping a UTF-8 sequence to a keyboard combination:

ascii-Widget

This widget is shown when interactively creating a new keybinding:

bind-widget

Cheat Sheet

The cheat-sheet is an example of a target specific widget. It scans a folder of txt files and checks the current window tag, title or ident for a matching pattern.

These can be found in the durden/widgets/*.txt path. An example would be: +%.lua —- Patterns —- . all characters %a letters

    ---- Strings -----
    byte(s, [, i, [, j]]) - string to num code
    char(...) - num code to string

The first line is the matching pattern, groups are separated with an empty line. Colors are chosen by stepping through the palette defined in durden/gconf.lua this screenshot shows a version of the example above:

cheat-sheet

Input

The input widget is activated via the target/input path, but only if a client has announced any input labels. If so, the logical name will be shown as the widget helper text. Clicking on a label will send a press/release pair of that specific input label to the client.

Future Changes

  • Support for enabling / disabling specific widgets
  • Override and remember widget positioning
  • External clients with “WIDGET” primary segid
  • Widget for analog input filter tuning
  • Widget for color picking
  • Extend cheatsheet widget with image support