Skip to content

CmdRunner

Runs a terminal command on a schedule.

Configuration

cmdrunner:
  args: ["-g", "batt"]
  cmd: "pmset"
  enabled: true
  position:
    top: 6
    left: 1
    height: 1
    width: 3
  refreshInterval: 30

Attributes

Name Value
args
The arguments to the command, with each item as an element in an array.
cmd
The terminal command to be run, withouth the arguments. Ie: ping, whoami, curl.
maxLines
Optional The maximum number of lines to keep in the buffer. Default: 256.
Any positive integer.
pty
Optional Run the command in a pseudo-terminal. Some apps will behave differently if they are run in a terminal. For example, some apps will produce colorized output in a terminal, and non-colorized output otherwise. Default: false.
true, false
tail
Optional Automatically scroll with new output. Default: false.
true, false

Examples

brew outdated

Displays a list of all the installed Homebrew recipes that have an update available for them.

brew_outdated:
  args: ["outdated"]
  cmd: "brew"
  enabled: true
  position:
    top: 3
    left: 1
    width: 2
    height: 1
  type: cmdrunner

iStats

iStats is a command line tool to view system stats on OSX.

istats:
  args: ["all"]
  cmd: "istats"
  enabled: true
  type: "cmdrunner"
  position:
    top: 0
    left: 3
    height: 2
    width: 2
  refreshInterval: 1

Status Pages

Various services provide status apis which are accessible. For example, the slack status api at https://status.slack.com/api/v2.0.0/current

This can be accomplished with jq and the cmdrunner module.

First, create a shell script:

#!/bin/sh

curl -s https://status.slack.com/api/v2.0.0/current | \
  jq -r '"Status: " + (if (.status == "active") then "Active Incident" else "Ok" end),"Last Updated: " + .date_updated,if (.active_incidents[] | length) > 0 then "Active Incidents\n" + .active_incidents[] .title else "" end'

Second, the following wtfutil config:

slack_status:
  cmd: "slack_status_check.sh"
  enabled: true
  type: "cmdrunner"
  title: "Slack Status"
  position:
    top: 5
    left: 0
    height: 3
    width: 4
  refreshInterval: 30

wego

wego is a command line tool to view weather, from a variety of weather services

weather:
  args: ["0"]
  cmd: "wego"
  enabled: true
  type: "cmdrunner"
  position:
    top: 0
    left: 0
    height: 1
    width: 2
  refreshInterval: 100

Source Code

https://github.com/wtfutil/wtf/tree/master/modules/cmdrunner