Module i3status_rs::blocks::custom_dbus

source ·
Expand description

A block controlled by the DBus

This block creates a new DBus object in rs.i3status service. This object implements rs.i3status.custom interface which allows you to set block’s icon, text and state.

Output of busctl --user introspect rs.i3status /<path> rs.i3status.custom:

NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
rs.i3status.custom                  interface -         -            -
.SetIcon                            method    s         s            -
.SetState                           method    s         s            -
.SetText                            method    ss        s            -

§Configuration

KeyValuesDefault
formatA string to customise the output of this block."{ $icon|}{ $text.pango-str()|} "
PlaceholderValueTypeUnit
iconValue of icon set via SetIcon if the value is non-empty string.Icon-
textValue of the first string from SetTextText-
short_textValue of the second string from SetTextText-

§Example

Config:

[[block]]
block = "custom_dbus"
path = "/my_path"

Usage:

# set full text to 'hello' and short text to 'hi'
busctl --user call rs.i3status /my_path rs.i3status.custom SetText ss hello hi
# set icon to 'music'
busctl --user call rs.i3status /my_path rs.i3status.custom SetIcon s music
# set state to 'good'
busctl --user call rs.i3status /my_path rs.i3status.custom SetState s good

Because it’s impossible to publish objects to the same name from different processes, having multiple dbus blocks in different bars won’t work. As a workaround, you can set the env var I3RS_DBUS_NAME to set the interface a bar works on to differentiate between different processes. For example, setting this to ‘top’, will allow you to use rs.i3status.top.

§TODO

  • Send a signal on click?

Structs§

Functions§