# Class `awful.widget.watch`

Watch widget.

Here is an example of simple temperature widget which will update each 15 seconds implemented in two different ways. The first, simpler one, will just display the return command output (so output is stripped by shell commands). In the other example `sensors` returns to the widget its full output and it's trimmed in the widget callback function:

    211             mytextclock,
    212             wibox.widget.textbox('  |  '),
    213             -- one way to do that:
    214             awful.widget.watch('bash -c "sensors | grep temp1"', 15),
    215             -- another way:
    216             awful.widget.watch('sensors', 15, function(widget, stdout)
    217               for line in stdout:gmatch("[^\r\n]+") do
    218                 if line:match("temp1") then
    219                   widget:set_text(line)
    220                   return
    221                 end
    222               end
    223             end),
    224             s.mylayoutbox,

### Info:

- Copyright: 2015, 2016 Benjamin Petrenko, Yauheni Kirylau
- Author: Benjamin Petrenko,Yauheni Kirylau

## Methods

awful.widget.watch:new (command[, timeout=5][, callback], base_widget) | Create a textbox that shows the output of a command and updates it at a given time interval.

## Methods

awful.widget.watch:new (command[, timeout=5][, callback], base_widget)
  Create a textbox that shows the output of a command and updates it at a given time interval.
  - command string or table The command.
  - timeout integer The time interval at which the textbox will be updated. (default 5)
  - callback

    The function that will be called after the command output will be received. it is shown in the textbox. Defaults to:

         function(widget, stdout, stderr, exitreason, exitcode)
             widget:set_text(stdout)
         end

    - widget Base widget instance.
    - stdout string Output on stdout.
    - stderr string Output on stderr.
    - exitreason string Exit Reason. The reason can be "exit" or "signal".
    - exitcode integer Exit code. For "exit" reason it's the exit code. For "signal" reason — the signal causing process termination.
  - base_widget Base widget. (default wibox.widget.textbox())

  ### Returns:

  The widget used by this watch

generated by LDoc 1.4.6 Last updated 2017-01-20 01:17:18