Yagostatus
Yet Another i3status replacement written in Go
Install / Use
/learn @burik666/YagostatusREADME
YaGoStatus
Yet Another i3status replacement written in Go.

Features
- Instant and independent updating of widgets.
- Handling click events.
- Shell scripting widgets and events handlers.
- Wrapping other status programs (i3status, py3status, conky, etc.).
- Different widgets on different workspaces.
- Templates for widgets outputs.
- Update widget via http/websocket requests.
- Update widget by POSIX Real-Time Signals (SIGRTMIN-SIGRTMAX).
- Snippets.
- Plugins.
Installation
go install github.com/burik666/yagostatus@latest
mkdir -p ~/.config/yagostatus
yagostatus -dump > ~/.config/yagostatus/yagostatus.yml
Replace status_command to ~/go/bin/yagostatus --config ~/.config/yagostatus/yagostatus.yml in your i3 config file.
If you using Sway add the --sway parameter.
Troubleshooting
Yagostatus outputs error messages in stderr, you can log them by redirecting stderr to a file.
status_command exec ~/go/bin/yagostatus --config /path/to/yagostatus.yml 2> /tmp/yagostatus.log
Configuration
If --config is not specified, yagostatus is looking for yagostatus.yml in $HOME/.config/yagostatus (or $XDG_HOME_CONFIG/yagostatus if set) or in the current working directory.
Yagostatus uses a configuration file in the yaml format.
Example:
widgets:
- widget: static
blocks: >
[
{
"full_text": "YaGoStatus",
"color": "#2e9ef4"
}
]
events:
- button: 1
command: xdg-open https://github.com/burik666/yagostatus/
- widget: wrapper
command: /usr/bin/i3status
- widget: clock
format: Jan _2 Mon 15:04:05 # https://golang.org/pkg/time/#Time.Format
templates: >
[{
"color": "#ffffff",
"separator": true,
"separator_block_width": 21
}]
Widgets
Common parameters
widget- Widget name.workspaces- List of workspaces to display the widget.
Example:
- widget: static
workspaces:
- "1:www"
- "2:IM"
blocks: >
[
{
"full_text": "Visible only on 1:www and 2:IM workspaces"
}
]
- widget: static
workspaces:
- "!1:www"
blocks: >
[
{
"full_text": "Visible on all workspaces except 1:www"
}
]
templates- The templates that apply to widget blocks.events- List of commands to be executed on user actions.button- X11 button ID (0 for any, 1 to 3 for left/middle/right mouse button. 4/5 for mouse wheel up/down. Default:0).modifiers- List of X11 modifiers condition.command- Command to execute (viash -c). Сlick_event json will be written to stdin. Also env variables are available:$I3_NAME,$I3_INSTANCE,$I3_BUTTON,$I3_MODIFIERS,$I3_{X,Y},$I3_OUTPUT_{X,Y},$I3_RELATIVE_{X,Y},$I3_{WIDTH,HEIGHT},$I3_MODIFIERS. The clicked widget fields are available as ENV variables with the prefixI3_(example:$ I3_full_text).workdir- Set a working directory.env- Set environment variables.output_format- The command output format (none,text,json,auto) (default:none).name- Filter bynamefor widgets with multiple blocks (default: empty).instance- Filter byinstancefor widgets with multiple blocks (default: empty).override- Iftrue, previously defined events with the samebutton,modifier,nameandinstancewill be ignored (default:false)
Example:
- widget: static
blocks: >
[
{
"full_text": "Firefox",
"name": "ff"
},
{
"full_text": "Chrome",
"name": "ch"
}
]
templates: >
[
{
"color": "#ff8000"
},
{
"color": "#ff3030"
}
]
events:
- button: 1
command: /usr/bin/firefox
name: ff
- button: 1
modifiers:
- "!Control" # "!" must be quoted
command: /usr/bin/chrome
name: ch
- button: 1
- Control
command: /usr/bin/chrome --incognito
name: ch
Snippets
Yagostatus supports the inclusion of snippets from files.
- widget: $ygs-snippets/snip.yaml
msg: hello world
color: #00ff00
ygs-snippets/snip.yaml:
variables:
msg: "default messsage"
color: #ffffff
widgets:
- widget: static
blocks: >
[
{
"full_text": "message: ${msg}",
"color": "${color}"
}
]
ygs-snippets/snip.yaml - relative path from the current file.
Widget clock
The clock widget returns the current time in the specified format.
format- Time format (https://golang.org/pkg/time/#Time.Format).interval- Clock update interval in seconds (default:1).
Widget exec
This widget runs the command at the specified interval.
command- Command to execute (viash -c).workdir- Set a working directory.env- Set environment variables.interval- Update interval in seconds (0to run once at start;-1for loop without delay; default:0).retry- Retry interval in seconds if command failed (default: none).silent- Don't show error widget if command failed (default:false).events_update- Update widget if an event occurred (default:false).output_format- The command output format (none,text,json,auto) (default:auto).signal- SIGRTMIN offset to update widget. Should be between 0 andSIGRTMIN-SIGRTMAX.
The current widget fields are available as ENV variables with the prefix I3_ (example: $I3_full_text).
For widgets with multiple blocks, an suffix with an index will be added. (example: $I3_full_text, $I3_full_text_1, $I3_full_text_2, etc.)
Use pkill to send signals:
pkill -SIGRTMIN+1 yagostatus
Widget wrapper
The wrapper widget starts the command and proxy received blocks (and click_events). See: https://i3wm.org/docs/i3bar-protocol.html
command- Command to execute.workdir- Set a working directory.- 'env' - Set environment variables.
Widget static
The static widget renders the blocks. Useful for labels and buttons.
blocks- JSON List of i3bar blocks.
Widget http
The http widget starts http server and accept HTTP or Websocket requests.
network-tcporunix(defaulttcp).listen- Hostname and port or path to the socket file to bind (example:localhost:9900,/tmp/yagostatus.sock).path- Path for receiving requests (example:/mystatus/). Must be unique for multiple widgets with samelisten.
For example, you can update the widget with the following command:
curl http://localhost:9900/mystatus/ -d '[{"full_text": "hello"}, {"full_text": "world"}]'
Send an empty array to clear:
curl http://localhost:9900/mystatus/ -d '[]'
Unix socket:
curl --unix-socket /tmp/yagostatus.sock localhost/mystatus/ -d '[{"full_text": "hello"}]'
Examples
Counter
This example shows how you can use custom fields.
- Left mouse button - increment
- Right mouse button - decrement
- Middle mouse button - reset
- widget: static
blocks: >
[
{
"full_text":"COUNTER"
}
]
events:
- command: |
printf '[{"full_text":"Counter: %d", "_count":%d}]' $((I3__COUNT + 1)) $((I3__COUNT + 1))
output_format: json
button: 1
- command: |
printf '[{"full_text":"Counter: %d", "_count":%d}]' $((I3__COUNT - 1)) $((I3__COUNT - 1))
output_format: json
button: 3
- command: |
printf '[{"full_text":"Counter: 0", "_count":0}]'
output_format: json
button: 2
Volume control
i3 config:
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -1%; exec pkill -SIGRTMIN+1 yagostatus
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +1%; exec pkill -SIGRTMIN+1 yagostatus
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle; exec pkill -SIGRTMIN+1 yagostatus
- widget: exec
command: |
color="#ffffff"
if [ $(pacmd list-sinks |sed '1,/* index/d'|grep -E '^\smuted:'|head -n1|awk '{print $2}') = "yes" ]; then
color="#ff0000"
fi
volume=$(pacmd list-sinks |sed '1,/* index/d'|grep -E '^\svolume:'|head -n1|awk '{print $5}')
echo -e '[{"full_text":"♪ '${volume}'","color":"'$color'"}]'
interval: 0
signal: 1
events_update: true
events:
- button: 1
command: pactl set-sink-mute @DEFAULT_SINK@ toggle
- button: 4
command: pactl set-sink-volume @DEFAULT_SINK@ +1%
- button: 5
command: pactl set-sink-volume @DEFAULT_SINK@ -1%
templates: >
[{
"markup": "pango",
"separator": true,
"separator_block_width": 21
}]
Weather
To get access to weather API you need an APIID. See https://openweathermap.org/appid for details.
Requires jq for json parsing.
- widget: static
blocks: >
[
{
"full_text": "Weather:",
"color": "#2e9ef4",
"separator": false
}
]
- widget: exec
c
