py3status Documentation Release 3.21

ultrabug

Oct 14, 2019

Contents:

1 Introduction 1 1.1 About...... 1 1.2 Philosophy...... 1 1.3 Installation...... 2 1.4 Support...... 3 1.5 Usage...... 3

2 Configuration 5 2.1 Loading a py3status module and ordering modules output...... 6 2.2 Configuring a py3status module...... 6 2.3 py3status configuration section...... 6 2.4 Configuration obfuscation...... 10 2.5 Configuring colors...... 11 2.6 Configuring thresholds...... 12 2.7 Formatter...... 13 2.8 Urgent...... 14 2.9 Grouping Modules...... 15 2.10 Custom click events...... 17 2.11 Special on_click commands...... 18 2.12 Module data and on_click commands...... 18 2.13 Environment Variables...... 18 2.14 Inline Shell Code...... 19 2.15 Refreshing modules on udev events with on_udev dynamic options...... 20 2.16 Request Settings...... 21

3 Modules 23 3.1 air_quality...... 23 3.2 apt_updates...... 25 3.3 arch_updates...... 26 3.4 async_script...... 26 3.5 aws_bill...... 27 3.6 backlight...... 28 3.7 battery_level...... 28 3.8 bitcoin_price...... 30 3.9 bluetooth...... 30 3.10 check_tcp...... 31 3.11 ...... 32

i 3.12 clock...... 32 3.13 ...... 34 3.14 coin_balance...... 35 3.15 coin_market...... 37 3.16 conky...... 39 3.17 ...... 44 3.18 diskdata...... 45 3.19 do_not_disturb...... 46 3.20 dpms...... 47 3.21 dropboxd_status...... 48 3.22 emerge_status...... 49 3.23 exchange_rate...... 49 3.24 external_script...... 50 3.25 fedora_updates...... 51 3.26 file_status...... 51 3.27 frame...... 52 3.28 getjson...... 53 3.29 github...... 54 3.30 gitlab...... 55 3.31 glpi...... 57 3.32 google_calendar...... 57 3.33 gpmdp...... 59 3.34 graphite...... 60 3.35 group...... 61 3.36 hamster...... 63 3.37 hddtemp...... 63 3.38 hueshift...... 65 3.39 i3block...... 66 3.40 i3pystatus...... 67 3.41 icinga2...... 68 3.42 imap...... 69 3.43 insync...... 69 3.44 kdeconnector...... 70 3.45 keyboard_layout...... 71 3.46 keyboard_locks...... 72 3.47 khal_calendar...... 73 3.48 lm_sensors...... 74 3.49 loadavg...... 76 3.50 mail...... 79 3.51 mega_sync...... 81 3.52 moc...... 82 3.53 mpd_status...... 83 3.54 mpris...... 84 3.55 net_iplist...... 86 3.56 net_rate...... 87 3.57 netdata...... 88 3.58 networkmanager...... 89 3.59 ns_checker...... 90 3.60 nvidia_smi...... 91 3.61 nvidia_temp...... 92 3.62 online_status...... 93 3.63 pingdom...... 93 3.64 player_control...... 94 3.65 pomodoro...... 95 ii 3.66 process_status...... 96 3.67 rainbow...... 96 3.68 rate_counter...... 97 3.69 rss_aggregator...... 98 3.70 rt...... 99 3.71 scratchpad_async...... 100 3.72 scratchpad_counter...... 100 3.73 screenshot...... 100 3.74 scroll...... 101 3.75 selinux...... 101 3.76 spaceapi...... 102 3.77 speedtest...... 103 3.78 spotify...... 105 3.79 sql...... 106 3.80 static_string...... 108 3.81 sysdata...... 108 3.82 systemd...... 110 3.83 taskwarrior...... 111 3.84 thunderbird_todos...... 111 3.85 timer...... 114 3.86 timewarrior...... 115 3.87 tor_rate...... 117 3.88 transmission...... 118 3.89 twitch...... 121 3.90 uname...... 121 3.91 uptime...... 122 3.92 usbguard...... 123 3.93 velib_metropole...... 124 3.94 vnstat...... 125 3.95 volume_status...... 126 3.96 vpn_status...... 127 3.97 wanda_the_fish...... 128 3.98 weather_owm...... 129 3.99 whatismyip...... 133 3.100 whoami...... 134 3.101 wifi...... 134 3.102 window_title...... 135 3.103 window_title_async...... 136 3.104 wwan...... 137 3.105 wwan_status...... 140 3.106 xkb_layouts...... 141 3.107 xrandr...... 142 3.108 xrandr_rotate...... 144 3.109 xscreensaver...... 145 3.110 xsel...... 145 3.111 yandexdisk_status...... 146 3.112 yubikey...... 147

4 py3-cmd 149 4.1 Commands available...... 149 4.2 Calling commands from i3...... 150

5 Writing custom py3status modules 153 5.1 Importing custom modules...... 153

iii 5.2 Publishing custom modules on PyPI...... 153 5.3 Example 1: The basics - Hello World!...... 154 5.4 Example 2: Configuration parameters...... 155 5.5 Example 3: Click events...... 156 5.6 Example 4: Status string placeholders...... 157 5.7 Example 5: Using color constants...... 158 5.8 Module methods...... 159 5.9 Py3 module helper...... 160 5.10 Composites...... 160 5.11 Module data storage...... 161 5.12 Module documentation...... 161 5.13 Deprecation of configuration parameters...... 162 5.14 Updating of configuration parameters...... 165 5.15 Module testing...... 166

6 py3 module helper 167 6.1 Constants...... 167 6.2 Exceptions...... 167 6.3 Methods...... 168

7 Developing and Contributing 175 7.1 Zen of py3status...... 175 7.2 What you will need...... 176 7.3 Setting up a development environment...... 176 7.4 Python versions...... 177 7.5 tox...... 177 7.6 Travis CI...... 177 7.7 Coding in containers...... 178 7.8 Building documentation...... 178 7.9 Profiling py3status...... 178 7.10 Contributions...... 179

Index 181

iv CHAPTER 1

Introduction

Using py3status, you can take control of your i3bar easily by: • using one of the available Modules shipped with py3status • grouping multiple modules and automatically or manually cycle their display • writing your own modules and have their output displayed on your bar • handling click events on your i3bar and play with them in no time • seeing your clock tick every second whatever your i3status interval No extra configuration file needed, just install & enjoy!

1.1 About

You will love py3status if you’re using i3wm (or sway) and are frustrated by the i3status limitations on your i3bar such as: • you cannot hack into it easily • you want more than the built-in modules and their limited configuration • you cannot pipe the result of one of more scripts or commands in your bar easily

1.2 Philosophy

• no added configuration file, use the standard i3status.conf • rely on i3status’ strengths and its existing configuration as much as possible • be extensible, it must be easy for users to add their own stuff/output by writing a simple python class which will be loaded and executed dynamically • easily allow interactivity with the i3bar

1 py3status Documentation, Release 3.21

• add some built-in enhancement/transformation of basic i3status modules output • support python 2.7 and python 3.x We apply the Zen of py3status to improve this project and encourage everyone to read it!

1.3 Installation

Distro Helpful Com- Useful Note mand Arch $ pacman -S Stable updates. Official releases. py3status $ yay -S Real-time updates from master branch. py3status-git De- $ apt-get Stable updates. In testing and unstable, and soon in stable backports. bian install & py3status Ubuntu Fe- $ dnf dora install py3status Gen- $ emerge -a Check available USE flags! too py3status Linux Pypi $ pip There are optional requirements that you could find useful: install py3status[gevent] for gevent support. py3status[udev] for udev support. py3status Or if you want everything: py3status[all] to install all core extra requirements and features. Void $ Linux xbps-install -S py3status NixOS $ nix-env Not a global install. See below. -i python3. 6-py3status

1.3.1 Note on Debian/Ubuntu

Note: If you want to use pip, you should consider using pypi-install from the python-stdeb package (which will create a .deb out from a python package) instead of directly calling pip.

1.3.2 Note on NixOS

To have it globally persistent add to your NixOS configuration file py3status as a Python 3 package with

(python3Packages.py3status.overrideAttrs (oldAttrs: { propagatedBuildInputs = [ python3Packages.pytz python3Packages.tzlocal ]; }))

2 Chapter 1. Introduction py3status Documentation, Release 3.21

If you are, and you probably are, using i3 you might want a section in your /etc/nixos/configuration.nix that looks like this:

services.xserver.windowManager.i3 ={ enable = true; extraPackages = with pkgs; [ dmenu i3status i3lock (python3Packages.py3status.overrideAttrs (oldAttrs: { propagatedBuildInputs = [ python3Packages.pytz python3Packages.tzlocal ]; })) ]; };

In this example I included the python packages pytz and tzlocal which are necessary for the py3status module clock. The default packages that come with i3 (dmenu, i3status, i3lock) have to be mentioned if they should still be there.

1.4 Support

Get help, share ideas or feedback, join community, report bugs, or others, see:

1.4.1 GitHub

Issues/ Pull requests

1.4.2 Live IRC Chat

Visit #py3status at freenode.net

1.5 Usage

In your i3 config file, simply switch from i3status to py3status in your status_command:

status_command py3status

Usually you have your own i3status configuration, just point to it:

status_command py3status -c ~/.config/i3status/config

1.5.1 Available modules

You can get a list with short descriptions of all available modules by using the CLI:

$ py3-cmd list --all

To get more details about all available modules and their configuration, use:

$ py3-cmd list --all --full

1.4. Support 3 py3status Documentation, Release 3.21

All modules shipped with py3status are present as the Python source files in the py3status/modules directory.

1.5.2 Options

You can see the help of py3status by issuing py3status --help: usage: py3status[-h][-b][-c FILE][-d][-g][-i PATH][-l FILE][-s] [-t INT][-m][-u PATH][-v][--wm WINDOW_MANAGER]

The agile, python-powered, i3status wrapper optional arguments: -h, --help show this help message and exit -b, --dbus-notify send notifications via dbus instead of i3-nagbar (default: False) -c, --config FILE load config(default: /home/alexys/.i3/i3status.conf) -d, --debug enable debug logging in syslog and --log-file (default: False) -g, --gevent enable gevent monkey patching(default: False) -i, --include PATH append additional user-defined module paths(default: None) -l, --log-file FILE enable logging to FILE(default: None) -s, --standalone run py3status without i3status(default: False) -t, --timeout INT default module cache timeout in seconds(default: 60) -m, --disable-click-events disable all click events(default: False) -u, --i3status PATH specify i3status path(default: /usr/bin/i3status) -v, --version show py3status version and exit(default: False) --wm WINDOW_MANAGER specify window manager i3 or sway(default: i3)

1.5.3 Control

Just like i3status, you can force an update of your i3bar by sending a SIGUSR1 signal to py3status. Note that this will also send a SIGUSR1 signal to i3status. killall -USR1 py3status

Note: Since version 3.6 py3status can be controlled via the py3-cmd which is recommended.

4 Chapter 1. Introduction CHAPTER 2

Configuration

py3status comes with a large range of Modules. Modules in py3status are configured using your usual i3status.conf or your own py3status.conf which follows the exact same format. py3status will try to find its configuration file in the following locations: • ~/.config/py3status/config • ~/.config/i3status/config • ~/.config/i3/i3status.conf • ~/.i3status.conf • ~/.i3/i3status.conf • /etc/xdg/i3status/config • /etc/i3status.conf which if you are used to XDG_CONFIG paths relates to: • XDG_CONFIG_HOME/py3status/config • XDG_CONFIG_HOME/i3status/config • XDG_CONFIG_HOME/i3/i3status.conf • ~/.i3status.conf • ~/.i3/i3status.conf • XDG_CONFIG_DIRS/i3status/config • /etc/i3status.conf You can also specify the config location using py3status -c in your i3 configu- ration file.

5 py3status Documentation, Release 3.21

2.1 Loading a py3status module and ordering modules output

To load a py3status module you just have to list it like any other i3status module using the order += parameter. Ordering your py3status modules in your i3bar is just the same as i3status modules, just list the order parameter where you want your module to be displayed. For example you could insert and load the imap module like this:

Listing 1: Example order += "disk /home" order += "disk /" order += "imap" order += "time"

2.2 Configuring a py3status module

Your py3status modules are configured the exact same way as i3status modules, directly from your i3status.conf, like this :

Listing 2: Example # configure the py3status imap module # and run thunderbird when I left click on it imap { cache_timeout= 60 imap_server= 'imap.myprovider.com' mailbox= 'INBOX' password= 'coconut' port= '993' user= 'mylogin' on_click 1= "exec thunderbird" }

2.3 py3status configuration section

This special section holds py3status specific configuration. Settings here will affect all py3status modules. Many settings e.g. colors can still be overridden by also defining in the individual module. Global options: nagbar_font. Specify a font for i3-nagbar -f .

6 Chapter 2. Configuration py3status Documentation, Release 3.21

Listing 3: Example py3status { nagbar_font= 'pango:Ubuntu Mono 12' } storage: Set storage name or path.

Note: New in version 3.13

Store cache in $XDG_CACHE_HOME or ~/.cache

Listing 4: Example # default behavior py3status { storage= 'py3status_cache.data' }

Store per config cache in $XDG_CACHE_HOME or ~/.cache

# first config py3status { storage= 'py3status_top.data' }

# second config py3status { storage= 'py3status_bottom.data' }

Store per config cache in different directories.

# first config py3status { storage= '~/.config/py3status/cache_top.data' }

# second config py3status { storage= '~/.config/py3status/cache_bottom.data' }

Note: New in version 3.14

You can specify the following options in module configuration. min_length: Specify a minimum length of characters for modules. position: Specify how modules should be positioned when the min_length is not reached. Either left (default), center, or right. static_string { min_length= 15 position= 'center' }

2.3. py3status configuration section 7 py3status Documentation, Release 3.21

Note: New in version 3.16

You can specify the options in module or py3status configuration section. The following options will work on i3. • align: Specify how modules should be aligned when the min_width is not reached. Either left (default), center, or right.- background: Specify a background color for py3status modules. - markup: Specify how modules should be parsed. - min_width: Specify a minimum width of pixels for modules. - separator: Specify a separator boolean for modules. - separator_block_width: Specify a separator block width for modules. The following options will work on i3-gaps. • border: Specify a border color for modules. • border_bottom: Specify a border width for modules • border_left: Specify a border width for modules. • border_right: Specify a border width for modules. • border_top: Specify a border width for modules. The following options will work on py3status. • min_length: Specify a minimum length of characters for modules. • position: Specify how modules should be positioned when the min_length is not reached. Either left (default), center, or right.

# customize a theme py3status { align= 'left' markup= 'pango' min_width= 20 separator= True separator_block_width=9

background= '#285577' border= '#4c7899' border_bottom=1 border_left=1 border_right=1 border_top=1

min_length= 15 position= 'right' }

Note: New in version 3.16

You can specify the options in module or py3status configuration section. The following options will work on i3bar and py3status. • urgent_background: Specify urgent background color for modules. • urgent_foreground: Specify urgent foreground color for modules.

8 Chapter 2. Configuration py3status Documentation, Release 3.21

• urgent_border: Specify urgent border color for modules. The following options will work on i3bar-gaps and py3status. • urgent_border_bottom: Specify urgent border width for modules • urgent_border_left: Specify urgent border width for modules. • urgent_border_right: Specify urgent border width for modules. • urgent_border_top: Specify urgent border width for modules. You lose urgent functionality too that can be sometimes utilized by container modules, e.g., frame and group.

# customize urgent py3status { urgent_background= 'blue' urgent_foreground= 'white' urgent_border= 'red' urgent_border_bottom=1 urgent_border_left=1 urgent_border_right=1 urgent_border_top=1 }

Note: New in version 3.20

You can specify the options in module or py3status configuration section. resources: Specify a list of 3-tuples, e.g., [(option, resource, fallback)], to import resources.

# import resources py3status { resources=[ ('color_bad',' *color9', 'lightcoral'), ('color_good',' *color10', 'lightgreen'), ('color_degraded',' *color11', 'khaki'), ('nagbar_font', 'py3status.font', 'pango:Ubuntu Mono 12'), ] }

# import 16 colors py3status { resources=[ ('color_color0',' *color0', 'black'), ('color_color1',' *color1', 'black'), ('color_color2',' *color2', 'black'), ('color_color3',' *color3', 'black'), ('color_color4',' *color4', 'black'), ('color_color5',' *color5', 'black'), ('color_color6',' *color6', 'black'), ('color_color7',' *color7', 'black'), ('color_color8',' *color8', 'black'), ('color_color9',' *color9', 'black'), ('color_color10',' *color10', 'black'), ('color_color11',' *color11', 'black'), ('color_color12',' *color12', 'black'), ('color_color13',' *color13', 'black'), (continues on next page)

2.3. py3status configuration section 9 py3status Documentation, Release 3.21

(continued from previous page) ('color_color14',' *color14', 'black'), ('color_color15',' *color15', 'black'), ] }

# apply colors coin_market { thresholds=[( -100, "color9"),(0, "color10")] }

2.4 Configuration obfuscation

Py3status allows you to hide individual configuration parameters so that they do not leak into log files, user notifica- tions or to the i3bar. Additionally they allow you to obfuscate configuration parameters using base64 encoding.

Note: hide() and base64() are new in version 3.13

To “hide” a value you can use the hide() configuration function. This prevents the module displaying the value as a format placeholder and from appearing in the logs.

Listing 5: Example # Example of 'hidden' configuration imap { imap_server= 'imap.myprovider.com' password= hide('hunter22') user= 'mylogin' }

To base64 encode a value you can use the base64() configuration function. This also prevents the module displaying the value as a format placeholder and from appearing in the logs.

Listing 6: Example # Example of obfuscated configuration imap { imap_server= 'imap.myprovider.com' password= base64('Y29jb251dA==') user= 'mylogin' }

Since version 3.1 obfuscation options can also be added by the legacy method. Add :hide or :base64 to the name of the parameters. You are advised to use the new hide() and base64() configuration functions.

Note: Legacy obfuscation is only available for string parameters with :hide or :base64. If you want other types then be sure to use hide() and base64() configuration functions.

10 Chapter 2. Configuration py3status Documentation, Release 3.21

Listing 7: Example # normal_parameter will be shown in log files etc as 'some value' # obfuscated_parameter will be shown in log files etc as '***' module { normal_parameter= 'some value' obfuscated_parameter:hide = 'some value' }

In the previous example configuration the users password is in plain text. Users may want to make it less easy to read. Py3status allows strings to be base64 encoded. To use an encoded string add :base64 to the name of the parameter.

Listing 8: Example # Example of obfuscated configuration imap { imap_server= 'imap.myprovider.com' password:base64 = 'Y29jb251dA==' user= 'mylogin' }

Note: Base64 encoding is very simple and should not be considered secure in any way.

2.5 Configuring colors

Since version 3.1 py3status allows greater color configuration. Colors can be set in the general section of your i3status.conf or in an individual modules configuration. If a color is not in a modules configuration then the values from the general section will be used. If a module does not specify colors but it is in a container, then the colors of the container will be used if they are set, before using ones defined in the general section. Generally colors can specified using hex values eg #FF00FF or #F0F. It is also possible to use css3 color names eg red hotpink. For a list of available color names see https://drafts.csswg.org/css-color/#named-colors.

Listing 9: Example general { # These will be used if not supplied by a module color= '#FFFFFF' color_good= '#00FF00' color_bad= '#FF0000' color_degraded= '#FFFF00' } time { color= 'FF00FF' format= "%H:%M" } battery_level { color_good= '#00AA00' (continues on next page)

2.5. Configuring colors 11 py3status Documentation, Release 3.21

(continued from previous page) color_bad= '#AA0000' color_degraded= '#AAAA00' color_charging= '#FFFF00' }

2.6 Configuring thresholds

Some modules allow you to define thresholds in a module. These are used to determine which color to use when displaying the module. Thresholds are defined in the config as a list of tuples. With each tuple containing a value and a color. The color can either be a named color eg good referring to color_good or a hex value.

Listing 10: Example volume_status { thresholds=[ (0, "#FF0000"), (20, "degraded"), (50, "bad"), ] }

If the value checked against the threshold is equal to or more than a threshold then that color supplied will be used. In the above example the logic would be if 0 >= value < 20 use #FF0000 else if 20 >= value < 50 use color_degraded else if 50 >= value use color_good

Some modules may allow more than one threshold to be defined. If all the thresholds are the same they can be defined as above but if you wish to specify them separately you can by giving a dict of lists.

Listing 11: Example my_module { thresholds={ 'threshold_1':[ (0, "#FF0000"), (20, "degraded"), (50, "bad"), ], 'threshold_2':[ (0, "good"), (30, "bad"), ], } }

Note: New in version 3.17

You can specify hidden color to hide a block.

12 Chapter 2. Configuration py3status Documentation, Release 3.21

Listing 12: Example # hide a block when ``1avg`` (i.e., 12.4) is less than 20 percent format= "[\?color=1avg [\?color=darkgray&show 1min] {1min}]" loadavg { thresholds=[ (0, "hidden"), (20, "good"), (40, "degraded"), (60, "#ffa500"), (80, "bad"), ] }

# hide cpu block when ``cpu_used_percent`` is less than 50 percent # hide mem block when ``mem_used_percent`` is less than 50 percent sysdata { thresholds=[ (50, "hidden"), (75, "bad"), ] }

2.7 Formatter

All modules allow you to define the format of their output. This is done with the format option. You can: • display static text:

Listing 13: Example mpd_status { format= "MPD:" }

• use a backslash \ to escape a character (\[ will show [). • display data provided by the module. This is done with “placeholders”, which follow the format {place- holder_name}. The following example shows the state of the MPD (play/pause/stop) and the artist and title of the currently playing song.

Listing 14: Example mpd_status { format= "MPD: {state} {artist} {title}" }

– Unknown placeholders act as if they were static text and placeholders that are empty or None will be removed. – Formatting can also be applied to the placeholder Eg {number:03.2f}. • hide invalid (no valid data or undefined) placeholders by enclosing them in []. The following example will show artist - title if artist is present and title if title but no artist is present.

2.7. Formatter 13 py3status Documentation, Release 3.21

Listing 15: Example mpd_status { format= "MPD: {state} [[{artist} - ]{title}]" }

• show the first block with valid output by dividing them with a pipe |. The following example will show the filename if neither artist nor title are present.

Listing 16: Example mpd_status { format= "MPD: {state} [[{artist} - ]{title}]|{file}" }

• \? can be used to provide extra commands to the format string. Multiple commands can be given using an ampersand & as a separator.

Listing 17: Example my_module { format= "\?color=#FF00FF&show blue" }

• change the output with conditions. This is done by following the \? with a an if statement. Multiple conditions or commands can be combined by using an ampersand & as a separator. Here are some examples: – \?if=online green | red checks if the placeholder exists and would display green in that case. A condition that evaluates to false invalidates a section and the section can be hidden with [] or skipped with | – \?if=!online red | green this dose the same as the above condition, the only difference is that the exclamation mark ! negates the condition. – \?if=state=play PLAYING! | not playing checks if the placeholder contains play and dis- plays PLAYING! if not it will display not playing. A format string using nearly all of the above options could look like this:

Listing 18: Example mpd_status { format= "MPD: {state} [\?if=![stop] [[{artist} - ]{title}]|[{file}]]" }

This will show MPD: [state] if the state of the MPD is [stop] or MPD: [state] artist - title if it is [play] or [pause] and artist and title are present, MPD: [state] title if artist is missing and MPD: [state] file if artist and title are missing.

2.8 Urgent

Some modules use i3bar’s urgent feature to indicate that something important has occurred. The allow_urgent configuration parameter can be used to allow/prevent a module from setting itself as urgent.

14 Chapter 2. Configuration py3status Documentation, Release 3.21

Listing 19: Example # prevent modules showing as urgent, except github py3status { allow_urgent= false } github { allow_urgent= true }

2.9 Grouping Modules

The group module allows you to group several modules together. Only one of the modules are displayed at a time. The displayed module can either be cycled through automatically or by user action (the default, on mouse scroll). This module is very powerful and allows you to save a lot of space on your bar.

Listing 20: Example order += "group tz"

# cycle through different timezone hours every 10s group tz { cycle= 10 format= "{output}"

tztime la { format= "LA %H:%M" timezone= "America/Los_Angeles" }

tztime ny { format= "NY %H:%M" timezone= "America/New_York" }

tztime du { format= "DU %H:%M" timezone= "Asia/Dubai" } }

The frame module also allows you to group several modules together, however in a frame all the modules are shown. This allows you to have more than one module shown in a group.

Listing 21: Example order += "group frames"

# group showing disk space or times using button to change what is shown. group frames { click_mode= "button"

frame time { (continues on next page)

2.9. Grouping Modules 15 py3status Documentation, Release 3.21

(continued from previous page) tztime la { format= "LA %H:%M" timezone= "America/Los_Angeles" }

tztime ny { format= "NY %H:%M" timezone= "America/New_York" }

tztime du { format= "DU %H:%M" timezone= "Asia/Dubai" } }

frame disks { disk "/" { format= "/ %avail" }

disk "/home" { format= "/home %avail" } } }

Frames can also have a toggle button to hide/show the content

Listing 22: Example # A frame showing times in different cities. # We also have a button to hide/show the content frame time { format= '{output}{button}' format_separator='' # have space instead of usual i3bar separator

tztime la { format= "LA %H:%M" timezone= "America/Los_Angeles" }

tztime ny { format= "NY %H:%M" timezone= "America/New_York" }

tztime du { format= "DU %H:%M" timezone= "Asia/Dubai" } }

16 Chapter 2. Configuration py3status Documentation, Release 3.21

2.10 Custom click events py3status allows you to easily add click events to modules in your i3bar. These modules can be both i3status or py3status modules. This is done in your i3status.config using the on_click parameter. Just add a new configuration parameter named on_click [button number] to your module config and py3status will then execute the given i3 command (using i3-msg). This means you can run simple tasks like executing a program or execute any other i3 specific command. As an added feature and in order to get your i3bar more responsive, every on_click command will also trigger a module refresh. This works for both py3status modules and i3status modules as described in the refresh command below.

# button numbers 1= left click 2= middle click 3= right click 4= scroll up 5= scroll down

Listing 23: Example # reload the i3 config when I left click on the i3status time module # and restart i3 when I middle click on it time { on_click 1= "reload" on_click 2= "restart" }

# control the volume with your mouse (need >i3-4.8) # launch alsamixer when I left click # kill it when I right click # toggle mute/unmute when I middle click # increase the volume when I scroll the mouse wheel up # decrease the volume when I scroll the mouse wheel down volume master { format=" ♪: %volume" device= "default" mixer= "Master" mixer_idx=0 on_click 1= "exec i3-sensible-terminal -e alsamixer" on_click 2= "exec amixer set Master toggle" on_click 3= "exec killall alsamixer" on_click 4= "exec amixer set Master 1+" on_click 5= "exec amixer set Master 1-" }

# run wicd-gtk GUI when I left click on the i3status ethernet module # and kill it when I right click on it ethernet eth0 { # if you use %speed, i3status requires root privileges format_up= "E: %ip" format_down="" on_click 1= "exec wicd-gtk" on_click 3= "exec killall wicd-gtk" } (continues on next page)

2.10. Custom click events 17 py3status Documentation, Release 3.21

(continued from previous page)

# run thunar when I left click on the / disk info module disk "/" { format= "/ %free" on_click 1= "exec thunar /" }

# this is a py3status module configuration # open an URL on opera when I left click on the weather_yahoo module weather_yahoo paris { cache_timeout= 1800 woeid= 615702 forecast_days=2 on_click 1= "exec opera http://www.meteo.fr" request_timeout= 10 }

2.11 Special on_click commands

There are two commands you can pass to the on_click parameter that have a special meaning to py3status : • refresh : This will refresh (expire the cache) of the clicked module. This also works for i3status modules (it will send a SIGUSR1 to i3status for you). • refresh_all : This will refresh all the modules from your i3bar (i3status included). This has the same effect has sending a SIGUSR1 to py3status.

2.12 Module data and on_click commands

Since version 3.3 it is possible to use the output text of a module in the on_click command. To do this $OUTPUT can be used in command and it will be substituted by the modules text output when the command is run.

Listing 24: Example # copy module output to the clipboard using xclip my_module { on_click 1= 'exec echo $OUTPUT | xclip -i' }

If the output of a module is a composite then the output of the part clicked on can be accessed using $OUTPUT_PART.

2.13 Environment Variables

Note: New in version 3.8

You may use the value of an environment variable in your configuration with the env(...) directive. These values are captured at startup and may be converted to the needed datatype (only str, int, float, bool and auto are currently supported).

18 Chapter 2. Configuration py3status Documentation, Release 3.21

Note, the auto conversion will try to guess the type of the contents and automatically convert to that type. Without an explicit conversion function, it defaults to auto. This is primarily designed to obfuscate sensitive information when sharing your configuration file, such as usernames, passwords, API keys, etc. The env(...) expression can be used anywhere a normal constant would be used. Note, you cannot use the directive in place of a dictionary key, i.e {..., env(KEY): 'val', ...}. See the examples below!

Listing 25: Example order += "my_module" order += env(ORDER_MODULE) module { normal_parameter= 'some value' env_parameter= env(SOME_ENVIRONMENT_PARAM) sensitive_api_key= env(API_KEY)

complex_parameter={ 'key': env(VAL) }

equivalent1= env(MY_VAL) equivalent2= env(MY_VAL, auto)

list_of_tuples=[ (env(APPLE_NUM, int), 'apple'), (2, env(ORANGE)) ]

float_param= env(MY_NUM, float) }

2.14 Inline Shell Code

Note: New in version 3.9

You can use the standard output of a shell script in your configuration with the shell(...) directive. These values are captured at startup and may be converted to the needed datatype (only str, int, float, bool and auto (default) are currently supported). The shell script executed must return a single line of text on stdout and then terminate. If the type is explicitly declared bool, the exit status of the script is respected (a non-zero exit status being interpreted falsey). In any other case if the script exits with a non-zero exit status an error will be thrown. The shell(...) expression can be used anywhere a constant or an env(...) directive can be used (see the section “Environment Variables”). Usage example:

2.14. Inline Shell Code 19 py3status Documentation, Release 3.21

Listing 26: Example my_module { password= shell(pass show myPasswd | head -n1) some_string= shell(/opt/mydaemon/get_api_key.sh, str) pid= shell(cat /var/run/mydaemon/pidfile, int) my_bool= shell(pgrep thttpd, bool) }

Due to the way the config is parsed you need to to escape any closing parenthesis ) using a backslash \).

Listing 27: Example static_string { # note we need to explicitly cast the result to str # because we are using it as the format which must be a # string format= shell(echo $((6 + 2\)\), str) }

Note: Prior to version 3.13 you may not include any closing parenthesis ) in the expression. Wrap your commands in a script file and call it instead.

2.15 Refreshing modules on udev events with on_udev dynamic op- tions

Note: New in version 3.14

Refreshing of modules can be triggered when an udev event is detected on a specific subsystem using the on_udev_ configuration parameter and an associated action. Possible actions: • refresh: immediately refresh the module and keep on updating it as usual • refresh_and_freeze: module is ONLY refreshed when said udev subsystem emits an event

Listing 28: Example # refresh xrandr only when udev 'drm' events are triggered xrandr { on_udev_drm= "refresh_and_freeze" }

Note: This feature will only activate when pyudev is installed on the system. This is an optional dependency of py3status and is therefore not enforced by all package managers.

20 Chapter 2. Configuration py3status Documentation, Release 3.21

2.16 Request Settings

2.16.1 Handling timeouts

Timeouts are handled thanks to the global request_timeout setting.

Note: New in version 3.16

Request Timeout for URL request based modules can be specified in the module configuration. To find out if your module supports that, look for self.py3.request in the code. Otherwise, we will use 10.

Listing 29: Example # stop waiting for a response after 10 seconds exchange_rate { request_timeout= 10 }

2.16.2 Handling retries

Retries are handled thanks to the global request_retry_times and request_retry_wait settings.

Note: New in version 3.21

Requests failing due to network unavailability or remote server timeouts are retried automatically request_retry_times times (default 3) at a request_retry_wait (default 2) seconds interval. This allows to be more graceful to i3 startup when network is not up yet or to short network disruptions and not display an error on the bar in that case. To find out if your module supports that, look for self.py3.request in the code.

Listing 30: Example # try to contact the OWM API 10 times every 5 seconds before displaying # an error on the bar for the module # that is equivalent to 50 seconds of retrying before an error occurs weather_owm { request_retry_times= 10 request_retry_wait=5 }

2.16. Request Settings 21 py3status Documentation, Release 3.21

22 Chapter 2. Configuration CHAPTER 3

Modules

py3status comes with a large selection of modules ready to use. For information on their configuration see Configura- tion. You can also get a list with short descriptions of all available modules by using the CLI:

$ py3-cmd list --all

To get more details about all available modules and their configuration, use:

$ py3-cmd list --all --full

3.1 air_quality

Display air quality polluting in a given location. An air quality index (AQI) is a number used by government agencies to communicate to the public how polluted the air currently is or how polluted it is forecast to become. As the AQI increases, an increasingly large percentage of

23 py3status Documentation, Release 3.21 the population is likely to experience increasingly severe adverse health effects. Different countries have their own air quality indices, corresponding to different national air quality standards. Configuration parameters: • auth_token Personal token required. See https://aqicn.org/data-platform/token for more information. (default ‘demo’) • cache_timeout refresh interval for this module. A message from the site: The default quota is max 1000 requests per minute (~16RPS) and with burst up to 60 requests. See https://aqicn.org/api/ for more information. (default 3600) • format display format for this module (default ‘[\?color=aqi {city_name}: {aqi} {category}]’) • format_datetime specify strftime characters to format (default {}) • location location or uid to query. To search for nearby stations in Kraków, try https://api. waqi.info/search/?token=YOUR_TOKEN&keyword=kraków For best results, use uid instead of name in location, eg @8691. (default ‘Shanghai’) • quality_thresholds specify a list of tuples, eg (number, ‘color’, ‘name’) (default [(0, ‘#009966’, ‘Good’), (51, ‘#FFDE33’, ‘Moderate’), (101, ‘#FF9933’, ‘Sensitively Unhealthy’), (151, ‘#CC0033’, ‘Unhealthy’), (201, ‘#660099’, ‘Very Unhealthy’), (301, ‘#7E0023’, ‘Hazardous’)]) • thresholds specify color thresholds to use (default {‘aqi’: True}) Notes: Your station may have individual scores for pollutants not listed below. See https://api.waqi.info/feed/@UID/ ?token=TOKEN (Replace UID and TOKEN) for a full list of placeholders to use. Format placeholders: • {aqi} air quality index • {attributions_0_name} attribution name, there maybe more, change the 0 • {attributions_0_url} attribution url, there maybe more, change the 0 • {category} health risk category, eg Good, Moderate, Unhealthy, etc • {city_geo_0} monitoring station latitude • {city_geo_1} monitoring station longitude • {city_name} monitoring station name • {city_url} monitoring station url • {dominentpol} dominant pollutant, eg pm25 • {idx} Unique ID for the city monitoring station, eg 7396 • {time} epoch timestamp, eg 1510246800 • {time_s} local timestamp, eg 2017-11-09 17:00:00 • {time_tz} local timezone, eg -06:00 • {iaqi_co} individual score for pollutant carbon monoxide • {iaqi_h} individual score for pollutant h (?) • {iaqi_no2} individual score for pollutant nitrogen dioxide • {iaqi_o3} individual score for pollutant ozone • {iaqi_pm25} individual score for pollutant particulates smaller than 2.5 휇m in aerodynamic diameter • {iaqi_pm10} individual score for pollutant particulates smaller than 10 휇m in aerodynamic diameter

24 Chapter 3. Modules py3status Documentation, Release 3.21

• {iaqi_pm15} individual score for pollutant particulates smaller than than 15 휇m in aerodynamic diam- eter • {iaqi_p} individual score for pollutant particulates • {iaqi_so2} individual score for pollutant sulfur dioxide • {iaqi_t} individual score for pollutant t (?) • {iaqi_w} individual score for pollutant w (?) AQI denotes an air quality index. IQAI denotes an individual AQI score. Try https://en.wikipedia.org/wiki/ Air_pollution#Pollutants for more information on the pollutants retrieved from your monitoring station. format_datetime placeholders: • key epoch_placeholder, eg time, vtime • value % strftime characters to be translated, eg ‘%b %d’ —-> ‘Nov 11’ Color options: • color_bad print a color for error (if any) from the site Color thresholds: • xxx print a color based on the value of xxx placeholder Examples:

# show last updated time air_quality { format = '{city_name}: {aqi} {category} - {time}' format_datetime = {'time': '%-I%P'} }

author beetleman, lasers license BSD

3.2 apt_updates

Display number of pending updates for Debian based Distros. Thanks to Iain Tatch for the script that this is based on. This will display a count of how many ‘apt’ updates are waiting to be installed. Configuration parameters: • cache_timeout How often we refresh this module in seconds (default 600) • format Display format to use (default ‘UPD[\?not_zero : {apt}]’) Format placeholders: • {apt} Number of pending apt updates Requires: • apt Needed to display pending ‘apt’ updates

3.2. apt_updates 25 py3status Documentation, Release 3.21 author Joshua Pratt license BSD

3.3 arch_updates

Display number of pending updates for Arch Linux. Configuration parameters: • cache_timeout refresh interval for this module (default 600) • format display format for this module, otherwise auto (default None) • hide_if_zero don’t show on bar if True (default False) Format placeholders: • {aur} Number of pending aur updates • {pacman} Number of pending pacman updates • {total} Total updates pending Requires: • pacman-contrib contributed scripts and tools for pacman systems • auracle a flexible command line client for arch linux’s user repository • trizen lightweight pacman wrapper and AUR helper • yay yet another yogurt. pacman wrapper and aur helper written in go

@author Iain Tatch @license BSD

3.4 async_script

Display output of a given script asynchronously. Always displays the last line of output from a given script, set by script_path. If a line contains only a color (/^#[0-F]{6}$/), it is used as such (set force_nocolor to disable). The script may have parameters. Configuration parameters: • force_nocolor if true, won’t check if a line contains color (default False) • format see placeholders below (default ‘{output}’)

26 Chapter 3. Modules py3status Documentation, Release 3.21

• script_path script you want to show output of (compulsory) (default None) • strip_output shall we strip leading and trailing spaces from output (default False) Format placeholders: • {output} output of script given by “script_path” Examples: async_script { format = "{output}" script_path = "ping 127.0.0.1" } author frimdo [email protected], girst

3.5 aws_bill

Display bill for Amazon Web Services. WARNING: This module generate some costs on the AWS bill. Take care about the cache_timeout to limit these fees! Configuration parameters: • aws_access_key_id Your AWS access key (default ‘’) • aws_account_id The root ID of the AWS account Can be found here‘‘ https://console.aws.amazon. com/billing/home#/account (default ‘’) • aws_secret_access_key Your AWS secret key (default ‘’) • billing_file Csv file location (default ‘/tmp/.aws_billing.csv’) • cache_timeout How often we refresh this module in seconds (default 3600) • format string that formats the output. See placeholders below. (default ‘{bill_amount}$’) • s3_bucket_name The bucket where billing files are sent by AWS. Follow this article to activate this feature: https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-reports.html (default ‘’) Format placeholders: • {bill_amount} AWS bill amount Color options: • color_good Balance available • color_bad An error has occured Requires: • boto a python interface to amazon web services (aws) author nawadanp

3.5. aws_bill 27 py3status Documentation, Release 3.21

3.6 backlight

Adjust screen backlight brightness. Configuration parameters: • brightness_delta Change the brightness by this step. (default 8) • brightness_initial Set brightness to this value on start. (default None) • brightness_minimal Don’t go below this brightness to avoid black screen (default 1) • button_down Button to click to decrease brightness. Setting to 0 disables. (default 5) • button_up Button to click to increase brightness. Setting to 0 disables. (default 4) • cache_timeout How often we refresh this module in seconds (default 10) • command The program to use to change the backlight. Currently xbacklight and light are supported. The program needs to be installed and on your path. (default ‘xbacklight’) • device Device name or full path to use, eg, acpi_video0 or /sys/class/backlight/acpi_video0, otherwise automatic (default None) • format Display brightness, see placeholders below (default ‘: {level}%’) • hide_when_unavailable Hide if no backlight is found (default False) • low_tune_threshold If current brightness value is below this threshold, the value is changed by a minimal value instead of the brightness_delta. (default 0) Format placeholders: • {level} brightness Requires: • xbacklight need for changing brightness, not detection • light program to easily change brightness on backlight-controllers author Tjaart van der Walt (github:tjaartvdwalt) license BSD

3.7 battery_level

Display battery information. Configuration parameters: • battery_id id of the battery to be displayed set to ‘all’ for combined display of all batteries (default 0) • blocks a string, where each character represents battery level especially useful when using icon fonts (e.g. FontAwesome) (default “_”)

28 Chapter 3. Modules py3status Documentation, Release 3.21

• cache_timeout a timeout to refresh the battery state (default 60) • charging_character a character to represent charging battery especially useful when using icon fonts (e.g. FontAwesome) (default “”) • format string that formats the output. See placeholders below. (default “{icon}”) • format_notify_charging format of the notification received when you click on the module while your computer is plugged in (default ‘Charging ({percent}%)’) • format_notify_discharging format of the notification received when you click on the module while your computer is not plugged in (default “{time_remaining}”) • hide_seconds hide seconds in remaining time (default False) • hide_when_full hide any information when battery is fully charged (when the battery level is greater than or equal to ‘threshold_full’) (default False) • measurement_mode either ‘acpi’ or ‘sys’, or None to autodetect. ‘sys’ should be more robust and does not have any extra requirements, however the time measurement may not work in some cases (default None) • notification show current battery state as notification on click (default False) • notify_low_level display notification when battery is running low (when the battery level is less than ‘threshold_degraded’) (default False) • on_udev_power_supply dynamic variable to watch for power_supply udev subsystem events to trigger specified action. (default “refresh”) • sys_battery_path set the path to your battery(ies), without including its number (default “/sys/class/power_supply/”) • threshold_bad a percentage below which the battery level should be considered bad (default 10) • threshold_degraded a percentage below which the battery level should be considered degraded (default 30) • threshold_full a percentage at or above which the battery level should should be considered full (default 100) Format placeholders: • {ascii_bar} - a string of ascii characters representing the battery level, an alternative visualization to ‘{icon}’ option • {icon} - a character representing the battery level, as defined by the ‘blocks’ and ‘charging_character’ parameters • {percent} - the remaining battery percentage (previously ‘{}’) • {time_remaining} - the remaining time until the battery is empty Color options: • color_bad Battery level is below threshold_bad • color_charging Battery is charging (default “#FCE94F”) • color_degraded Battery level is below threshold_degraded • color_good Battery level is above thresholds Requires: • the acpi the acpi command line utility (only if measurement_mode='acpi')

3.7. battery_level 29 py3status Documentation, Release 3.21

author shadowprince, AdamBSteele, maximbaz, 4iar, m45t3r license Eclipse Public License

3.8 bitcoin_price

Display bitcoin using bitcoincharts.com. Configuration parameters: • cache_timeout refresh interval for this module. A message from the site: Don’t query more often than once every 15 minutes (default 900) • color_index Index of the market responsible for coloration, -1 means no coloration, except when only one market is selected (default -1) • field Field that is displayed per market, see https://bitcoincharts.com/about/markets-api/ (default ‘close’) • format display format for this module (default ‘{format_bitcoin}’) • format_bitcoin display format for bitcoin (default ‘{market}: {price}{symbol}’) • format_separator show separator if more than one (default ‘, ‘) • hide_on_error show error message (default False) • markets list of supported markets https://bitcoincharts.com/markets/list/ (default ‘btceUSD, btcdeEUR’) • symbols if possible, convert currency abbreviations to symbols e.g. USD -> $, EUR -> C and so on (default True) Format placeholders: • {format_bitcoin} format for bitcoin format_bitcoin placeholders: • {market} market names • {price} current prices • {symbol} currency symbols Color options: • color_bad Price has dropped or not available • color_good Price has increased author Andre Doser

3.9 bluetooth

30 Chapter 3. Modules py3status Documentation, Release 3.21

Display bluetooth status. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘BT[: {format_device}]’) • format_device display format for bluetooth devices (default ‘{name}’) • format_separator show separator if more than one (default ‘\|’) Format placeholders: • {format_device} format for bluetooth devices format_device placeholders: • {mac} bluetooth device address • {name} bluetooth device name Color options: • color_bad No connection • color_good Active connection Requires: • pydbus pythonic dbus library author jmdana license GPLv3

3.10 check_tcp

Display status of a TCP port on a given host. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘{host}:{port} {state}’) • host name of host to check for (default ‘localhost’) • icon_off show this when unavailable (default ‘DOWN’) • icon_on show this when available (default ‘UP’) • port number of port to check for (default 22) Format placeholders: • {state} port state Color options: • color_down Closed, default to color_bad

3.10. check_tcp 31 py3status Documentation, Release 3.21

• color_up Open, default to color_good author obb, Moritz Lüdecke

3.11 clementine

Display song currently playing in Clementine. Configuration parameters: • cache_timeout refresh interval for this module (default 5) • format display format for this module (default ‘ {current}’) Format placeholders: • {current} currently playing Requires: • clementine a modern music player and library organizer • qdbus a communication-interface for qt-based applications (may be part of qt5-tools) author Francois LASSERRE license GNU GPL https://www.gnu.org/licenses/gpl.html

3.12 clock

Display date and time. This module allows one or more datetimes to be displayed. All datetimes share the same format_time but can set their own timezones. Timezones are defined in the format using the TZ name in squiggly brackets eg {GMT}, {Portugal}, {Europe/Paris}, {America/Argentina/Buenos_Aires}. ISO-3166 two letter country codes eg {de} can also be used but if more than one timezone exists for the country eg {us} the first one will be selected. {Local} can be used for the local settings of your computer. Note: Timezones are case sensitive A full list of timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones Configuration parameters: • block_hours length of time period for all blocks in hours (default 12) • blocks a string, where each character represents time period from the start of a time period. (default ‘’) • button_change_format button that switches format used setting to None disables (default 1)

32 Chapter 3. Modules py3status Documentation, Release 3.21

• button_change_time_format button that switches format_time used. Setting to None disables (default 2) • button_reset button that switches display to the first timezone. Setting to None disables (default 3) • cycle If more than one display then how many seconds between changing the display (default 0) • format defines the timezones displayed. This can be a single string or a list. If a list is supplied then the formats can be cycled through using cycle or by button click. (default ‘{Local}’) • format_time format to use for the time, strftime directives such as %H can be used this can be either a string or to allow multiple formats as a list. The one used can be changed by button click. (default [‘[{name_unclear} ]%c’, ‘[{name_unclear} ]%x %X’, ‘[{name_unclear} ]%a %H:%M’, ‘[{name_unclear} ]{icon}’]) • round_to_nearest_block defines how a block icon is chosen. Examples: when set to True, ‘13:14’ is ‘’, ‘13:16’ is ‘’ and ‘13:31’ is ‘’; when set to False, ‘13:14’ is ‘’, ‘13:16’ is ‘’ and ‘13:31’ is ‘’. (default True) Format placeholders: • {icon} a character representing the time from blocks • {name} friendly timezone name eg Buenos Aires • {name_unclear} friendly timezone name eg Buenos Aires but is empty if only one timezone is provided • {timezone} full timezone name eg America/Argentina/Buenos_Aires • {timezone_unclear} full timezone name eg America/Argentina/Buenos_Aires but is empty if only one timezone is provided Requires: • pytz cross platform time zone library for python • tzlocal tzinfo object for the local timezone Examples:

# cycling through London, Warsaw, Tokyo clock { cycle = 30 format = ["{Europe/London}", "{Europe/Warsaw}", "{Asia/Tokyo}"] format_time = "{name} %H:%M" }

# Show the time and date in New York clock { format = "Big Apple {America/New_York}" format_time = "%Y-%m-%d %H:%M:%S" }

# wall clocks clock { format = "{Asia/Calcutta} {Africa/Nairobi} {Asia/Bangkok}" format_time = "{name} {icon}" }

author tobes license BSD

3.12. clock 33 py3status Documentation, Release 3.21

3.13 cmus

Display song currently playing in cmus. cmus (C* Music Player) is a small, fast and powerful console audio player which supports most major audio formats. Various features include gapless playback, ReplayGain support, MP3 and Ogg streaming, live filtering, instant startup, customizable key-bindings, and vi-style default key-bindings. Configuration parameters: • button_next mouse button to skip next track (default None) • button_pause mouse button to pause/play the playback (default 1) • button_previous mouse button to skip previous track (default None) • button_stop mouse button to stop the playback (default 3) • cache_timeout refresh interval for this module (default 5) • format display format for this module (default ‘[\?if=is_started [\?if=is_playing > ][\?if=is_paused \|\| ]’ ‘[\?if=is_stopped .. ][[{artist}][\?soft - ][{title}]’ ‘|\?show cmus: waiting for user input]]’) • sleep_timeout sleep interval for this module. when cmus is not running, this interval will be used. this allows some flexible timing where one might want to refresh constantly with some placeholders. . . or to refresh only once every minute rather than every few seconds. (default 20) Control placeholders: • {is_paused} a boolean based on cmus status • {is_playing} a boolean based on cmus status • {is_started} a boolean based on cmus status • {is_stopped} a boolean based on cmus status • {continue} a boolean based on data status • {play_library} a boolean based on data status • {play_sorted} a boolean based on data status • {repeat} a boolean based on data status • {repeat_current} a boolean based on data status • {replaygain} a boolean based on data status • {replaygain_limit} a boolean based on data status • {shuffle} a boolean based on data status • {softvol} a boolean based on data status • {stream} a boolean based on data status

34 Chapter 3. Modules py3status Documentation, Release 3.21

Format placeholders: • {aaa_mode} shuffle mode, eg artist, album, all • {albumartist} album artist, eg (new output here) • {album} album name, eg (new output here) • {artist} artist name, eg (new output here) • {bitrate} audio bitrate, eg 229 • {comment} comment, eg URL • {date} year number, eg 2015 • {duration} length time in seconds, eg 171 • {durationtime} length time in [HH:]MM:SS, eg 02:51 • {file} file location, eg /home/user/Music. . . • {position} elapsed time in seconds, eg 17 • {positiontime} elapsed time in [HH:]MM:SS, eg 00:17 • {replaygain_preamp} replay gain preamp, eg 0.000000 • {status} playback status, eg playing, paused, stopped • {title} track title, eg (new output here) • {tracknumber} track number, eg 0 • {vol_left} left volume number, eg 90 • {vol_right} right volume number, eg 90 Placeholders are retrieved directly from cmus-remote --query command. The list was harvested only once and should not represent a full list. Color options: • color_paused Paused, defaults to color_degraded • color_playing Playing, defaults to color_good • color_stopped Stopped, defaults to color_bad Requires: • cmus a small feature-rich ncurses-based music player author lasers

3.14 coin_balance

Display balances of diverse crypto-currencies. This module grabs your current balance of different crypto-currents from a wallet server. The server must conform to the bitcoin RPC specification. Currently Bitcoin, Dogecoin, and Litecoin are supported. Configuration parameters:

3.14. coin_balance 35 py3status Documentation, Release 3.21

• cache_timeout An integer specifying the cache life-time of the output in seconds (default 30) • coin_password A string containing the password for the server for ‘coin’. The ‘coin’ part must be replaced by a supported coin identifier (see below for a list of identifiers). If no value is supplied, the value of ‘password’ (see below) will be used. If ‘password’ too is not set, the value will be retrieved from the standard ‘coin’ daemon configuration file. (default None) • coin_username A string containing the username for the server for ‘coin’. The ‘coin’ part must be replaced by a supported coin identifier (see below for a list of identifiers). If no value is supplied, the value of ‘username’ (see below) will be used. If ‘username’ too is not set, the value will be retrieved from the standard ‘coin’ daemon configuration file. (default None) • credentials (default None) • format A string describing the output format for the module. The {} placeholder (see below) will be used to determine how to fetch the coin balance. Multiple placeholders are allowed, but all balances will be fetched from the same host. (default ‘LTC: {litecoin}’) • host The coin-server hostname. Note that all coins will use the same host for their querries. (default ‘localhost’) • password A string containing the password for all coin-servers. If neither this setting, nor a specific coin_password (see above) is specified, the password for each coin will be read from the respective stan- dard daemon configuration file. (default None) • protocol A string to select the server communication protocol. (default ‘http’) • username A string containing the username for all coin-servers. If neither this setting, nor a specific coin_username (see above) is specified, the username for each coin will be read from the respective stan- dard daemon configuration file. (default None) Format placeholders: • {} Your balance for the coin where is one of: • bitcoin • dogecoin • litecoin Requires: • requests python module from pypi https://pypi.python.org/pypi/requests At least version 2.4.2 is re- quired. Examples:

# Get your Bitcoin balance using automatic credential detection coin_balance { cache_timeout = 45 format = "My BTC: {bitcoin}" host = "localhost" protocol = "http" }

# Get your Bitcoin, Dogecoin and Litecoin balances using specific credentials # for Bitcoin and automatic detection for Dogecoin and Litecoin coin_balance { # ... format = "{bitcoin} BTC {dogecoin} XDG {litecoin} LTC" bitcoin_username = "lcdata" bitcoin_password = "omikron-theta" (continues on next page)

36 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) # ... }

# Get your Dogecoin and Litecoin balances using 'global' credentials coin_balance { # ... format = "XDG: {dogecoin} LTC: {litecoin}" username = "crusher_b" password = "WezRulez" # ... }

# Get you Dogecoin, Litecoin, and Bitcoin balances by using 'global' # credentials for Bitcoin and Dogecoin but specific credentials for # Litecoin. coin_balance { # ... format = "XDG: {dogecoin} LTC: {litecoin} BTC: {bitcoin}" username = "zcochrane" password = "sunny_islands" litecoin_username = 'locutus' litecoin_password = 'NCC-1791-D' # ... } author Felix Morgner license 3-clause-BSD

3.15 coin_market

Display cryptocurrency coins. The site offer various types of data such as name, symbol, price, volume, total supply, et cetera for a wide range of cryptocurrencies and the prices can be obtained in a different currency along with optional USD currency. For more information, visit https://coinmarketcap.com Configuration parameters: • cache_timeout refresh interval for this module. a message from the site: please limit requests to no more than 10 per minute. (default 600) • format display format for this module (default ‘{format_coin}’) • format_coin display format for coins (default ‘{name} ${price_usd:.2f} ‘ ‘[\?color=percent_change_24h {percent_change_24h}%]’) • format_datetime specify strftime characters to format (default {}) • format_separator show separator if more than one (default ‘ ‘) • markets number of top-ranked markets or list of user-inputted markets (default [‘btc’])

3.15. coin_market 37 py3status Documentation, Release 3.21

• thresholds specify color thresholds to use (default [(-100, ‘bad’), (0, ‘good’)]) Format placeholders: • {format_coin} format for cryptocurrency coins format_datetime placeholders: • key epoch_placeholder, eg last_updated • value % strftime characters to be translated, eg ‘%b %d’ —-> ‘Nov 29’ format_coin placeholders: • {id} eg bitcoin • {name} eg Bitcoin • {symbol} eg BTC • {rank} eg 1 • {price_usd} eg 11163.4 • {price_btc} eg 1.0 • {24h_volume_usd} eg 10156700000.0 • {market_cap_usd} eg 186528134260 • {available_supply} eg 16708900.0 • {total_supply} eg 16708900.0 • {max_supply} eg 21000000.0 • {percent_change_1h} eg 0.92 • {percent_change_24h} eg 11.2 • {percent_change_7d} eg 35.96 • {last_updated} eg 151197295 Placeholders are retrieved directly from the URL. The list was harvested once and should not represent a full list. To print coins in different currency, replace or replicate the placeholders below with a valid option (eg ‘{price_gbp}’) to create additional placeholders: {price_xxx} eg (new output here) {24h_volume_xxx} eg (new output here) {market_cap_xxx} eg (new output here) Valid options are: AUD, BRL, CAD, CHF, CNY, EUR, GBP, HKD, IDR, INR, JPY, KRW, MXN, RUB, otherwise USD. . . and be written in lowercase. Color thresholds: • xxx print a color based on the value of xxx placeholder Examples:

# view coins in GBP and optionally USD coin_market { format_coin = '{name} £{price_gbp:.2f} ${price_usd:.2f} {percent_change_24h}' }

# display top five markets (continues on next page)

38 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) coin_market { markets = 5 }

# colorize market names coin_market { format_coin = "[\?color=name {name}] ${price_usd:.2f} " format_coin += "[\?color=percent_change_24h {percent_change_24h}%]" markets = ["btc", "eth", "ltc", "doge"] thresholds = { "name": [ ("Bitcoin", "greenyellow"), ("Ethereum", "deepskyblue"), ("Litecoin", "crimson"), ("Dogecoin", "orange"), ], "percent_change_24h": [(-100, "bad"), (0, "good")], } }

# show and/or customize last_updated time coin_market { format_coin = '{name} ${price_usd:.2f} ' format_coin += '[\?color=percent_change_24h {percent_change_24h}%] {last_updated}' format_datetime = {'last_updated': '\?color=degraded last updated %-I:%M%P'} } author lasers, x86kernel

3.16 conky

3.16. conky 39 py3status Documentation, Release 3.21

Display Conky objects/variables on the bar. Configuration parameters: • config specify configuration settings for conky (default {}) • format display format for this module (default None) • thresholds specify color thresholds to use (default []) Format placeholders: According to man page, Conky has more than 250 built-in objects/variables. See man -P 'less -p OBJECTS/VARIABLES' conky for a full list of Conky objects/variables to use. Not all of Conky objects/variables will be supported or usable. Color thresholds: • xxx print a color based on the value of xxx placeholder Replace spaces with periods. Examples:

# add conky config options # See `man -P "less -p 'CONFIGURATION SETTINGS'" conky` for a full list # of Conky configuration options. Not all of Conky configuration options # will be supported or usable. conky { config = { 'update_interval': 10 # update interval for conky 'update_interval_on_battery': 60 # update interval when on battery 'format_human_readable': True, # if False, print in bytes 'short_units': True, # shortens units, eg kiB->k, GiB->G 'uppercase': True, # upper placeholders } }

# display ip address order += "conky addr" conky addr { format = 'IP [\?color=orange {addr eno1}]' }

# display load averages order += "conky loadavg" conky loadavg { format = 'Loadavg ' format += '[\?color=lightgreen {loadavg 1} ]' format += '[\?color=lightgreen {loadavg 2} ]' format += '[\?color=lightgreen {loadavg 3}]' }

# exec commands at different intervals, eg 5s, 60s, and 3600s order += "conky date" conky date { (continues on next page)

40 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) format = 'Exec ' format += '[\?color=good {execi 5 "date"}] ' format += '[\?color=degraded {execi 60 "uptime -p"}] ' format += '[\?color=bad {execi 3600 "uptime -s"}]' }

# display diskio read, write, etc order += "conky diskio" conky diskio { format = 'Disk IO [\?color=darkgray&show sda] ' format += '[\?color=lightskyblue ' format += '{diskio_read sda}/{diskio_write sda} ' format += '({diskio sda})]'

# format += ' ' # format += '[\?color=darkgray&show sdb] ' # format += '[\?color=lightskyblue ' # format += '{diskio_read sdb}/{diskio_write sdb} ' # format += '({diskio sdb})]' config = {'short_units': True} }

# display total number of processes and running processes order += "conky proc" conky proc { format = 'Processes [\?color=cyan {processes}/{running_processes}]' }

# display top 3 cpu (+mem_res) processes order += "conky top_cpu" { conky top_cpu { format = 'Top [\?color=darkgray ' format += '{top name 1} ' format += '[\?color=deepskyblue {top mem_res 1}] ' format += '[\?color=lightskyblue {top cpu 1}%] '

format += '{top name 2} ' format += '[\?color=deepskyblue {top mem_res 2}] ' format += '[\?color=lightskyblue {top cpu 2}%] '

format += '{top name 3} ' format += '[\?color=deepskyblue {top mem_res 3}] ' format += '[\?color=lightskyblue {top cpu 3}%]]' config = {'short_units': True} }

# display top 3 memory processes order += "conky top_mem" conky top_mem { format = 'Top Mem [\?color=darkgray ' format += '{top_mem name 1} ' format += '[\?color=yellowgreen {top_mem mem_res 1}] ' format += '[\?color=lightgreen {top_mem mem 1}%] '

format += '{top_mem name 2} ' format += '[\?color=yellowgreen {top_mem mem_res 2}] ' format += '[\?color=lightgreen {top_mem mem 2}%] ' (continues on next page)

3.16. conky 41 py3status Documentation, Release 3.21

(continued from previous page)

format += '{top_mem name 3} ' format += '[\?color=yellowgreen {top_mem mem_res 3}] ' format += '[\?color=lightgreen {top_mem mem 3}%]]' config = {'short_units': True} }

# display memory, memperc, membar + thresholds order += "conky memory" conky memory { format = 'Memory [\?color=lightskyblue {mem}/{memmax}] ' format += '[\?color=memperc {memperc}% \[{membar}\]]' thresholds = [ (0, 'darkgray'), (0.001, 'good'), (50, 'degraded'), (75, 'orange'), (85, 'bad') ] }

# display swap, swapperc, swapbar + thresholds order += "conky swap" conky swap { format = 'Swap [\?color=lightcoral {swap}/{swapmax}] ' format += '[\?color=swapperc {swapperc}% \[{swapbar}\]]' thresholds = [ (0, 'darkgray'), (0.001, 'good'), (50, 'degraded'), (75, 'orange'), (85, 'bad') ] }

# display up/down speed and up/down total order += "conky network" conky network { format = 'Speed [\?color=title {upspeed eno1}/{downspeed eno1}] ' format += 'Total [\?color=title {totalup eno1}/{totaldown eno1}]' color_title = '#ff6699' }

# display file systems + thresholds order += "conky filesystem" conky filesystem { # home filesystem format = 'Home [\?color=violet {fs_used /home}/{fs_size /home} ' format += '[\?color=fs_used_perc./home ' format += '{fs_used_perc /home}% \[{fs_bar /home}\]]]'

# hdd filesystem # format += ' HDD [\?color=violet {fs_used ' # format += '/run/media/user/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # format += '}/{fs_size ' # format += '/run/media/user/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # format += '}[\?color=fs_used_perc.' # format += '/run/media/user/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # format += ' {fs_used_perc ' # format += '/run/media/user/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # format += '}% \[{fs_bar ' # format += '/run/media/user/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # format += '}\]]]' (continues on next page)

42 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page)

thresholds = [ (0, 'darkgray'), (0.001, 'good'), (50, 'degraded'), (75, 'orange'), (85, 'bad') ] }

# show cpu percents/bars + thresholds order += "conky cpu" conky cpu { format = 'CPU ' format += '[\?color=cpu.cpu0 {cpu cpu0}% {cpubar cpu0}] ' format += '[\?color=cpu.cpu1 {cpu cpu1}% {cpubar cpu1}] ' format += '[\?color=cpu.cpu2 {cpu cpu2}% {cpubar cpu2}] ' format += '[\?color=cpu.cpu3 {cpu cpu3}% {cpubar cpu3}]'

thresholds = [ (0, 'darkgray'), (0.001, 'good'), (50, 'degraded'), (75, 'orange'), (85, 'bad') ] }

# show more examples, many outputs order += "conky info" conky info { format = '[\?color=title&show OS] [\?color=output {distribution}] ' format += '[\?color=title&show CPU] [\?color=output {cpu cpu0}%] ' format += '[\?color=title&show MEM] ' format += '[\?color=output {mem}/{memmax} ({memperc}%)] ' format += '[\?color=title&show HDD] [\?color=output {fs_used_perc}%] ' format += '[\?color=title&show Kernel] [\?color=output {kernel}] ' format += '[\?color=title&show Loadavg] [\?color=output {loadavg 1}] ' format += '[\?color=title&show Uptime] [\?color=output {uptime}] ' format += '[\?color=title&show Freq GHZ] [\?color=output {freq_g}]' color_title = '#ffffff' color_output = '#00bfff' }

# change console bars - shoutout to su8 for adding this conky { config = { 'console_bar_fill': "'#'", 'console_bar_unfill': "'_'", 'default_bar_width': 10, } }

# display nvidia stats - shoutout to brndnmtthws for fixing this # See `man -P 'less -p nvidia\ argument' conky` for more nvidia variables. order += "conky nvidia" conky nvidia { format = 'GPU Temp [\?color=greenyellow {nvidia temp}] ' format += 'GPU Freq [\?color=greenyellow {nvidia gpufreq}] ' format += 'Mem Freq [\?color=greenyellow {nvidia memfreq}] ' format += 'MTR Freq [\?color=greenyellow {nvidia mtrfreq}] ' format += 'Perf [\?color=greenyellow {nvidia perflevel}] ' format += 'Mem Perc [\?color=greenyellow {nvidia memperc}]' (continues on next page)

3.16. conky 43 py3status Documentation, Release 3.21

(continued from previous page) config = { 'nvidia_display': "':0'" } } author lasers

3.17 deadbeef

Display songs currently playing in DeaDBeeF. Configuration parameters: • cache_timeout refresh interval for this module (default 5) • format display format for this module (default ‘[{artist} - ][{title}]’) • sleep_timeout when deadbeef is not running, this interval will be used to allow faster refreshes with time-related placeholders and/or to refresh few times per minute rather than every few seconds (default 20) Format placeholders: • {album} name of the album • {artist} name of the artist • {length} length time in [HH:]MM:SS • {playback_time} elapsed time in [HH:]MM:SS • {title} title of the track • {tracknumber} track number in two digits • {year} year in four digits For more placeholders, see title formatting 2.0 in ‘deadbeef –help’ or https://github.com/ DeaDBeeF-Player/deadbeef/wiki/Title-formatting-2.0 Not all of remapped metadata fields will work with deadbeef and a quick reminder about using {placeholders} here instead of %placeholder%. Color options: • color_paused Paused, defaults to color_degraded • color_playing Playing, defaults to color_good • color_stopped Stopped, defaults to color_bad Requires: • deadbeef a GTK+ audio player for GNU/Linux Examples:

44 Chapter 3. Modules py3status Documentation, Release 3.21

# see 'deadbeef --help' for more buttons deadbeef { on_click 1 = 'exec deadbeef --play-pause' on_click 8 = 'exec deadbeef --random' } author mrt-prodz

3.18 diskdata

Display disk information. Configuration parameters: • cache_timeout refresh interval for this module. (default 10) • disk show stats for disk or partition, i.e. sda1. None for all disks. (default None) • format display format for this module. (default “{disk}: {used_percent}% ({total})”) • format_rate display format for rates value (default “[\?min_length=11 {value:.1f} {unit}]”) • format_space display format for disk space values (default “[\?min_length=5 {value:.1f}]”) • sector_size size of the disk’s sectors. (default 512) • si_units use SI units (default False) • thresholds specify color thresholds to use (default {‘free’: [(0, ‘bad’), (10, ‘degraded’), (100, ‘good’)], ‘total’: [(0, ‘good’), (1024, ‘degraded’), (1024 * 1024, ‘bad’)], ‘used_percent’: [(0, ‘good’), (40, ‘degraded’), (75, ‘bad’)]}) • unit unit to use. If the unit contains a multiplier prefix, only this exact unit will ever be used (default “B/s”) Format placeholders: • {disk} the selected disk • {free} free space on disk in GB • {used} used space on disk in GB • {total_space} total space on disk in GB • {used_percent} used space on disk in % • {read} reading rate • {total} total IO rate • {write} writing rate format_rate placeholders: • {unit} name of the unit • {value} numeric value of the rate format_space placeholders:

3.18. diskdata 45 py3status Documentation, Release 3.21

• {value} numeric value of the free/used space on the device Color thresholds: • {free} Change color based on the value of free • {used} Change color based on the value of used • {used_percent} Change color based on the value of used_percent • {read} Change color based on the value of read • {total} Change color based on the value of total • {write} Change color based on the value of write author guiniol license BSD

3.19 do_not_disturb

Turn on and off desktop notifications. Configuration parameters: • cache_timeout refresh interval for this module; for xfce4-notifyd (default 30) • format display format for this module (default ‘{name} [\?color=state&show DND]’) • pause specify whether to pause or kill processes; for dunst see Dunst Miscellaneous section for more information (default False) • server specify server to use, eg dunst or xfce4-notifyd, otherwise auto (default None) • state specify state to use on startup, otherwise last False: disable Do Not Disturb on startup True: enable Do Not Disturb on startup last: toggle last known state on startup None: query current state from notification manager (doesn’t work on dunst) (default ‘last’) • thresholds specify color thresholds to use (default [(0, ‘bad’), (1, ‘good’)]) Format placeholders: • {name} name, eg Dunst, Xfce4-notifyd • {state} do not disturb state, eg 0, 1 Color thresholds: • xxx print a color based on the value of xxx placeholder Dunst Miscellaneous: When paused, dunst will not display any notifications but keep all notifications in a queue. This can for example be wrapped around a screen locker (i3lock, slock) to prevent flickering of notifications through the lock and to read all missed notifications after returning to the computer. This means that by default (pause = False), all notifications sent while DND is active will NOT be queued and displayed when DND is deactivated. Examples:

46 Chapter 3. Modules py3status Documentation, Release 3.21

# display ON/OFF do_not_disturb { format = '{name} [\?color=state [\?if=state ON|OFF]]' }

# display 1/0 do_not_disturb { format = '{name} [\?color=state {state}]' }

# display DO NOT DISTURB/DISTURB do_not_disturb { format = '[\?color=state [\?if=state DO NOT DISTURB|DISTURB]]' thresholds = [(0, "darkgray"), (1, "good")] } author Maxim Baz https://github.com/maximbaz (dunst) author Robert Ricci https://github.com/ricci (xfce4-notifyd) license BSD

3.20 dpms

Turn on and off DPMS and screen saver blanking. Configuration parameters: • button_off mouse button to turn off screen (default None) • button_toggle mouse button to toggle DPMS (default 1) • cache_timeout refresh interval for this module (default 15) • format display format for this module (default ‘{icon}’) • icon_off show when DPMS is disabled (default ‘DPMS’) • icon_on show when DPMS is enabled (default ‘DPMS’) Format placeholders: • {icon} DPMS icon Color options: • color_on Enabled, defaults to color_good • color_off Disabled, defaults to color_bad author Andre Doser

3.20. dpms 47 py3status Documentation, Release 3.21

3.21 dropboxd_status

Display status of Dropbox daemon. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default “Dropbox: {status}”) • status_busy text for placeholder {status} when Dropbox is busy (default None) • status_off text for placeholder {status} when Dropbox isn’t running (default “isn’t running”) • status_on text for placeholder {status} when Dropbox is up to date (default “Up to date”) Value for status_off if not set: • Dropbox isn’t running! Value for status_on if not set: • Up to date Values for status_busy if not set: • Connecting. . . • Starting. . . • Downloading file list. . . • Syncing “filename” Format placeholders: • {status} Dropbox status Color options: • color_bad Not running • color_degraded Busy • color_good Up to date Requires: • dropbox-cli command line interface for dropbox Notes: Some distributions offer an option to install dropbox-cli. If you don’t see one for your distribution, then you need to download CLI Python script, https://www.dropbox.com/help/desktop-web/linux-commands# commands, rename it to dropbox-cli, make the script executable and available in your PATH. author Tjaart van der Walt (github:tjaartvdwalt) license BSD

48 Chapter 3. Modules py3status Documentation, Release 3.21

3.22 emerge_status

Display information about the currently running emerge process. Configuration parameters: • cache_timeout how often we refresh this module in second. NOTE: when emerge is running, we will refresh this module every second. (default 30) • emerge_log_file path to the emerge log file. (default ‘/var/log/emerge.log’) • format display format for this module (default ‘{prefix}[\?if=is_running : [\?if=!total=0 ‘ ‘[{cur- rent}/{total} {action} {category}/{pkg}]’ ‘|calculating. . . ]|: stopped 0/0]’) • prefix prefix in statusbar (default “emrg”) Format placeholders: • {action} current emerge action • {category} category of the currently emerged package • {current} number of package that is currently emerged • {pkg} name of the currently emerged packaged • {total} total number of packages that will be emerged Examples:

# Hide if not running emerge_status { format = "[\?if=is_running {prefix}: [\?if=!total=0 " format += "{current}/{total} {action} {category}/{pkg}" format += "|calculating...]]" }

# Minimalistic emerge_status { format = "[\?if=is_running [\?if=!total=0 {current}/{total}]]" }

# Minimalistic II emerge_status { format = "[\?if=is_running {current}/{total}]" }

author AnwariasEu

3.23 exchange_rate

Display foreign exchange rates. Configuration parameters:

3.22. emerge_status 49 py3status Documentation, Release 3.21

• base specify base currency to use for exchange rates (default ‘EUR’) • cache_timeout refresh interval for this module (default 600) • format display format for this module (default ‘${USD} £{GBP} ¥{JPY}’) Format placeholders: See https://api.exchangeratesapi.io/latest for a full list of foreign exchange rates published by the European Central Bank. Not all of exchange rates will be available. Also, see https://en.wikipedia.org/wiki/ ISO_4217 author tobes license BSD

3.24 external_script

Display output of a given script. Display output of any executable script set by script_path. Only the first two lines of output will be used. The first line is used as the displayed text. If the output has two or more lines, the second line is set as the text color (and should hence be a valid hex color code such as #FF0000 for red). The script should not have any parameters, but it could work. Configuration parameters: • button_show_notification button to show notification with full output (default None) • cache_timeout how often we refresh this module in seconds (default 15) • format see placeholders below (default ‘{output}’) • localize should script output be localized (if available) (default True) • script_path script you want to show output of (compulsory) (default None) • strip_output shall we strip leading and trailing spaces from output (default False) Format placeholders: • {lines} number of lines in the output • {output} output of script given by “script_path” Examples:

external_script { format = "my name is {output}" script_path = "/usr/bin/whoami" }

author frimdo [email protected]

50 Chapter 3. Modules py3status Documentation, Release 3.21

3.25 fedora_updates

Display number of pending updates for Fedora Linux. This will display a count of how many dnf updates are waiting to be installed. Additionally check for update security notices. Configuration parameters: • cache_timeout How often we refresh this module in seconds (default 600) • check_security Check for security updates (default True) • format Display format to use (default ‘DNF: {updates}’) Format placeholders: • {updates} number of pending dnf updates Color options: • color_bad Security notice • color_degraded Upgrade available • color_good No upgrades needed author tobes license BSD

3.26 file_status

Display if files or directories exists. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘\?color=path [\?if=path |]’) • format_path format for paths (default ‘{basename}’) • format_path_separator show separator if more than one (default ‘ ‘) • paths specify a string or a list of paths to check (default None) • thresholds specify color thresholds to use (default [(0, ‘bad’), (1, ‘good’)]) Format placeholders: • {format_path} format for paths • {path} number of paths, eg 1, 2, 3 format_path placeholders:

3.25. fedora_updates 51 py3status Documentation, Release 3.21

• {basename} basename of pathname • {pathname} pathname Color options: • color_bad files or directories does not exist • color_good files or directories exists Color thresholds: • format path: print a color based on the number of paths Examples:

# add multiple paths with wildcard or with pathnames file_status { paths = ['/tmp/test*', '~user/test1', '~/Videos/*.mp4'] }

# colorize basenames file_status { paths = ['~/.config/i3/modules/*.py'] format = '{format_path}' format_path = '\?color=good {basename}' format_path_separator = ', ' }

author obb, Moritz Lüdecke, Cyril Levis (@cyrinux)

3.27 frame

Group modules and treat them as a single one. This can be useful for example when adding modules to a group and you wish two modules to be shown at the same time. By adding the {button} placeholder in the format you can enable a toggle button to hide or show the content. Configuration parameters: • button_toggle Button used to toggle if one in format. Setting to None disables (default 1) • format Display format to use (default ‘{output}’) • format_button_closed Format for the button when frame open (default ‘+’) • format_button_open Format for the button when frame closed (default ‘-‘) • format_separator Specify separator between contents. If this is None then the default i3bar separator will be used (default None) • open If button then the frame can be set to be open or close (default True) Format placeholders:

52 Chapter 3. Modules py3status Documentation, Release 3.21

• {button} If used a button will be used that can be clicked to hide/show the contents of the frame. • {output} The output of the modules in the frame Examples:

# A frame showing times in different cities. # We also have a button to hide/show the content frame time { format = '{output}{button}' format_separator = ' ' # have space instead of usual i3bar separator

tztime la { format = "LA %H:%M" timezone = "America/Los_Angeles" } tztime ny { format = "NY %H:%M" timezone = "America/New_York" } tztime du { format = "DU %H:%M" timezone = "Asia/Dubai" } }

# Define a group which shows volume and battery info or the current time. # The frame, volume_status and battery_level modules are named to prevent # them clashing with any other defined modules of the same type. group { frame { volume_status {} battery_level {} } time {} } author tobes

3.28 getjson

Display JSON data fetched from a URL. This module gets the given url configuration parameter and assumes the response is a JSON object. The keys of the JSON object are used as the format placeholders. The format placeholders are replaced by the value. Objects that are nested can be accessed by using the delimiter configuration parameter in between. Configuration parameters: • cache_timeout refresh interval for this module (default 30) • delimiter the delimiter between parent and child objects (default ‘-‘) • format display format for this module (default None) • url specify URL to fetch JSON from (default None)

3.28. getjson 53 py3status Documentation, Release 3.21

Format placeholders: Placeholders will be replaced by the JSON keys. Placeholders for objects with sub-objects are flattened using ‘delimiter’ in between (eg. {‘parent’: {‘child’: ‘value’}} will use placeholder {parent-child}). Placeholders for list elements have ‘delimiter’ followed by the index (eg. {‘parent’: [‘this’, ‘that’]) will use placeholders {parent-0} for ‘this’ and {parent-1} for ‘that’. Examples:

# straightforward key replacement url = 'http://ip-api.com/json' format = '{lat}, {lon}'

# access child objects url = 'https://api.icndb.com/jokes/random' format = '{value-joke}'

# access title from 0th element of articles list url = 'https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey={KEY}' format = '{articles-0-title}'

# access if top-level object is a list url = 'https://jsonplaceholder.typicode.com/posts/1/comments' format = '{0-name}' author vicyap

3.29 github

Display Github notifications and issue/pull requests for a repo. To check notifications a Github username and personal access token are required. You can create a per- sonal access token at https://github.com/settings/tokens/new?scopes=notifications&description=py3status The only scope needed is notifications is selected automatically for you, which provides readonly access to notifi- cations. The Github API is rate limited so setting cache_timeout too small may cause issues see https://developer.github. com/v3/#rate-limiting for details Configuration parameters: • auth_token Github personal access token, needed to check notifications see above. (default None) • button_action Button that when clicked opens the Github notification page if notifications, else the project page for the repository if there is one (otherwise the github home page). Setting to None disables. (default 3) • button_refresh Button that when clicked refreshes module. Setting to None disables. (default 2) • cache_timeout How often we refresh this module in seconds (default 60) • format display format for this module, see Examples below (default None)

54 Chapter 3. Modules py3status Documentation, Release 3.21

• format_notifications Format of {notification} status placeholder. (default ‘ N{notifications_count}’) • notifications Type of notifications can be all for all notifications or repo to only get notifications for the repo specified. If repo is not provided then all notifications will be checked. (default ‘all’) • repo Github repo to check (default ‘ultrabug/py3status’) • url_api Change only if using Enterprise Github, example https://github.domain.com/api/v3. (default ‘https://api.github.com’) • url_base Change only if using Enterprise Github, example https://github.domain.com. (default ‘https://github.com’) • username Github username, needed to check notifications. (default None) Format placeholders: • {issues} Number of open issues. • {notifications} Notifications. If no notifications this will be empty. • {notifications_count} Number of notifications. This is also the __Only__ placeholder available to format_notifications. • {pull_requests} Number of open pull requests • {repo} short name of the repository being checked. eg py3status • {repo_full} full name of the repository being checked. eg ultrabug/py3status Examples:

# default formats github { # with username and auth_token, this will be used format = '{repo} {issues}/{pull_requests}{notifications}'

# otherwise, this will be used format '{repo} {issues}/{pull_requests}' }

# set github access credentials github { auth_token = '40_char_hex_access_token' username = 'my_username' }

# just check for any notifications github { auth_token = '40_char_hex_access_token' username = 'my_username' format = 'Github {notifications_count}' }

author tobes

3.30 gitlab

3.30. gitlab 55 py3status Documentation, Release 3.21

Display number of issues, requests and more from a GitLab project. A token is required. See https://gitlab.com/profile/personal_access_tokens to make one. Make a name, eg py3status, and enable api in scopes. Save. Configuration parameters: • auth_token specify a personal access token to use (default None) • button_open mouse button to open project url (default 1) • button_refresh mouse button to refresh this module (default 2) • cache_timeout refresh interval for this module (default 900) • format display format for this module (default ‘[{name} ][[{open_issues_count}][\?soft /]’ ‘[{open_merge_requests_count}]]’) • project specify a project to use (default ‘gitlab-org/gitlab-ce’) • thresholds specify color thresholds to use (default []) Format placeholders: See sp below for a full list of supported GitLab placeholders to use. Not all of GitLab place- holders will be usable. single_project: {name} project name, eg py3status {star_count} number of stars, eg 2 {forks_count} number of forks, eg 3 {open_issues_count} number of open issues, eg 4 {statistics_commit_count} number of commits, eg 5678 merge_requests: {open_merge_requests_count} number of open merge requests, eg 9 todos: {todos_count} number of todos, eg 4 pipelines: {pipelines_status} project status of pipelines, eg success Notes: • sp https://docs.gitlab.com/ee/api/projects.html#get-single-project • mr https://docs.gitlab.com/ee/api/merge_requests.html • td https://docs.gitlab.com/ee/api/todos.html • pipe https://docs.gitlab.com/ee/api/pipelines.html Color thresholds: • xxx print a color based on the value of xxx placeholder Examples:

# follow a fictional project, add an icon gitlab { auth_token = 'abcdefghijklmnopq-a4' project = 'https://gitlab.com/ultrabug/py3status'

format = '[\?if=name [\?color=orangered&show ] {name} ]' format += '[[{open_issues_count}][\?soft /]' format += '[{open_merge_requests_count}][\?soft /]' format += '[{pipelines_status}]]' } author lasers, Cyril Levis (@cyrinux)

56 Chapter 3. Modules py3status Documentation, Release 3.21

3.31 glpi

Display number of open tickets from GLPI. It features thresholds to colorize the output and forces a low timeout to limit the impact of a server connectivity problem on your i3bar freshness. Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 300) • critical set bad color above this threshold (default 20) • db database to use (default ‘’) • format format of the module output (default ‘{tickets_open} tickets’) • host database host to connect to (default ‘’) • password login password (default ‘’) • timeout timeout for database connection (default 5) • user login user (default ‘’) • warning set degraded color above this threshold (default 15) Format placeholders: • {tickets_open} The number of open tickets Color options: • color_bad Open ticket above critical threshold • color_degraded Open ticket above warning threshold Requires: MySQL-python: https://pypi.org/project/MySQL-python/ author ultrabug

3.32 google_calendar

Display upcoming Google Calendar events. This module will display information about upcoming Google Calendar events in one of two formats which can be toggled with a button press. The event URL may also be opened in a web browser with a button press. Configuration parameters: • auth_token The path to where the access/refresh token will be saved after successful credential autho- rization. (default ‘~/.config/py3status/google_calendar.auth_token’) • blacklist_events Event names in this list will not be shown in the module (case insensitive). (default []) • button_open Opens the event URL in the default web browser. (default 3)

3.31. glpi 57 py3status Documentation, Release 3.21

• button_refresh Refreshes the module and updates the list of events. (default 2) • button_toggle Toggles a boolean to hide/show the data for each event. (default 1) • cache_timeout How often the module is refreshed in seconds (default 60) • client_secret the path to your client_secret file which contains your OAuth 2.0 credentials. (default ‘~/.config/py3status/google_calendar.client_secret’) • events_within_hours Select events within the next given hours. (default 12) • force_lowercase Sets whether to force all event output to lower case. (default False) • format The format for module output. (default ‘{events}|\?color=event ’) • format_date The format for date related format placeholders. May be any Python strftime directives for dates. (default ‘%a %d-%m’) • format_event The format for each event. The information can be toggled with ‘button_toggle’ based on the value of ‘is_toggled’. (default ‘[\?color=event {summary}][\?if=is_toggled ({start_time}’ ‘ - {end_time}, {start_date})|[ ({location})][ {format_timer}]]’) • format_notification The format for event warning notifications. (default ‘{summary} {start_time} - {end_time}’) • format_separator The string used to separate individual events. (default ‘ \| ‘) • format_time The format for time-related placeholders except {format_timer}. May use any Python strftime directives for times. (default ‘%I:%M %p’) • format_timer The format used for the {format_timer} placeholder to display time until an event starts or time until an event in progress is over. (default ‘\?color=time ([\?if=days {days}d ][\?if=hours {hours}h ]’ ‘[\?if=minutes {minutes}m])[\?if=is_current left]’) • ignore_all_day_events Sets whether to display all day events or not. (default False) • num_events The maximum number of events to display. (default 3) • response Only display events for which the response status is on the list. (default [‘accepted’]) • thresholds Thresholds for events. The first entry is the color for event 1, the second for event 2, and so on. (default []) • time_to_max Threshold (in minutes) for when to display the {format_timer} string; e.g. if time_to_max is 60, {format_timer} will only be displayed for events starting in 60 minutes or less. (default 180) • warn_threshold The number of minutes until an event starts before a warning is displayed to notify the user; e.g. if warn_threshold is 30 and an event is starting in 30 minutes or less, a notification will be displayed. disabled by default. (default 0) • warn_timeout The number of seconds before a warning should be issued again. (default 300) Control placeholders: • {is_toggled} a boolean toggled by button_toggle Format placeholders: • {events} All the events to display. format_event and format_notification placeholders: • {description} The description for the calendar event. • {end_date} The end date for the event.

58 Chapter 3. Modules py3status Documentation, Release 3.21

• {end_time} The end time for the event. • {location} The location for the event. • {start_date} The start date for the event. • {start_time} The start time for the event. • {summary} The summary (i.e. title) for the event. • {format_timer} The time until the event starts (or until it is over if already in progress). format_timer placeholders: • {days} The number of days until the event. • {hours} The number of hours until the event. • {minutes} The number of minutes until the event. Color options: • color_event Color for a single event. • color_time Color for the time associated with each event. Requires: 1. Python library google-api-python-client. 2. Python library python-dateutil. 3. OAuth 2.0 credentials for the Google Calendar api. Follow Step 1 of the guide here to obtain your OAuth 2.0 credentials: https://developers.google.com/ google-apps/calendar/quickstart/python Download the client_secret.json file which contains your client ID and client secret. In your config file, set configuration parameter client_secret to the path to your client_secret.json file. The first time you run the module, a browser window will open asking you to authorize access to your calendar. After authorization is complete, an access/refresh token will be saved to the path configured in auth_token, and i3status will be restarted. This restart will occur only once after the first time you successfully authorize. Examples:

# add color gradients for events and dates/times google_calendar { thresholds = { 'event': [(1, '#d0e6ff'), (2, '#bbdaff'), (3, '#99c7ff'), (4, '#86bcff'), (5, '#62a9ff'), (6, '#8c8cff'), (7, '#7979ff')], 'time': [(1, '#ffcece'), (2, '#ffbfbf'), (3, '#ff9f9f'), (4, '#ff7f7f'), (5, '#ff5f5f'), (6, '#ff3f3f'), (7, '#ff1f1f')] } } author Igor Grebenkov license BSD

3.33 gpmdp

3.33. gpmdp 59 py3status Documentation, Release 3.21

Display song currently playing in Google Play Music Desktop Player. Configuration parameters: • cache_timeout refresh interval for this module (default 5) • format specify the items and ordering of the data in the status bar. These area 1:1 match to gpmdp- remote’s options (default ‘ {info}’) Format placeholders: • {info} Print info about now playing song • {title} Print current song title • {artist} Print current song artist • {album} Print current song album • {album_art} Print current song album art URL • {time_current} Print current song time in milliseconds • {time_total} Print total song time in milliseconds • {status} Print whether GPMDP is paused or playing • {current} Print now playing song in “artist - song” format Requires: • gpmdp https://www.googleplaymusicdesktopplayer.com/ • gpmdp-remote https://github.com/iandrewt/gpmdp-remote author Aaron Fields https://twitter.com/spirotot license BSD

3.34 graphite

Display Graphite metrics. Configuration parameters: • cache_timeout how often we refresh this module in seconds. (default 120) • datapoint_selection when multiple data points are returned, use “max” or “min” to determine which one to display. (default “max”) • format you MUST use placeholders here to display data, see below. (default ‘’) • graphite_url URL to your graphite server. (default ‘’) • http_timeout HTTP query timeout to graphite. (default 10) • proxy You can configure the proxy with HTTP or HTTPS. examples: proxy = ‘https: //myproxy.example.com:1234/’ proxy = ‘http://user:[email protected]/’ proxy = ‘socks5://user:passwd@host:port’ (proxy_socks is available after an ‘pip install requests[socks]’) (default None) • targets semicolon separated list of targets to query graphite for. (default ‘’)

60 Chapter 3. Modules py3status Documentation, Release 3.21

• threshold_bad numerical threshold, if set will send a notification and colorize the output. (default None) • threshold_degraded numerical threshold, if set will send a notification and colorize the output. (default None) • timespan time range to query graphite for. (default “-2minutes”) • value_comparator choose between “max” and “min” to compare thresholds to the data point value. (default “max”) • value_format pretty format long numbers with “K”, “M” etc. (default True) • value_round round values so they’re not displayed as floats. (default True) Dynamic format placeholders: The “format” parameter placeholders are dynamically based on the data points names returned by the “targets” query to graphite. For example if your target is "carbon.agents.localhost-a.memUsage", you’d get a JSON result like this:

{ "target": "carbon.agents.localhost-a.memUsage", "datapoints": [[19693568.0, 1463663040]] }

So the placeholder you could use on your “format” config is: format = "{carbon.agents. localhost-a.memUsage}" TIP: use aliases !

targets = "alias(carbon.agents.localhost-a.memUsage, 'local_memuse')" format = "local carbon mem usage: {local_memuse} bytes"

Color options: • color_bad threshold_bad has been exceeded • color_degraded threshold_degraded has been exceeded author ultrabug

3.35 group

Group modules and switch between them. Groups can be configured in your config. The active one of these groups is shown in the i3bar. The active group can be changed by a user click. If the click is not used by the group module then it will be passed down to the displayed module. Modules can be i3status core modules or py3status modules. The active group can be cycled through automatically.

3.35. group 61 py3status Documentation, Release 3.21

The group can handle clicks by reacting to any that are made on it or its content or it can use a button and only respond to clicks on that. The way it does this is selected via the click_mode option. Configuration parameters: • align Text alignment when fixed_width is set can be ‘left’, ‘center’ or ‘right’ (default ‘center’) • button_next Button that when clicked will switch to display next module. Setting to 0 will disable this action. (default 5) • button_prev Button that when clicked will switch to display previous module. Setting to 0 will disable this action. (default 4) • button_toggle Button that when clicked toggles the group content being displayed between open and closed. This action is ignored if {button} is not in the format. Setting to 0 will disable this action (default 1) • click_mode This defines how clicks are handled by the group. If set to all then the group will respond to all click events. This may cause issues with contained modules that use the same clicks that the group captures. If set to button then only clicks that are directly on the {button} are acted on. The group will need {button} in its format. (default ‘all’) • cycle Time in seconds till changing to next module to display. Setting to 0 will disable cycling. (default 0) • fixed_width Reduce the size changes when switching to new group (default False) • format display format for this module, see Examples below (default None) • format_button_closed Format for the button when group open (default ‘+’) • format_button_open Format for the button when group closed (default ‘-‘) • format_closed Format for module output when closed. (default “{button}”) • open Is the group open and displaying its content. Has no effect if {button} not in format (default True) Format placeholders: • {button} The button to open/close or change the displayed group • {output} Output of current active module Examples:

# default formats group { format = '{output}' # if click_mode is 'all' format = '{output} {button}' # if click_mode is 'button' }

# Create a disks group that will show space on '/' and '/home' # Change between disk modules every 30 seconds order += "group disks" group disks { cycle = 30 format = "Disks: {output} {button}" click_mode = "button"

disk "/" { format = "/ %avail" } (continues on next page)

62 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) disk "/home" { format = "/home %avail" } } author tobes

3.36 hamster

Display time tracking activities from Hamster. Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 10) • format see placeholders below (default ‘{current}’) Format placeholders: • {current} current activity Requires: • hamster time tracking application author Aaron Fields (spirotot [at] gmail.com) license BSD

3.37 hddtemp

Display hard drive temperatures. hddtemp is a small utility with daemon that gives the hard drive temperature via S.M.A.R.T. (Self-Monitoring, Anal- ysis, and Reporting Technology). This module requires the user-defined hddtemp daemon to be running at all times. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘{format_hdd}’) • format_hdd display format for hard drives (default ‘{name} [\?color=temperature {tempera- ture}°{unit}]’)

3.36. hamster 63 py3status Documentation, Release 3.21

• format_separator show separator if more than one (default ‘ ‘) • thresholds specify color thresholds to use (default [(19, ‘skyblue’), (24, ‘deepskyblue’), (25, ‘lime’), (41, ‘yellow’), (46, ‘orange’), (51, ‘red’), (56, ‘tomato’)]) Format placeholders: • {format_hdd} format for hard drives format_hdd placeholders: • {name} name, eg ADATA SP550 • {path} path, eg /dev/sda • {temperature} temperature, eg 32 • {unit} temperature unit, eg C Temperatures: Less than 25°C: Too cold (color deepskyblue) 25°C to 40°C: Ideal (color good) 41°C to 50°C: Ac- ceptable (color degraded) 46°C to 50°C: Almost too hot (color orange) More than 50°C: Too hot (color bad) Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • hddtemp utility to monitor hard drive temperatures Bible of HDD failures: Hard disk temperatures higher than 45°C led to higher failure rates. Temperatures lower than 25°C led to higher failure rates as well. Aging hard disk drives (3 years and older) were much more prone to failure when their average temperatures were 40°C and higher. Hard disk manufacturers often state the operating temperatures of their hard disk drives to be between 0°C to 60°C. This can be misleading because what they mean is that your hard disk will function at these tem- peratures, but it doesn’t tell you anything about how long they are going to survive at this range. http: //www.buildcomputers.net/hdd-temperature.html Backblaze: Overall, there is not a correlation between operating temperature and failure rates The one exception is the Seagate Barracuda 1.5TB drives, which fail slightly more when they run warmer. As long as you run drives well within their allowed range of operating temperatures, keeping them cooler doesn’t matter. https: //www.backblaze.com/blog/hard-drive-temperature-does-it-matter/ Examples:

# compact the format hddtemp { format = 'HDD {format_hdd}' format_hdd = '\?color=temperature {temperature}°C' }

# show paths instead of names hddtemp { format_hdd = '{path} [\?color=temperature {temperature}°{unit}]' }

# show more colors hddtemp { gradients = True } author lasers

64 Chapter 3. Modules py3status Documentation, Release 3.21

3.38 hueshift

Shift color temperature on the screen. Configuration parameters: • button_down mouse button to decrease color temperature (default 5) • button_toggle mouse button to toggle color temperature (default 1) • button_up mouse button to increase color temperature (default 4) • command specify blueshift, redshift, or sct to use, otherwise auto (default None) • delta specify interval value to change color temperature (default 100) • format display format for this module (default ‘{name} [\?if=enabled&color=darkgray disabled’ ‘|[\?color=color_temperature {color_temperature}K]]’) • maximum specify maximum color temperature to use (default 25000) • minimum specify minimum color temperature to use (default 1000) • thresholds specify color thresholds to use (default [(6499, ‘#f6c’), (6500, ‘#ff6’), (6501, ‘#6cf’)]) Control placeholders: • {enabled} a boolean based on pgrep processing data, eg False, True Format placeholders: • {color_temperature} color temperature, eg 6500 • {name} name, eg Blueshift, Redshift, Sct Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • blueshift an extensible and highly configurable alternative to redshift • redshift program to adjust the color temperature of your screen • sct set color temperature with about 40 lines of C or so Suggestions: • campfire 4500 dust storm on mars: 2000 coffee free all nighter: 8000 Notes: hueshift can be disabled due to enabled running processes. sct and blueshift shifts only on one monitor, ideal for laptops. redshift shifts more than one, ideal for multi-monitors setups. Examples:

3.38. hueshift 65 py3status Documentation, Release 3.21

# different theme hueshift { format = '\?color=color_temperature {color_temperature}K' }

# for best results, add some limitations hueshift { minimum = 3000 maximum = 10000 } author lasers

3.39 i3block

Support i3blocks blocklets in py3status. i3blocks, https://github.com/vivien/i3blocks, is a project to allow simple scripts to provide output to the i3bar. This module allows these blocklets to run under py3status. The configuration of the blocklets is similar to how they are configured in i3blocks. Configuration parameters: • cache_timeout How often the blocklet should be called (in seconds). This is similar to cache_timeout used by standard modules. However it can also take the following values; once the blocklet will be called once, repeat the blocklet will be called constantly, or persist where the command will be expected to keep providing new data. If this is not set or is None then the blocklet will not be called unless clicked on. To simplify i3block compatability, this configuration parameter can also be provided as interval. (default None) • command Path to blocklet or command (default None) • format What to display on the bar (default ‘{output}’) • instance Will be provided to the blocklet as $BLOCK_INSTANCE (default ‘’) • label Will be prepended to the blocklets output (default ‘’) • name Name of the blocklet - passed as $BLOCK_NAME (default ‘’) Format placeholders: • {output} The output of the blocklet Notes: i3blocks and i3blocklets are subject to their respective licenses. This support is experimental and done for convenience to users so they can benefit from both worlds, issues or PRs regarding i3blocks related blocklets should not be raised. Some blocklets may return pango markup eg

66 Chapter 3. Modules py3status Documentation, Release 3.21

Examples:

# i3blocks config [time] command=date '+%D %T' interval=5

[wifi] instance=wls1 label='wifi:' command=~/i3blocks/wifi.sh interval=5

# py3status config order += 'i3block time' i3block time { command = "date '+%D %T'" interval = 5 }

# different py3status config order += 'i3block wifi' i3block wifi { instance = wls1 label = 'wifi:' command = '~/i3blocks/wifi.sh' interval = 5 } author tobes

3.40 i3pystatus

Support i3pystatus modules in py3status. i3pystatus, https://github.com/enkore/i3pystatus, is an alternative to py3status and provides a variety of modules. This py3status module allows these modules to run and be display inside py3status. Configuration parameters: • module specifiy i3pystatus module to use (default None) Requires: • i3pystatus i3status replacement written in python Examples:

# the modules parameters are provided as such i3pystatus clock { module = 'clock' format = [('%a %b %-d %b %X', 'America/New_York'), ('%X', 'Etc/GMT+9')] }

# if backend(s) are provided they should be given as a dict with the key being (continues on next page)

3.40. i3pystatus 67 py3status Documentation, Release 3.21

(continued from previous page) # the backend name and the value being a dict of the backend settings i3pystatus weather { module = 'weather' format = '{condition} {current_temp}{temp_unit}[ {icon}]' format += '[ Hi: {high_temp}][ Lo: {low_temp}][ {update_error}]' backend = { 'weathercom.Weathercom': { 'location_code': '94107:4:US', 'units': 'imperial', } } }

# backends that have no configuration should be defined as shown here i3pystatus updates{ module = 'updates' backends = {'dnf.Dnf': {}} } author tobes

3.41 icinga2

Display service status for Icinga2. Configuration parameters: • base_url the base url to the icinga-web2 services list (default ‘’) • ca (default True) • cache_timeout how often the data should be updated (default 60) • disable_acknowledge enable or disable counting of acknowledged service problems (default False) • format define a format string like “CRITICAL: %d” (default ‘{status_name}: {count}’) • password password to authenticate against the icinga-web2 interface (default ‘’) • status set the status you want to obtain (0=OK,1=WARNING,2=CRITICAL,3=UNKNOWN) (default 0) • url_parameters (default ‘?service_state={service_state}&format=json’) • user username to authenticate against the icinga-web2 interface (default ‘’) Format placeholders: • {status_name} status name, eg OK, WARNING, CRITICAL

68 Chapter 3. Modules py3status Documentation, Release 3.21

• {count} count, eg 0, 1, 2 author Ben Oswald license BSD License source https://github.com/nazco/i3status-modules

3.42 imap

Display number of unread messages from IMAP account. Configuration parameters: • allow_urgent display urgency on unread messages (default False) • cache_timeout refresh interval for this module (default 60) • criterion status of emails to check for (default ‘UNSEEN’) • debug log warnings (default False) • format display format for this module (default ‘Mail: {unseen}’) • hide_if_zero hide this module when no new mail (default False) • mailbox name of the mailbox to check (default ‘INBOX’) • password login password (default None) • port number to use (default ‘993’) • read_timeout timeout for read(2) syscalls (default 5) • security login authentication method: ‘ssl’ or ‘starttls’ (startssl needs python 3.2 or later) (default ‘ssl’) • server server to connect (default None) • use_idle use IMAP4 IDLE instead of polling; requires compatible server; uses cache_timeout for IDLE’s timeout; will auto detect when set to None (default None) • user login user (default None) Format placeholders: • {unseen} number of unread emails Color options: • color_new_mail use color when new mail arrives, default to color_good author obb, girst

3.43 insync

3.42. imap 69 py3status Documentation, Release 3.21

Display Insync status. Thanks to Iain Tatch for the script that this is based on. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘{status} {queued}’) • status_offline show when Insync is offline (default ‘OFFLINE’) • status_paused show when Insync is paused (default ‘PAUSED’) • status_share show when Insync is sharing (default ‘SHARE’) • status_synced show when Insync has finished syncing (default ‘SYNCED’) • status_syncing show when Insync is syncing (default ‘SYNCING’) Format placeholders: • {status} Insync status • {queued} Number of files queued Color options: • color_bad Offline • color_degraded Default (e.g. Paused/Syncing) • color_good Synced Requires: • insync an unofficial Google Drive client with support for various desktops author Joshua Pratt license BSD

3.44 kdeconnector

Display information about your smartphone with KDEConnector.

70 Chapter 3. Modules py3status Documentation, Release 3.21

Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 30) • device the device name, you need this if you have more than one device connected to your PC (default None) • device_id alternatively to the device name you can set your device id here (default None) • format see placeholders below (default ‘{name}{notif_status} {bat_status} {charge}%’) • format_disconnected text if device is disconnected (default ‘device disconnected’) • low_threshold percentage value when text is twitch to color_bad (default 20) • status_bat text when battery is discharged (default ‘’) • status_chr text when device is charged (default ‘’) • status_full text when battery is full (default ‘’) • status_no_notif text when you have no notifications (default ‘’) • status_notif text when notifications are available (default ‘ ’) Format placeholders: • {bat_status} battery state • {charge} the battery charge • {name} name of the device • {notif_size} number of notifications • {notif_status} shows if a notification is available or not Color options: • color_bad Device unknown, unavailable or battery below low_threshold and not charging • color_degraded Connected and battery not charging • color_good Connected and battery charging Requires: • pydbus pythonic d-bus library • kdeconnect adds communication between kde and your smartphone Examples: kdeconnector { device_id = "aa0844d33ac6ca03" format = "{name} {battery} {state}" low_battery = "10" } author Moritz Lüdecke

3.45 keyboard_layout

3.45. keyboard_layout 71 py3status Documentation, Release 3.21

Display keyboard layout. Configuration parameters: • button_next mouse button to cycle next layout (default 4) • button_prev mouse button to cycle previous layout (default 5) • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘{layout}’) • layouts specify a list of layouts to use (default None) Format placeholders: • {layout} keyboard layout Color options: • color_ colorize the layout. eg color_fr = ‘#729FCF’ Requires: • xkblayout-state or • setxkbmap and xset (works for the first two predefined layouts. overrides XkbLayout when switch- ing layout.) Examples:

# define keyboard layouts that can be switched between keyboard_layout { layouts = ['gb', 'fr', 'dvorak'] } author shadowprince, tuxitop license Eclipse Public License

3.46 keyboard_locks

Display NumLock, CapsLock, and ScrLock keys. Configuration parameters: • cache_timeout refresh interval for this module (default 1)

72 Chapter 3. Modules py3status Documentation, Release 3.21

• format display format for this module (default ‘[\?if=num_lock&color=good NUM|\?color=bad NUM] ‘ ‘[\?if=caps_lock&color=good CAPS|\?color=bad CAPS] ‘ ‘[\?if=scroll_lock&color=good SCR|\?color=bad SCR]’) Control placeholders: • {num_lock} a boolean based on xset data • {caps_lock} a boolean based on xset data • {scroll_lock} a boolean based on xset data Color options: • color_good Lock on • color_bad Lock off Examples:

# hide NUM, CAPS, SCR keyboard_locks { format = '\?color=good [\?if=num_lock NUM][\?soft ]' format += '[\?if=caps_lock CAPS][\?soft ][\?if=scroll_lock SCR]' }

author lasers

3.47 khal_calendar

Displays upcoming khal events. Configuration parameters: • cache_timeout refresh interval for this module (default 60) • config_path Path to khal configuration file. The default None resolves to /home/$USER/.config/khal/config (default None) • date_end Until which datetime the module searches for events (default ‘eod’) • format display format for this module (default ‘{appointments}’) • output_format khal conform format for displaying event output (default ‘{start-time} {title}’) Format placeholders: • {appointments} list of events in time range Requires: • khal https://github.com/pimutils/khal author @xenrox license BSD

3.47. khal_calendar 73 py3status Documentation, Release 3.21

3.48 lm_sensors

Display temperatures, voltages, fans, and more from hardware sensors. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • chips specify a list of chips to use (default []) • format display format for this module (default ‘{format_chip}’) • format_chip display format for chips (default ‘{name} {format_sensor}’) • format_chip_separator show separator if more than one (default ‘ ‘) • format_sensor display format for sensors (default ‘[\?color=darkgray {name}] [\?color=auto.input&show {input}]’) • format_sensor_separator show separator if more than one (default ‘ ‘) • sensors specify a list of sensors to use (default []) • thresholds specify color thresholds to use (default {‘auto.input’: True}) Format placeholders: • {format_chip} format for chips Format_chip placeholders: • {name} chip name, eg coretemp-isa-0000, nouveau-pci-0500 • {adapter} adapter type, eg ISA adapter, PCI adapter • {format_sensor} format for sensors Format_sensor placeholders: • {name} sensor name, eg core_0, gpu_core, temp1, fan1 See sensors -u for a full list of placeholders for format_chip, format_sensors without the prefixes, chips and sensors options. See https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface for more information on the sensor placeholders. Color options for auto.input threshold: • color_zero zero value or less (color red) • color_min minimum value (color lightgreen) • color_excl_input input value excluded from threshold (color None) • color_input input value (color lime) • color_near_max input value near maximum value (color yellow)

74 Chapter 3. Modules py3status Documentation, Release 3.21

• color_max maximum value (color orange) • color_near_crit input value near critical value (color lightcoral) • color_crit critical value (color red) Color thresholds: • format_sensor xxx: print a color based on the value of xxx placeholder auto.input: print a color based on the value of input placeholder against a customized threshold Requires: • lm_sensors a tool to read temperature/voltage/fan sensors • sensors-detect see man sensors-detect # --auto to read about using defaults or to com- pile a list of kernel modules Examples:

# identify possible chips, sensors, placeholders, etc [user@py3status ~] $ sensors -u ------# coretemp-isa-0000 # chip {name} # chip: coretemp* Adapter: ISA adapter # {adapter} type ---- # ------Core 0: # sensor {name} # sensor: core_0 temp2_input: 48.000 # {input} temp2_max: 81.000 # {max} temp2_crit: 91.000 # {crit} temp2_crit_alarm: 0.000 # {crit_alarm} Core 1: # sensor {name} # sensor: core_1 temp3_input: 48.000 # {input} temp3_max: 81.000 # {max} temp3_crit: 91.000 # {crit} temp3_crit_alarm: 0.000 # {crit_alarm} # k10temp-pci-00c3 # chip {name} # chip: k10temp* Adapter: PCI adapter # {adapter} type ---- # ------temp1: # sensor {name} # sensor: temp1 temp1_input: 30.000 # {input} temp1_max: -71.000 # {max} temp1_min: -15.000 # {min} temp1_alarm: 1.000 # {alarm} temp1_offset: 0.000 # {offset} temp1_beep: 0.000 # {beep} intrusion0: # sensor {name} # sensor: intrusion0 intrusion0_alarm: 0.000 # {alarm}

Solid lines denotes chips. Dashed lines denotes sensors. Sensor names are lowercased and its spaces replaced with underscores. The numbered prefixes, eg `temp1_*` are removed to keep names clean.

# specify chips to use lm_sensors { chips = ['coretemp-isa-0000'] # full OR chips = ['coretemp*'] # fnmatch }

(continues on next page)

3.48. lm_sensors 75 py3status Documentation, Release 3.21

(continued from previous page) # specify sensors to use lm_sensors { sensors = ['core_0', 'core_1', 'core_2', 'core_3'] # full OR sensors = ['core_*'] # fnmatch }

# show name per chip, eg CPU 35°C 36°C 37°C 39°C GPU 52°C lm_sensors { format_chip = '[\?if=name=coretemp-isa-0000 CPU ]' format_chip += '[\?if=name=nouveau-pci-0500 GPU ]' format_chip += '{format_sensor}' format_sensor = '\?color=auto.input {input}°C' sensors = ['core*', 'temp*'] }

# show name per sensor, eg CPU1 35°C CPU2 36°C CPU3 37°C CPU4 39°C GPU 52°C lm_sensors { format_chip = '{format_sensor}' format_sensor = '[\?if=name=core_0 CPU1 ]' format_sensor += '[\?if=name=core_1 CPU2 ]' format_sensor += '[\?if=name=core_2 CPU3 ]' format_sensor += '[\?if=name=core_3 CPU4 ]' format_sensor += '[\?if=name=gpu_core GPU ]' format_sensor += '[\?color=auto.input {input}°C]' sensors = ['core*', 'temp*'] } author lasers

3.49 loadavg

76 Chapter 3. Modules py3status Documentation, Release 3.21

Display average system load over a period of time. In UNIX computing, the system load is a measure of the amount of computational work that a computer system performs. The load average represents the average system load over a period of time. It conventionally appears in the form of three numbers which represent the system load during the last one-, five-, and fifteen-minute periods. Configuration parameters: • cache_timeout refresh interval for this module (default 5) • format display format for this module (default ‘Loadavg [\?color=1avg {1min}] ‘ ‘[\?color=5avg {5min}] [\?color=15avg {15min}]’) • thresholds specify color thresholds to use (default [(0, ‘#9dd7fb’), (20, ‘good’), (40, ‘degraded’), (60, ‘#ffa500’), (80, ‘bad’)]) Format placeholders: • {1min} load average during the last 1-minute, eg 1.44 • {5min} load average during the last 5-minutes, eg 1.66 • {15min} load average during the last 15-minutes, eg 1.52 • {1avg} load average percentage during the last 1-minute, eg 12.00 • {5avg} load average percentage during the last 5-minutes, eg 13.83 • {15avg} load average percentage during the last 15-minutes, eg 12.67 Color thresholds: • xxx print a color based on the value of xxx placeholder Notes: http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages http://www.brendangregg.com/ blog/2017-08-08/linux-load-averages.html Examples:

# show load averages with static colors loadavg { format = 'Loadavg [\?color=orange {1min} ][\?color=gold {5min} {15min}]' }

# remove prefix - easy copy and paste loadavg { format = '[\?color=1avg {1min}] ' format += '[\?color=5avg {5min}] ' format += '[\?color=15avg {15min}]' }

# show detailed load averages + percentages loadavg { format = 'Loadavg [\?color=darkgray ' format += '1min [\?color=1avg {1min}]\|[\?color=1avg {1avg}%] ' format += '5min [\?color=5avg {5min}]\|[\?color=5avg {5avg}%] ' format += '15min [\?color=15avg {15min}]\|[\?color=15avg {15avg}%]]' }

# show load averages with different colors + thresholds loadavg { # htop - default (0, '#9dd7fb'), # 1avg (continues on next page)

3.49. loadavg 77 py3status Documentation, Release 3.21

(continued from previous page) (0, 'cyan'), # 5avg (0, 'darkcyan'), $ 15avg

# htop - monochrome (0, '#9dd7fb'), # 1avg (0, None), # 5avg (0, None), # 15avg

# htop - black night (0, 'greenyellow'), # 1avg (0, 'limegreen'), # 5avg (0, 'limegreen'), # 15avg

# htop - mc (0, '#ffffff'), # 1avg (0, '#aaaaaa'), # 5avg (0, '#555555'), # 15avg

# three shades of blue (0, '#87cefa'), # 1avg (0, '#4bb6f8'), # 5avg (0, '#0991e5'), # 15avg

# three shades of gray (0, '#dddddd'), # 1avg (0, '#bbbbbb'), # 5avg (0, '#999999'), # 15avg

# htop - mc and three shades of gray is similar. htop - mc # have higher contrast between time periods over three shades # of gray for better readability. your mileage may vary.

thresholds = { '1avg': [ (0, 'REPLACE_ME'), (20, 'good'), (40, 'degraded'), (60, '#ffa500'), (80, 'bad') ], '5avg': [ (0, 'REPLACE_ME'), (20, 'good'), (40, 'degraded'), (60, '#ffa500'), (80, 'bad') ], '15avg': [ (0, 'REPLACE_ME'), (20, 'good'), (40, 'degraded'), (60, '#ffa500'), (80, 'bad') ], } }

# don't show load averages if 1avg is under 60% loadavg { format = '[\?if=1avg>59 Loadavg [\?color=1avg {1min}] ' format += '[\?color=5avg {5min}] [\?color=15avg {15min}]]' }

(continues on next page)

78 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) # add your snippets here loadavg { format = "..." } author lasers

3.50 mail

Display number of messages in various mailbox formats. This module supports Maildir, mbox, MH, Babyl, MMDF, and IMAP. Configuration parameters: • accounts specify a dict consisting of mailbox types and a list of dicts consisting of mailbox settings and/or paths to use (default {}) • cache_timeout refresh interval for this module (default 60) • format display format for this module (default ‘\?not_zero Mail {mail}|No Mail’) • thresholds specify color thresholds to use (default []) Format placeholders: • {mail} number of messages • {maildir} number of Maildir messages • {mbox} number of mbox messages • {mh} number of MH messages • {babyl} number of Babyl messages • {mmdf} number of MMDF messages • {imap} number of IMAP messages We can divide mailbox, eg {maildir}, into numbered placeholders based on number of mailbox ac- counts, eg {maildir_1}, and if we add name to a mailbox account, we can use {name} placeholder instead, eg {home}. Color thresholds: • xxx print a color based on the value of xxx placeholder IMAP Subscriptions: You can specify a list of filters to decide which folders to search. By default, we search only the INBOX folder (ie: ['^INBOX$']). We can use regular expressions, so if you use more than one, it would be joined by a logical operator or.

3.50. mail 79 py3status Documentation, Release 3.21

'.*' will match all folders. 'pattern' will match folders containing pattern. '^pattern' will match folders beginning with pattern. 'pattern$' will match folders ending with pattern. '^((?! [Ss][Pp][Aa][Mm]).)*$' will match all folders except for every possible case of spam folders. For more documentation, see https://docs.python.org/3/library/re.html and/or any regex builder on the web. Don’t forget to escape characters. Examples:

# add multiple accounts mail { # accounts = { # {mail} 'maildir': [ # {maildir} {'path': '~/.mutt'}, # {maildir_1} {'path': '~/Mail'}, # {maildir_2} ], # 'mbox': [ # {mbox} {'path': '~/home.mbox'}, # {mbox_1} {# {mbox_2} 'name': 'local', # <------{local} 'path': '~/mbox' # }, # {# {mbox_3} 'name': 'debian', # <------{debian} 'path': '/var/mail/$USER' # 'urgent': False, # <------disable urgent }, # ], # 'mh': [ # {mh} {'path': '~/mh_mail'}, # {mh_1} ], # 'babyl': [ # {babyl} {'path': '~/babyl_mail'}, # {babyl_1} ], # 'mmdf': [ # {mmdf} {'path': '~/mmdf_mail'}, # {mmdf_1} ]# 'imap': [ # {imap} {# {imap_1} 'name': 'home', # <------{home} 'user': 'lasers', # 'password': 'kiss_my_butt!', # 'server': 'imap.gmail.com', # # <------no filters to 'port': 993, # search folders, use # filters ['^INBOX$'] }, # {# {imap_2} 'name': 'work', # <------{work} 'user': 'tobes', # 'password': 'i_love_python', # 'server': 'imap.yahoo.com', # # <---- no port, use port 993 'urgent': False, # <---- disable urgent # for this account 'filters': ['^INBOX$'] # <---- specify a list of filters # to search folders 'log': True, # <---- print a list of folders (continues on next page)

80 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) } # to filter in the log ] } allow_urgent = False <---- disable urgent for all accounts }

# add colors, disable urgent mail { format = '[\?color=mail&show Mail] {mail}' thresholds = [(1, 'good'), (5, 'degraded'), (15, 'bad')] allow_urgent = False }

# identify the mailboxes, remove what you don't need mail { format = '[\?color=mail ' format += '[\?if=imap&color=#00ff00 IMAP ]' format += '[\?if=maildir&color=#ffff00 MAILDIR ]' format += '[\?if=mbox&color=#ff0000 MBOX ]' format += '[\?if=babyl&color=#ffa500 BABYL ]' format += '[\?if=mmdf&color=#00bfff MMDF ]' format += '[\?if=mh&color=#ee82ee MH ]' format += ']' format += '[\?not_zero&color Mail {mail}|No Mail]' }

# individual colorized mailboxes, remove what you don't need mail { format = '[\?if=imap&color=#00ff00 IMAP] {imap} ' format += '[\?if=maildir&color=#ffff00 MAILDIR] {maildir} ' format += '[\?if=mbox&color=#ff0000 MBOX] {mbox} ' format += '[\?if=babyl&color=#ffa500 BABYL] {babyl} ' format += '[\?if=mmdf&color=#00bfff MMDF] {mmdf} ' format += '[\?if=mh&color=#ee82ee MH] {mh}' allow_urgent = False } author lasers

3.51 mega_sync

Display status of MEGAcmd. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for the module (default “MEGA {format_sync}|No MEGA”) • format_sync display format for every sync (default “{syncstate}”) • format_sync_separator show separator if more than one sync (default ” “) Format placeholders:

3.51. mega_sync 81 py3status Documentation, Release 3.21

• {format_sync} Format for every sync returned by ‘mega-sync’ command. format_sync placeholders: Any column returned by ‘mega-sync’ command - in lower case! For example: id, sync- state, localpath Requires: MEGAcmd: command-line interface for MEGA author Maxim Baz (https://github.com/maximbaz) license BSD

3.52 moc

Display song currently playing in moc. MOC (music on console) is a console audio player for Linux/Unix designed to be powerful and easy to use. It consists of two parts, a server (moc) and a player/interface (mocp). It supports OGG, WAV, MP3 and other formats. Configuration parameters: • button_next mouse button to skip next track (default None) • button_pause mouse button to pause/play the playback (default 1) • button_previous mouse button to skip previous track (default None) • button_stop mouse button to stop the playback (default 3) • cache_timeout refresh interval for this module (default 5) • format display format for this module (default ‘\?if=is_started [\?if=is_stopped \[\] moc|’ ‘[\?if=is_paused \|\|][\?if=is_playing >] {title}]’) • sleep_timeout when moc is not running, this interval will be used to allow one to refresh constantly with time placeholders and/or to refresh once every minute rather than every few seconds (default 20) Control placeholders: • {is_paused} a boolean based on moc status • {is_playing} a boolean based on moc status • {is_started} a boolean based on moc status • {is_stopped} a boolean based on moc status Format placeholders: • {album} album name, eg (new output here) • {artist} artist name, eg (new output here) • {avgbitrate} audio average bitrate, eg 230kbps • {bitrate} audio bitrate, eg 230kbps • {currentsec} elapsed time in seconds, eg 32

82 Chapter 3. Modules py3status Documentation, Release 3.21

• {currenttime} elapsed time in [HH:]MM:SS, eg 00:32 • {file} file location, eg /home/user/Music. . . • {rate} audio rate, eg 44kHz • {songtitle} song title, eg (new output here) • {state} playback state, eg PLAY, PAUSE, STOP • {timeleft} time left in [HH:]MM:SS, eg 71:30 • {title} track title, eg (new output here) • {totalsec} total time in seconds, eg 4322 • {totaltime} total time in seconds, eg 72:02 Placeholders are retrieved directly from mocp --info command. The list was harvested once and should not represent a full list. Color options: • color_paused Paused, defaults to color_degraded • color_playing Playing, defaults to color_good • color_stopped Stopped, defaults to color_bad Requires: • moc a console audio player with simple ncurses interface Examples:

# see 'man mocp' for more buttons moc { on_click 9 = 'exec mocp --example' } author lasers

3.53 mpd_status

Display song currently playing in mpd. Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 2) • format template string (see below) (default ‘{state} [[[{artist}] - {title}]|[{file}]]’) • hide_on_error hide the status if an error has occurred (default False) • hide_when_paused hide the status if state is paused (default False)

3.53. mpd_status 83 py3status Documentation, Release 3.21

• hide_when_stopped hide the status if state is stopped (default True) • host mpd host (default ‘localhost’) • max_width maximum status length (default 120) • password mpd password (default None) • port mpd port (default ‘6600’) • state_pause label to display for “paused” state (default ‘[pause]’) • state_play label to display for “playing” state (default ‘[play]’) • state_stop label to display for “stopped” state (default ‘[stop]’) Format placeholders: • {state} state (paused, playing. stopped) can be defined via state_.. configuration parameters Refer to the mpc(1) manual page for the list of available placeholders to be used in the format. Placeholders should use braces {} rather than percent %% eg {artist}. Every placeholder can also be prefixed with next_ to retrieve the data for the song following the one currently playing. Color options: • color_pause Paused, default color_degraded • color_play Playing, default color_good • color_stop Stopped, default color_bad Requires: • python-mpd2 (NOT python2-mpd2) Examples:

# Show state and (artist -) title, if no title fallback to file: {state} [[[{artist} - ]{title}]|[{file}]]

# Show state, [duration], title (or file) and next song title (or file): {state} \[{time}\] [{title}|{file}] → [{next_title}|{next_file}] author shadowprince, zopieux license Eclipse Public License

3.54 mpris

Display song/video and control MPRIS compatible players. There are two ways to control the media player. Either by clicking with a mouse button in the text information or by using buttons. For former you have to define the button parameters in your config. Configuration parameters: • button_next mouse button to play the next entry (default None) • button_previous mouse button to play the previous entry (default None) • button_stop mouse button to stop the player (default None)

84 Chapter 3. Modules py3status Documentation, Release 3.21

• button_toggle mouse button to toggle between play and pause mode (default 1) • format see placeholders below • format display format for this module (default ‘[{artist} - ][{title}] {previous} {toggle} {next}’) • format_none define output if no player is running (default ‘no player running’) • icon_next specify icon for next button (default u’’) • icon_pause specify icon for pause button (default u’’) • icon_play specify icon for play button (default u’’) • icon_previous specify icon for previous button (default u’’) • icon_stop specify icon for stop button (default u’’) • player_priority priority of the players. Keep in mind that the state has a higher priority than player_priority. So when player_priority is “[mpd, bomi]” and mpd is paused and bomi is playing than bomi wins. (default []) • state_pause specify icon for pause state (default u’’) • state_play specify icon for play state (default u’’) • state_stop specify icon for stop state (default u’’) Format placeholders: • {album} album name • {artist} artiste name (first one) • {length} time duration of the song • {player} show name of the player • {state} playback status of the player • {time} played time of the song • {title} name of the song Button placeholders: • {next} play the next title • {pause} pause the player • {play} play the player • {previous} play the previous title • {stop} stop the player • {toggle} toggle between play and pause Color options: • color_control_inactive button is not clickable • color_control_active button is clickable • color_paused song is paused, defaults to color_degraded • color_playing song is playing, defaults to color_good • color_stopped song is stopped, defaults to color_bad Requires:

3.54. mpris 85 py3status Documentation, Release 3.21

• pydbus pythonic d-bus library Tested players: • bomi powerful and easy-to-use gui multimedia player based on • cantata qt5 client for the (mpd) • mpdris2 mpris2 support for mpd • vlc multi-platform mpeg, vcd/dvd, and player Examples: mpris { format = "{previous}{play}{next} {player}: {state} [[{artist} - {title}]|[{title}

˓→]]" format_none = "no player" player_priority = "[mpd, cantata, vlc, bomi, *]" } only show information from mpd and vlc, but mpd has a higher priority: mpris { player_priority = "[mpd, vlc]" } show information of all players, but mpd and vlc have the highest priority: mpris { player_priority = "[mpd, vlc, *]" } vlc has the lowest priority: mpris { player_priority = "[*, vlc]" } author Moritz Lüdecke, tobes, valdur55

3.55 net_iplist

Display list of network interfaces and IP addresses. This module supports both IPv4 and IPv6. There is the possibility to blacklist interfaces and IPs, as well as to show interfaces with no IP address. It will show an alternate text if no IP are available. Configuration parameters: • cache_timeout refresh interval for this module in seconds. (default 30) • format format of the output. (default ‘Network: {format_iface}’) • format_iface format string for the list of IPs of each interface. (default ‘{iface}:[ {ip4}][ {ip6}]’) • format_no_ip string to show if there are no IPs to display. (default ‘no connection’) • iface_blacklist list of interfaces to ignore. Accepts shell-style wildcards. (default [‘lo’]) • iface_sep string to write between interfaces. (default ‘ ‘)

86 Chapter 3. Modules py3status Documentation, Release 3.21

• ip_blacklist list of IPs to ignore. Accepts shell-style wildcards. (default []) • ip_sep string to write between IP addresses. (default ‘,’) • remove_empty do not show interfaces with no IP. (default True) Format placeholders: • {format_iface} the format_iface string. Format placeholders for format_iface: • {iface} name of the interface. • {ip4} list of IPv4 of the interface. • {ip6} list of IPv6 of the interface. Color options: • color_bad no IPs to show • color_good IPs to show Requires: • ip utility found in iproute2 package Examples: net_iplist { iface_blacklist = [] ip_blacklist = ['127.*', '::1'] } author guiniol

3.56 net_rate

Display network transfer rate. Configuration parameters: • all_interfaces ignore self.interfaces, but not self.interfaces_blacklist (default True) • cache_timeout how often we refresh this module in seconds (default 2) • devfile location of dev file under /proc (default ‘/proc/net/dev’) • format format of the module output (default ‘{interface}: {total}’) • format_no_connection when there is no data transmitted from the start of the plugin (default ‘’) • format_value format to use for values (default “[\?min_length=11 {value:.1f} {unit}]”) • hide_if_zero hide indicator if rate == 0 (default False) • interfaces comma separated list of interfaces to track (default []) • interfaces_blacklist comma separated list of interfaces to ignore (default ‘lo’) • si_units use SI units (default False)

3.56. net_rate 87 py3status Documentation, Release 3.21

• sum_values sum values of each interface instead of taking the top one (default False) • thresholds specify color thresholds to use (default [(0, ‘bad’), (1024, ‘degraded’), (1024 * 1024, ‘good’)]) • unit unit to use. If the unit contains a multiplier prefix, only this exact unit will ever be used (default “B/s”) Format placeholders: • {down} download rate • {interface} name of interface • {total} total rate • {up} upload rate format_value placeholders: • {unit} current unit • {value} numeric value Color thresholds: • {down} Change color based on the value of down • {total} Change color based on the value of total • {up} Change color based on the value of up author shadowprince license Eclipse Public License

3.57 netdata

Display network speed and bandwidth usage. Configuration parameters: • cache_timeout refresh interval for this module (default 2) • format display format for this module (default ‘{nic} [\?color=down LAN(Kb): {down}↓ {up}↑]‘ ‘[\?color=total T(Mb): {download}↓ {upload}↑ {total}]’) • nic specify a network interface to use (default None) • thresholds specify color thresholds to use (default {‘down’: [(0, ‘bad’), (30, ‘degraded’), (60, ‘good’)], ‘total’: [(0, ‘good’), (400, ‘degraded’), (700, ‘bad’)]}) Format placeholders: • {nic} network interface • {down} number of download speed • {up} number of upload speed • {download} number of download usage • {upload} number of upload usage

88 Chapter 3. Modules py3status Documentation, Release 3.21

• {total} number of total usage Color thresholds: • xxx print a color based on the value of xxx placeholder author Shahin Azad

3.58 networkmanager

Display NetworkManager fields via nmcli, a command-line tool. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • devices specify a list of devices to use (default [‘[e|w]’])* • format display format for this module (default ‘{format_device}’) • format_device format for devices (default “[\?if=general_connection {general_device}[\?soft ]” “[\?color=ap1_signal {ap1_ssid} {ap1_bars} {ap1_signal}%][\?soft ]” “[\?color=good {ip4_address1}]]”) • format_device_separator show separator if more than one (default ‘ ‘) • thresholds specify color thresholds to use (default [(0, ‘bad’), (30, ‘degraded’), (65, ‘good’)]) Format placeholders: • {format_device} format for devices Format_device placeholders: • {general_connection} eg Py3status, Wired Connection 1 • {general_device} eg wlp3s0b1, enp2s0 • {general_type} eg wifi, ethernet • {ap1_bars} signal strength in bars, eg _ • {ap1_chan} wifi channel, eg 6 • {ap1_mode} network mode, eg Adhoc or Infra • {ap1_rate} bitrate, eg 54 Mbit/s • {ap1_security} signal security, eg WPA2 • {ap1_signal} signal strength in percentage, eg 63 • {ap1_ssid} ssid name, eg Py3status • {ip4_address1} eg 192.168.1.108 • {ip6_address1} eg 0000::0000:0000:0000:0000

3.58. networkmanager 89 py3status Documentation, Release 3.21

Use nmcli --terse --fields=general,ap,ip4,ip6 device show for a full list of sup- ported NetworkManager fields to use. Not all of NetworkManager fields will be usable. See man nmcli for more information. Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • nmcli cli configuration utility for NetworkManager Examples:

# specify devices to use networkmanager { devices = ['e*'] # ethernet only devices = ['w*'] # wireless only devices = [] # ethernet, wireless, lo, etc }

author Kevin Pulo license BSD

3.59 ns_checker

Display DNS resolution success on a configured domain. This module launch a simple query on each nameservers for the specified domain. Nameservers are dynamically retrieved. The FQDN is the only one mandatory parameter. It’s also possible to add additional nameservers by appending them in nameservers list. The default resolver can be overwritten with my_resolver.nameservers parameter. Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 300) • domain domain name to check (default ‘’) • format output format string (default ‘{total_count} NS {status}’) • lifetime resolver lifetime (default 0.3) • nameservers comma separated list of reference DNS nameservers (default ‘’) • resolvers comma separated list of DNS resolvers to use (default ‘’) Format placeholders: • {nok_count} The number of failed name servers • {ok_count} The number of working name servers • {status} The overall status of the name servers (OK or NOK) • {total_count} The total number of name servers Color options:

90 Chapter 3. Modules py3status Documentation, Release 3.21

• color_bad One or more lookups have failed • color_good All lookups have succeeded Requires: • dnspython a dns toolkit for python author nawadanp

3.60 nvidia_smi

Display NVIDIA properties currently exhibiting in the NVIDIA GPUs. nvidia-smi, short for NVIDIA System Management Interface program, is a cross platform tool that supports all stan- dard NVIDIA driver-supported Linux distros. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘{format_gpu}’) • format_gpu display format for NVIDIA GPUs (default ‘{gpu_name} [\?color=temperature.gpu {tem- perature.gpu}°C] ‘ ‘[\?color=memory.used_percent {memory.used_percent}%]’) • format_gpu_separator show separator if more than one (default ‘ ‘) • memory_unit specify memory unit, eg ‘KiB’, ‘MiB’, ‘GiB’, otherwise auto (default None) • thresholds specify color thresholds to use (default [(0, ‘good’), (65, ‘degraded’), (75, ‘orange’), (85, ‘bad’)]) Format placeholders: • {format_gpu} format for NVIDIA GPUs format_gpu placeholders: • {index} Zero based index of the GPU. • {count} The number of NVIDIA GPUs in the system • {driver_version} The version of the installed NVIDIA display driver • {gpu_name} The official product name of the GPU • {gpu_uuid} Globally unique immutable identifier of the GPU • {memory.free} Total free memory • {memory.free_unit} Total free memory unit • {memory.total} Total installed GPU memory • {memory.total_unit} Total installed GPU memory unit • {memory.used} Total memory allocated by active contexts • {memory.used_percent} Total memory allocated by active contexts percentage

3.60. nvidia_smi 91 py3status Documentation, Release 3.21

• {memory.used_unit} Total memory unit • {temperature.gpu} Core GPU temperature in degrees C Use python /path/to/nvidia_smi.py --list-properties for a full list of supported NVIDIA properties to use. Not all of supported NVIDIA properties will be usable. See nvidia-smi --help-query-gpu for more information. Color thresholds: • format_gpu xxx: print a color based on the value of NVIDIA xxx property Requires: • nvidia-smi command line interface to query NVIDIA devices Examples:

# display nvidia properties nvidia_smi { format_gpu = '{gpu_name} [\?color=temperature.gpu {temperature.gpu}°C] ' format_gpu += '[\?color=memory.used_percent {memory.used} {memory.used_unit}' format_gpu += '[\?color=darkgray&show \|]{memory.used_percent:.1f}%]' }

author lasers

3.61 nvidia_temp

Display NVIDIA GPU temperature. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘GPU: {format_temp}’) • format_temp display format for temperatures (default ‘{temp}°C’) • format_temp_separator show separator if more than one (default ‘ ‘) Format placeholders: • {format_temp} format for temperatures format_temp placeholders: • {temp} temperatures Color options: • color_bad Unavailable • color_good Available Requires: • nvidia-smi NVIDIA System Management Interface program author jmdana license BSD

92 Chapter 3. Modules py3status Documentation, Release 3.21

3.62 online_status

Determine if you have an Internet Connection. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘{icon}’) • icon_off show when connection is offline (default ‘’) • icon_on show when connection is online (default ‘’) • timeout time to wait for a response, in seconds (default 2) • url specify URL to connect when checking for a connection (default ‘https://www.google.com’) Format placeholders: • {icon} connection status Color options: • color_off Connection offline, defaults to color_bad • color_on Connection online, defaults to color_good author obb

3.63 pingdom

Display response times of the configured Pingdom checks. We also verify the status of the checks and colorize if needed. Pingdom API doc : https://www.pingdom.com/features/ api/documentation/ Configuration parameters: • app_key create an APP KEY on pingdom first (default ‘’) • cache_timeout how often to refresh the check from pingdom (default 600) • checks comma separated pindgom check names to display (default ‘’) • format display format for this module (default ‘{pingdom}’) • login pingdom login (default ‘’) • max_latency maximal latency before coloring the output (default 500)

3.62. online_status 93 py3status Documentation, Release 3.21

• password pingdom password (default ‘’) • request_timeout pindgom API request timeout (default 10) Format placeholders: • {pingdom} pingdom response times Color options: • color_bad Site is down • color_degraded Latency exceeded max_latency Requires: • requests https://pypi.python.org/pypi/requests author ultrabug

3.64 player_control

Control or VLC media player. Provides an icon to control simple functions of audio/video players: • start (left click) • stop (left click) • pause (middle click) Configuration parameters: • cache_timeout how often to update in seconds (default 10) • debug enable verbose logging (bool) (default False) • format format of the output (default “{icon}”) • pause_icon (default ‘’) • play_icon (default ‘’) • stop_icon (default ‘’) • supported_players supported players (str) (comma separated list) (default ‘audacious,vlc’) • volume_tick percentage volume change on mouse wheel (int) (positive number or None to disable it) (default 1) Format placeholders: • {icon} an icon to control music/video players author Federico Ceratto , rixx license BSD

94 Chapter 3. Modules py3status Documentation, Release 3.21

3.65 pomodoro

Use Pomodoro technique to get things done easily. Button 1 starts/pauses countdown. Button 2 switch Pomodoro/Break. Button 3 resets timer. Configuration parameters: • display_bar display time in bars when True, otherwise in seconds (default False) • format define custom time format. See placeholders below (default ‘{ss}’) • format_active format to display when timer is active (default ‘Pomodoro [{format}]’) • format_break format to display during break (default ‘Break #{breakno} [{format}]’) • format_break_stopped format to display during a break that is stopped (default ‘Break #{breakno} ({format})’) • format_separator separator between minutes:seconds (default ‘:’) • format_stopped format to display when timer is stopped (default ‘Pomodoro ({format})’) • num_progress_bars number of progress bars (default 5) • pomodoros specify a number of pomodoros (intervals) (default 4) • sound_break_end break end sound (file path) (requires pyglet or pygame) (default None) • sound_pomodoro_end pomodoro end sound (file path) (requires pyglet or pygame) (default None) • sound_pomodoro_start pomodoro start sound (file path) (requires pyglet or pygame) (default None) • timer_break normal break time (seconds) (default 300) • timer_long_break long break time (seconds) (default 900) • timer_pomodoro pomodoro time (seconds) (default 1500) Format placeholders: • {bar} display time in bars • {breakno} current break number • {ss} display time in total seconds (1500) • {mm} display time in total minutes (25) • {mmss} display time in (hh-)mm-ss (25:00) Color options: • color_bad Pomodoro not running • color_degraded Pomodoro break • color_good Pomodoro active Examples:

3.65. pomodoro 95 py3status Documentation, Release 3.21

pomodoro { format = "{mmss} {bar}" } author Fandekasp (Adrien Lemaire), rixx, FedericoCeratto, schober-ch, ricci

3.66 process_status

Display status of a process on your system. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘{icon}’) • full match against the full command line (default False) • icon_off show this if a process is not running (default ‘’) • icon_on show this if a process is running (default ‘’) • process specify a process name to use (default None) Format placeholders: • {icon} process icon • {process} process name Color options: • color_bad Not running • color_good Running author obb, Moritz Lüdecke

3.67 rainbow

Add color cycling fun to your i3bar. This is the most pointless yet most exciting module you can imagine. It allows color cycling of modules. Imagine the joy of having the current time change through the colors of the rainbow. If you were completely insane you could also use it to implement the i3bar equivalent of the tag and cause yourself endless headaches and the desire to vomit. The color for the contained module(s) is changed and cycles through your chosen gradient by default this is the colors of the rainbow. This module will increase the amount of updates that py3status needs to do so should be used sparingly.

96 Chapter 3. Modules py3status Documentation, Release 3.21

Configuration parameters: • cycle_time How often we change this color in seconds (default 1) • force If True then the color will always be set. If false the color will only be changed if it has not been set by a module. (default False) • format display format for this module (default ‘{output}’) • gradient The colors we will cycle through, This is a list of hex values (default [ ‘#FF0000’, ‘#FFFF00’, ‘#00FF00’, ‘#00FFFF’, ‘#0000FF’, ‘#FF00FF’, ‘#FF0000’, ]) • multi_color If True then each module the rainbow contains will be colored differently (default True) • steps Number of steps between each color in the gradient (default 10) Format placeholders: • {output} rainbow output Examples:

# show time colorfully order += "rainbow time" rainbow time { time {} }

# blinking text black/white order += "rainbow blink_time" rainbow blink_time { gradient = [ '#FFFFFF', '#000000', ] steps = 1 time {} }

author tobes

3.68 rate_counter

Display time spent and calculate the price of your service. Configuration parameters: • cache_timeout how often to update in seconds (default 5) • config_file file path to store the time already spent and restore it the next session (default ‘~/.i3/py3status/counter-config.save’) • format output format string (default ‘Time: {days} day {hours}:{mins:02d} Cost: {total}’) • format_money output format string (default ‘{price}$’) • hour_price your price per hour (default 30) • tax tax value (1.02 = 2%) (default 1.02)

3.68. rate_counter 97 py3status Documentation, Release 3.21

Format placeholders: • {days} The number of whole days in running timer • {hours} The remaining number of whole hours in running timer • {mins} The remaining number of whole minutes in running timer • {secs} The remaining number of seconds in running timer • {subtotal} The subtotal cost (time * rate) • {tax} The tax cost, based on the subtotal cost • {total} The total cost (subtotal + tax) • {total_hours} The total number of whole hours in running timer • {total_mins} The total number of whole minutes in running timer format_money placeholders: • {price} numeric value of money Color options: • color_running Running, default color_good • color_stopped Stopped, default color_bad author Amaury Brisou

3.69 rss_aggregator

Display unread feeds in your favorite RSS aggregator. Configuration parameters: • aggregator feed aggregator used. Supported values are owncloud and ttrss. Other aggregators might be supported in future releases. Contributions are welcome. (default ‘owncloud’) • cache_timeout how often to run this check (default 60) • feed_ids list of IDs of feeds to watch, see note below (default []) • folder_ids list of IDs of folders ro watch (default []) • format format to display (default ‘Feed: {unseen}’) • password login password (default None) • server aggregator server to connect to (default ‘https://yourcloudinstance.com’) • user login user (default None) Format placeholders: • {unseen} sum of numbers of unread feed elements Color options: • color_new_items text color when there is new items (default color_good) • color_error text color when there is an error (default color_bad)

98 Chapter 3. Modules py3status Documentation, Release 3.21

Requires: • requests python module from pypi https://pypi.python.org/pypi/requests Notes: You can also decide to check only for specific feeds or folders of feeds. To use this feature, you have to first get the IDs of those feeds or folders. You can get those IDs by clicking on the desired feed or folder and watching the URL. For OwnCloud/NextCloud with News application: https://yourcloudinstance.com/index.php/apps/news/#/items/ feeds/FEED_ID https://yourcloudinstance.com/index.php/apps/news/#/items/folders/FOLDER_ID For Tiny Tiny RSS 1.6 or newer: https://yourttrssinstance.com/index.php#f=FEED_ID&c=0 https:// yourttrssinstance.com/index.php#f=FOLDER_ID&c=1 If both feeds list and folders list are left empty, all unread feed items will be counted. You may use both feeds list and folders list, but given feeds shouldn’t be included in given folders, else unread count number behavior is unpredictable. Same warning when aggregator allows subfolders: the folders list shouldn’t include a folder and one of its subfolder. author raspbeguy

3.70 rt

Display number of ongoing tickets from RT queues. Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 300) • db database to use (default ‘’) • format see placeholders below (default ‘general: {General}’) • host database host to connect to (default ‘’) • password login password (default ‘’) • threshold_critical set bad color above this threshold (default 20) • threshold_warning set degraded color above this threshold (default 10) • timeout timeout for database connection (default 5) • user login user (default ‘’) Format placeholders: • {YOUR_QUEUE_NAME} number of ongoing RT tickets (open+new+stalled) Color options: • color_bad Exceeded threshold_critical • color_degraded Exceeded threshold_warning Requires: PyMySQL: https://pypi.org/project/PyMySQL/ or MySQL-python: https://pypi.org/project/ MySQL-python/ It features thresholds to colorize the output and forces a low timeout to limit the impact of a server connectivity problem on your i3bar freshness. author ultrabug

3.70. rt 99 py3status Documentation, Release 3.21

3.71 scratchpad_async

Display number of windows and urgency hints asynchronously. Configuration parameters: • always_show always display the format (default False) • format display format for this module (default “{counter} ”) Format placeholders: • {counter} number of scratchpad windows Requires: • i3ipc (https://github.com/acrisci/i3ipc-python) author cornerman license BSD

3.72 scratchpad_counter

Display number of windows in scratchpad. Configuration parameters: • cache_timeout How often we refresh this module in seconds (default 5) • format Format of indicator (default ‘{counter} ’) • hide_when_none Hide indicator when there is no windows (default False) Format placeholders: • {counter} number of scratchpad windows author shadowprince license Eclipse Public License

3.73 screenshot

Take screenshots and upload them to a given server. Configuration parameters: • file_length generated file_name length (default 4)

100 Chapter 3. Modules py3status Documentation, Release 3.21

• format display format for this module (default ‘\?color=good [{basename}|\?show SHOT]’) • save_path Directory where to store your screenshots (default ‘~/Pictures’) • screenshot_command the command used to generate the screenshot (default ‘gnome-screenshot -f’) • upload_path the remote path where to push the screenshot (default None) • upload_server your server address (default None) • upload_user your ssh user (default None) Format placeholders: • {basename} generated basename, eg qs60.jpg Examples:

# push screenshots to a server screenshot { save_path = "~/Pictures/" upload_user = "erol" upload_server = "puzzledge.org" upload_path = "/files"

# scp $HOME/Pictures/$UUID.jpg [email protected]:/files }

author Amaury Brisou

3.74 scroll

Scroll modules. Configuration parameters: • cache_timeout refresh interval for this module (default 1) • length specify a length of characters to scroll (default 25) Format placeholders: • {output} output author farnoy

3.75 selinux

Display SELinux state.

3.74. scroll 101 py3status Documentation, Release 3.21

This module displays the state of SELinux on your machine: Enforcing (good), Permissive (degraded), or Dis- abled (bad). Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘SELinux: {state}’) • state_disabled show when no SELinux policy is loaded. (default ‘disabled’) • state_enforcing show when SELinux security policy is enforced. (default ‘enforcing’) • state_permissive show when SELinux prints warnings instead of enforcing. (default ‘permissive’) Format placeholders: • {state} SELinux state Color options: • color_bad Enforcing • color_degraded Permissive • color_good Disabled Requires: • libselinux-python SELinux python bindings for libselinux author bstinsonmhk license BSD

3.76 spaceapi

Display status of a given hackerspace. Configuration parameters: • button_url mouse button to open URL sent in space’s API (default 3) • cache_timeout refresh interval for this module (default 60) • format display format for this module (default ‘{state}[ {lastchanged}]’) • format_lastchanged display format for time (default ‘since %H:%M’) • state_closed show when hackerspace is closed (default ‘closed’) • state_open show when hackerspace is open (default ‘open’) • url specify JSON URL of a hackerspace to retrieve from (default ‘https://status.chaospott.de/status.json’) Format placeholders: • {state} Hackerspace state • {lastchanged} Time

102 Chapter 3. Modules py3status Documentation, Release 3.21

format_lastchanged conversion: ‘%’ Strftime characters to be translated Color options: • color_closed Space closed, defaults to color_bad • color_open Space open, defaults to color_good author timmszigat license WTFPL

3.77 speedtest

Perform a bandwidth test with speedtest-cli. Configuration parameters: • button_share mouse button to share an URL (default None) • format display format for this module (default “speedtest[\?if=elapsed&color=elapsed_time ” “{elapsed_time}s][ [\?color=download ↓{download}Mbps] ” “[\?color=upload ↑{upload}Mbps]]”) • thresholds specify color thresholds to use (default {“upload”: [(0, “violet”)], “ping”: [(0, “#fff381”)], “download”: [(0, “cyan”)], “elapsed_time”: [(0, “#1cbfff”)]}) Control placeholders: • {elapsed} elapsed time state, eg False, True Format placeholders: • {bytes_sent} bytes sent during test (in MB), eg 52.45 • {bytes_received} bytes received during test (in MB), eg 70.23 • {client_country} client country code, eg FR • {client_ip} client ip, eg 78.194.13.7 • {client_isp} client isp, eg Free SAS • {client_ispdlavg} client isp download average, eg 0 • {client_isprating} client isp rating, eg 3.7 • {client_ispulavg} client isp upload average, eg 0 • {client_lat} client latitude, eg 48.8534 • {client_loggedin} client logged in, eg 0 • {client_lon} client longitude, eg 2.3487999999999998 • {client_rating} client rating, eg 0 • {download} download speed (in MB), eg 20.23

3.77. speedtest 103 py3status Documentation, Release 3.21

• {elapsed_time} elapsed time since speedtest start • {ping} ping time in ms to speedtest server • {server_cc} server country code, eg FR • {server_country} server country, eg France • {server_d} server distance, eg 2.316599376968091 • {server_host} server host, eg speedtest.telecom-paristech.fr:8080 • {server_id} server id, eg 11977 • {share} share, eg share url • {timestamp} timestamp, eg 2018-08-30T16:27:25.318212Z • {server_lat} server latitude, eg 48.8742 • {server_latency} server latency, eg 8.265 • {server_lon} server longitude, eg 2.3470 • {server_name} server name, eg Paris • {server_sponsor} server sponsor, eg Télécom ParisTech • {server_url} server url, eg http://speedtest.telecom-paristech... • {upload} upload speed (in MB), eg 20.23 Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • speedtest-cli Command line interface for testing Internet bandwidth Examples:

# show detailed elapsed_time|download/upload speedtest { format = "speedtest[\?soft ][\?if=elapsed [\?color=darkgray [time " format += "[\?color=elapsed_time {elapsed_time} s]]]|[\?color=darkgray " # format += "ping [\?color=ping {ping} ms] " format += "download [\?color=download {download}Mbps] " format += "upload [\?color=upload {upload}Mbps]]]" }

# show everything speedtest { format = "speedtest[\?soft ][\?color=darkgray " format += "[time [\?color=elapsed_time {elapsed_time} s]][\?soft ]" format += "[ping [\?color=ping {ping} ms] " format += "download [\?color=download {download}Mbps] " format += "upload [\?color=upload {upload}Mbps]]]" }

# minimal speedtest { format = "speedtest[\?soft ][\?if=elapsed " format += "[\?color=elapsed_time {elapsed_time}]|" # format += "[\?color=ping {ping}] " (continues on next page)

104 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) format += "[[\?color=download {download}] [\?color=upload {upload}]]]" }

# don't hide data on reset speedtest { format = "speedtest[\?soft ][\?color=darkgray time " format += "[\?color=elapsed_time {elapsed_time} s] " # format += "ping [\?color=ping {ping} ms] " format += "download [\?color=download {download}Mbps] " format += "upload [\?color=upload {upload}Mbps]]" }

# don't hide data on reset, minimal speedtest { format = "speedtest[\?soft ][[\?color=elapsed_time {elapsed_time}] " # format += "[\?color=ping {ping}] " format += "[\?color=download {download}] [\?color=upload {upload}]]" } author Cyril Levis (@cyrinux)

3.78 spotify

Display song currently playing in Spotify. Configuration parameters: • button_next button to switch to next song (default None) • button_play_pause button to toggle play/pause (default None) • button_previous button to switch to previous song (default None) • cache_timeout how often to update the bar (default 5) • format see placeholders below (default ‘{artist} : {title}’) • format_down define output if spotify is not running (default ‘Spotify not running’) • format_stopped define output if spotify is not playing (default ‘Spotify stopped’) • sanitize_titles whether to remove meta data from album/track title (default True) • sanitize_words which meta data to remove (default [‘bonus’, ‘demo’, ‘edit’, ‘explicit’, ‘extended’, ‘feat’, ‘mono’, ‘remaster’, ‘stereo’, ‘version’]) Format placeholders: • {album} album name • {artist} artiste name (first one)

3.78. spotify 105 py3status Documentation, Release 3.21

• {playback} state of the playback: Playing, Paused • {time} time duration of the song • {title} name of the song Color options: • color_offline Spotify is not running, defaults to color_bad • color_paused Song is stopped or paused, defaults to color_degraded • color_playing Song is playing, defaults to color_good Requires: • spotify a proprietary music streaming service Examples: spotify { button_next = 4 button_play_pause = 1 button_previous = 5 format = "{title} by {artist} -> {time}" format_down = "no Spotify" } author Pierre Guilbert, Jimmy Garpehäll, sondrele, Andrwe

3.79 sql

Display data stored in MariaDB, MySQL, sqlite3, and hopefully more. Configuration parameters: • cache_timeout refresh cache_timeout for this module (default 10) • database specify database name to import (default None) • format display format for this module (default ‘{format_row}’) • format_row display format for SQL rows (default None) • format_separator show separator if more than one (default ‘ ‘) • parameters specify connection parameters to use (default None) • query specify command to query a database (default None) • thresholds specify color thresholds to use (default []) Format placeholders: • {row} number of SQL rows • {format_row} format for SQL rows Parameters can be placeholders too, eg {host}, {passd} Format_row placeholders: • {field} placeholders will have the value returned by the query for the field

106 Chapter 3. Modules py3status Documentation, Release 3.21

Color thresholds: • format row: print a color based on the number of SQL rows • format_row field: print a color based on the value of field placeholder Requires: • mariadb fast sql database server, drop-in replacement for mysql • mysql-python mysql support for python • sqlite a c library that implements an sql database engine Examples:

# specify database name to import sql { database = 'sqlite3' # from sqlite3 import connect database = 'MySQLdb' # from MySQLdb import connect database = '...' # from ... import connect }

# specify connection parameters to use http://mysql-python.sourceforge.net/MySQLdb.html#functions-and-attributes https://docs.python.org/3/library/sqlite3.html#module-functions-and-constants sql { name = 'MySQLdb' format = '{host} {passd} ...' parameters = { 'host': 'host', 'passwd': 'password', '...': '...', } }

# specify command to query a database sql { query = 'SHOW SLAVE STATUS' query = 'SELECT * FROM cal_todos' query = '...' }

# display number of seconds behind master with MySQLdb sql { database = 'MySQLdb' format_row = '\?color=seconds_behind_master {host} is ' format_row += '[{seconds_behind_master}s behind|\?show master]' parameters = { 'host': 'localhost', 'passwd': '********' } query = 'SHOW SLAVE STATUS' thresholds = [ (0, 'deepskyblue'), (100, 'good'), (300, 'degraded'), (600, 'bad') ] }

# display thunderbird tasks with sqlite3 sql { database = 'sqlite3' (continues on next page)

3.79. sql 107 py3status Documentation, Release 3.21

(continued from previous page) format_row = '{title}' format_separator = ', ' query = 'SELECT * FROM cal_todos' parameters = '~/.thunderbird/user.default/calendar-data/local.sqlite' } author cereal2nd license BSD

3.80 static_string

Display static text. Configuration parameters: • format display format for this module (default ‘Hello, world!’) author frimdo [email protected]

3.81 sysdata

Display system RAM, SWAP and CPU utilization. Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 10) • cpu_freq_unit the unit of CPU frequency to use in report, case insensitive. [‘kHz’, ‘MHz’, ‘GHz’] (default ‘GHz’) • cpus specify a list of CPUs to use (default [‘cpu?’])* • format output format string (default ‘[\?color=cpu_used_percent CPU: {cpu_used_percent}%], ‘ ‘[\?color=mem_used_percent Mem: {mem_used}/{mem_total} ‘ ‘{mem_total_unit} ({mem_used_percent}%)]’) • format_cpu display format for CPUs (default ‘\?color=used_percent {used_percent}%’) • format_cpu_separator show separator if more than one (default ‘ ‘) • mem_unit the unit of memory to use in report, case insensitive. [‘dynamic’, ‘KiB’, ‘MiB’, ‘GiB’] (default ‘GiB’) • swap_unit the unit of swap to use in report, case insensitive. [‘dynamic’, ‘KiB’, ‘MiB’, ‘GiB’] (default ‘GiB’) • temp_unit unit used for measuring the temperature (‘C’, ‘F’ or ‘K’) (default ‘°C’) • thresholds specify color thresholds to use (default [(0, “good”), (40, “degraded”), (75, “bad”)])

108 Chapter 3. Modules py3status Documentation, Release 3.21

• zone Either a path in sysfs to CPU temperature sensor, or an lm_sensors thermal zone to use. If None try to guess CPU temperature (default None) Format placeholders: • {cpu_freq_avg} average CPU frequency across all cores • {cpu_freq_max} highest CPU clock frequency • {cpu_freq_unit} unit for frequency • {cpu_temp} cpu temperature • {cpu_used_percent} cpu used percentage • {format_cpu} format for CPUs • {load1} load average over the last minute • {load5} load average over the five minutes • {load15} load average over the fifteen minutes • {mem_total} total memory • {mem_total_unit} memory total unit, eg GiB • {mem_used} used memory • {mem_used_unit} memory used unit, eg GiB • {mem_used_percent} used memory percentage • {swap_total} total swap • {swap_total_unit} swap total memory unit, eg GiB • {swap_used} used swap • {swap_used_unit} swap used memory unit, eg GiB • {swap_used_percent} used swap percentage • {temp_unit} temperature unit format_cpu placeholders: • {name} cpu name, eg cpu, cpu0, cpu1, cpu2, cpu3 • {used_percent} cpu used percentage, eg 88.99 Color thresholds: • xxx print a color based on the value of xxx placeholder Examples:

# specify a list of cpus to use. see "grep cpu /proc/stat" sysdata { cpus = [] # avg + all CPUs cpus = ['cpu'] # avg # same as {cpu_used_percent} cpus = ['cpu0', 'cpu2'] # selective CPUs # full cpus = ['cpu?*'] # all CPUs # fnmatch (default) }

# display per cpu percents sysdata { format = "{format_cpu}" (continues on next page)

3.81. sysdata 109 py3status Documentation, Release 3.21

(continued from previous page) format_cpu = "{name} [\?color=used_percent {used_percent}%]" }

# customize per cpu padding, precision, etc sysdata { format = "CPU {format_cpu}" format_cpu = "[\?min_length=4 [\?color=used_percent {used_percent:.0f}%]]" }

# display per cpu histogram sysdata { format = "CPU Histogram [\?color=cpu_used_percent {format_cpu}]" format_cpu = "[\?if=used_percent>80 |[\?if=used_percent>60 " format_cpu += "|[\?if=used_percent>40 |[\?if=used_percent>20 " format_cpu += "|]]]]" format_cpu_separator = "" thresholds = [(0, "good"), (60, "degraded"), (80, "bad")] cache_timeout = 1 } author Shahin Azad , shrimpza, guiniol, JackDoan , farnoy

3.82 systemd

Display status of a service on your system. Configuration parameters: • cache_timeout refresh interval for this module (default 5) • format display format for this module (default ‘\?if=!hide {unit}: {status}’) • hide_extension suppress extension of the systemd unit (default False) • hide_if_default suppress the output if the systemd unit is in default state ‘off’ the output is never suppressed ‘on’ the output is suppressed if the unit is (enabled and active) or (disabled and inactive) ‘active’ the output is suppressed if the unit is active ‘inactive’ the output is suppressed if the unit is inactive (default ‘off’) • unit specify the systemd unit to use (default ‘dbus.service’) • user specify if this is a user service (default False) Format placeholders: • {unit} unit name, eg sshd.service • {status} unit status, eg active, inactive, not-found Color options:

110 Chapter 3. Modules py3status Documentation, Release 3.21

• color_good unit active • color_bad unit inactive • color_degraded unit not-found Requires: • pydbus pythonic dbus library Examples:

# show the status of vpn service # left click to start, right click to stop systemd vpn { unit = 'vpn.service' on_click 1 = 'exec sudo systemctl start vpn' on_click 3 = 'exec sudo systemctl stop vpn' } author Adrian Lopez license BSD

3.83 taskwarrior

Display tasks currently running in taskwarrior. Configuration parameters: • cache_timeout refresh interval for this module (default 5) • filter specify one or more criteria to use (default ‘status:pending’) • format display format for this module (default ‘{descriptions}’) Format placeholders: • {descriptions} descriptions of active tasks • {tasks} number of active tasks Requires task: https://taskwarrior.org/download/ author James Smith https://jazmit.github.io license BSD

3.84 thunderbird_todos

Display number of todos and more for Thunderbird. Configuration parameters: • cache_timeout refresh interval for this module (default 60)

3.83. taskwarrior 111 py3status Documentation, Release 3.21

• format display format for this module (default ‘{format_todo}’) • format_datetime specify strftime formatting to use (default {}) • format_separator show separator if more than one (default ‘ ‘) • format_todo display format for todos (default ‘\?if=!todo_completed {title}’) • profile specify a profile path, otherwise first available profile eg ‘~/.thunderbird/abcd1234.default’ (default None) • sort specify a tuple, eg (‘placeholder_name’, reverse_boolean) to sort by; excluding placeholder indexes (default ()) • thresholds specify color thresholds to use (default []) Format placeholders: • {todo_total} eg 5 • {todo_completed} eg 2 • {todo_incompleted} eg 3 • {format_todo} format for todos format_todo placeholders: • {index_total} eg 1, 2, 3 • {index_completed} eg 1, 2, 3 • {index_incompleted} eg 1, 2, 3 • {alarm_last_ack} eg None, 1513291952000000 • {cal_id} eg 966bd855-5e71-4168-8072-c98f244ed825 • {flags} eg 4, 276 • {ical_status} eg None, IN-PROCESS, COMPLETED • {id} eg 87e9bfc9-eaad-4aa6-ad5f-adbf6d7a11a5 • {last_modified} eg 1513276147000000 • {offline_journal} eg None • {priority} eg None, # None=None, 0=None, 1=High, 5=Normal, 9=Low • {privacy} eg None, CONFIDENTIAL • {recurrence_id} eg None • {recurrence_id_tz} eg None, UTC • {time_created} eg 1513276147000000 • {title} eg New Task • {todo_complete} eg None • {todo_completed} eg None, 1513281528000000 • {todo_completed_tz} eg None, UTC • {todo_due} eg None, 1513292400000000 • {todo_due_tz} eg None, America/Chicago • {todo_entry} eg None, 1513292400000000

112 Chapter 3. Modules py3status Documentation, Release 3.21

• {todo_entry_tz} eg None, America/Chicago • {todo_stamp} eg 1513276147000000 format_datetime placeholders: KEY: alarm_last_ack, last_modified, time_created, todo, todo_completed, todo_entry, todo_stamp VALUE: % strftime characters to be translated, eg ‘%b %d’ —-> ‘Dec 14’ SEE EX- AMPLE BELOW: “show incompleted titles with last modified time” Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • thunderbird standalone mail and news reader Examples:

# show number of incompleted titles thunderbird_todos { format = '{todo_incompleted} incompleted todos' }

# show rainbow number of incompleted titles thunderbird_todos { format = '\?color=todo_incompleted {todo_incompleted} todos' thresholds = [ (1, '#bababa'), (2, '#ffb3ba'), (3, '#ffdfba'), (4, '#ffffba'), (5, '#baefba'), (6, '#baffc9'), (7, '#bae1ff'), (8, '#bab3ff') ] }

# show rainbow incompleted titles thunderbird_todos { format_todo = '\?if=!todo_completed&color=index_incompleted {title}' thresholds = [ (1, '#bababa'), (2, '#ffb3ba'), (3, '#ffdfba'), (4, '#ffffba'), (5, '#baefba'), (6, '#baffc9'), (7, '#bae1ff'), (8, '#bab3ff') ] }

# show incompleted titles with last modified time thunderbird_todos { format_todo = '\?if=!todo_completed {title} {last_modified}' format_datetime = { 'last_modified': '\?color=degraded last modified %-I:%M%P' } }

# show 'No todos' thunderbird_todos { format = '{format_todo}|No todos' }

# show completed titles and incompleted titles thunderbird_todos { format_todo = '\?if=todo_completed&color=good {title}|\?color=bad {title}' }

# make todo blocks (continues on next page)

3.84. thunderbird_todos 113 py3status Documentation, Release 3.21

(continued from previous page) thunderbird_todos { format = 'TODO {format_todo}' format_todo = '\?if=todo_completed&color=good |\?color=bad ' format_separator = '' }

# display incompleted titles with any priority thunderbird_todos { format_todo = '\?if=!todo_completed [\?if=priority>0 {title}]' }

# colorize titles based on priorities thunderbird_todos { format_todo = '\?if=!todo_completed [\?color=priority {title}]' thresholds = [(0, None), (1, 'red'), (5, None), (9, 'deepskyblue')] }

# sort todos thunderbird_todos { sort = ('last_modified', True) # sort by modified time: recent first sort = ('priority', True) # sort by priority: high to low sort = ('title', False) # sort by title: ABC to abc }

# add your snippets here thunderbird_todos { format = '...' } author mrt-prodz, lasers

3.85 timer

A simple countdown timer. This is a very basic countdown timer. You can change the timer length as well as pausing, restarting and resetting it. Currently this is more of a demo of a composite. Each part of the timer can be changed independently hours, minutes, seconds using mouse buttons 4 and 5 (scroll wheel). Button 1 starts/pauses the countdown. Button 2 resets timer. Configuration parameters: • format display format for this module (default ‘Timer {timer}’) • sound play sound file path when the timer ends (default None) • time number of seconds to start countdown with (default 60)

114 Chapter 3. Modules py3status Documentation, Release 3.21

Format placeholders: • {timer} display hours:minutes:seconds author tobes

3.86 timewarrior

Track your time with Timewarrior. Timewarrior is a time tracking utility that offers simple stopwatch features as well as sophisticated calendar-base backfill, along with flexible reporting. See https://taskwarrior.org/docs/timewarrior for more information. Configuration parameters: • cache_timeout refresh interval for this module, otherwise auto (default None) • filter specify interval and/or tag to filter (default ‘1day’) • format display format for this module (default ‘[Timew {format_time}]|No Timew’) • format_datetime specify strftime characters to format (default {}) • format_duration display format for time duration (default ‘\?not_zero [{days}d ][{hours}:]{minutes}:{seconds}’) • format_tag display format for tags (default ‘\?color=state_tag {name}’) • format_tag_separator show separator if more than one (default ‘ ‘) • format_time display format for tracked times (default ‘[\?color=state_time [{format_tag} ]{for- mat_duration}]’) • format_time_separator show separator if more than one (default ‘ ‘) • thresholds specify color thresholds to use (default {‘state_tag’: [(0, ‘darkgray’), (1, ‘darkgray’)], ‘state_time’: [(0, ‘darkgray’), (1, ‘degraded’)]}) Format placeholders: • {format_time} format for tracked times • {tracking} time tracking state, eg False, True format_time placeholders: • {state} time tracking state, eg False, True • {format_tag} format for tags • {format_duration} format for time duration • {start} start date, eg 20171021T010203Z • {end} end date, eg 20171021T010203Z format_tag placeholders:

3.86. timewarrior 115 py3status Documentation, Release 3.21

• {name} tag name, eg gaming, studying, gardening format_datetime placeholders: • key start, end • value strftime characters, eg ‘%b %d’ —-> ‘Oct 06’ format_duration placeholders: • {days} days • {hours} hours • {minutes} minutes • {seconds} seconds Color thresholds: • format_time state_time: print color based on the state of time tracking • format_tag state_tag: print color based on the state of time tracking Requires: • timew feature-rich time tracking utility Recommendations: We can refresh a module using py3-cmd command. An excellent example of using this com- mand in a function.

~/.{bash,zsh}{rc,_profile} ------function timew () { command timew "$@" && py3-cmd refresh timewarrior }

With this, you can consider giving cache_timeout a much larger number, eg 3600 (an hour), so the module does not need to be updated that often. Examples:

# show times matching the filter, see documentation for more filters timewarrior { filter = ':day' # filter times not in 24 hours of current day filter = '12hours' # filter times not in 12 hours of current time filter = '5min' # filter times not in 5 minutes of current time filter = '1sec' # filter times not in 1 second of current time filter = '5pm to 11:59pm # filter times not in 5pm to 11:59pm range }

# intervals timewarrior { # if you are printing other intervals too with '1day' filter or so, # then you may want to add this too for better bar readability format_time_separator = ', '

# you also can change the thresholds with different colors thresholds = { 'state_tag': [(0, 'darkgray'), (1, 'degraded')], 'state_time': [(0, 'darkgray'), (1, 'degraded')], } } (continues on next page)

116 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page)

# cache_timeout timewarrior { # auto refresh every 10 seconds when there is no active time tracking # auto refresh every second when there is active time tracking cache_timeout = None

# refresh every minute when there is no active time tracking # refresh every second when there is active time tracking cache_timeout = 60

# explicit refresh every 20 seconds when there is no active time tracking # explicit refresh every 5 seconds when there is active time tracking cache_timeout = (20, 5) }

# add your snippets here timewarrior { format = "..." } author lasers

3.87 tor_rate

Display transfer rates of a tor instance. Configuration parameters: • cache_timeout An integer specifying the cache life-time of the modules output in seconds (default 2) • control_address The address on which the Tor daemon listens for control connections (default “127.0.0.1”) • control_password The password to use for the Tor control connection (default None) • control_port The port on which the Tor daemon listens for control connections (default 9051) • format A string describing the output format for the module (default “↑ {up} ↓ {down}”) • format_value A string describing how to format the transfer rates (default “[\?min_length=12 {rate:.1f} {unit}]”) • hide_socket_errors Hide errors connecting to Tor control socket (default False) • rate_unit The unit to use for the transfer rates (default “B/s”) • si_units A boolean value selecting whether or not to use SI units (default False) Format placeholders: • {down} The incoming transfer rate • {up} The outgoing transfer rate format_value placeholders:

3.87. tor_rate 117 py3status Documentation, Release 3.21

• {rate} The current transfer-rate’s value • {unit} The current transfer-rate’s unit Requires: • stem python controller library for tor https://pypi.org/project/stem Examples: tor_rate { cache_timeout = 10 format = "IN: {down} | OUT: {up}" control_port = 1337 control_password = "TertiaryAdjunctOfUnimatrix01" si_units = True } author Felix Morgner license 3-clause-BSD

3.88 transmission

Display number of torrents and more. Configuration parameters: • arguments additional arguments for the transmission-remote (default None) • button_next mouse button to switch next torrent (default None) • button_previous mouse button to switch previous torrent (default None) • button_run mouse button to run the command on current torrent (default [(1, ‘–start’), (2, ‘–verify’), (3, ‘–stop’)]) • cache_timeout refresh interval for this module (default 20) • format display format for this module (default ‘{format_torrent}’) • format_separator show separator if more than one (default ‘ ‘) • format_torrent display format for torrents (default ‘[\?if=is_focused&color=bad X] {status} {id} {name} {done}%’) • thresholds specify color thresholds to use (default []) Format placeholders: • {torrent} number of torrents

118 Chapter 3. Modules py3status Documentation, Release 3.21

• {format_torrent} format for torrents • {up} summary up traffic • {down} summary down traffic • {have} summary download format_torrent placeholders: • {index} torrent index, eg 1 • {id} torrent id, eg 2 • {done} torrent percent, eg 100% • {have} torrent download, 253 KB • {eta} torrent estimated time, eg Done, 1 min, etc • {up} torrent up traffic • {down} torrent down traffic • {ratio} torrent seed ratio • {status} torrent status, eg Idle, Downloading, Stopped, Verifying, etc • {name} torrent name, eg py3status-3.8.tar.gz Color options: • color_bad current torrent Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • transmission-cli fast, easy, and free bittorrent client (cli tools, daemon, web client) Examples:

# add arguments transmission { # We use 'transmission-remote --list' # See `transmission-remote --help' for more information. # Not all of the arguments will work here. arguments = '--auth username:password --port 9091' } # see 'man transmission-remote' for more buttons transmission { button_run = [ (1, '--start'), (2, '--verify'), (3, '--stop'), (8, '--remove'), (9, '--exit'), ] }

# open web-based transmission client transmission { on_click 1 = 'exec xdg-open http://username:password@localhost:9091' } (continues on next page)

3.88. transmission 119 py3status Documentation, Release 3.21

(continued from previous page)

# add buttons transmission { button_next = 5 button_previous = 4 }

# see 'man transmission-remote' for more buttons transmission { # specify a script to run when a torrent finishes on_click 9 = 'exec transmission-remote --torrent-done-script ~/file'

# use the alternate limits? on_click 9 = 'exec transmission-remote --alt-speed' on_click 10 = 'exec transmission-remote --no-alt-speed' }

# show summary statistcs - up, down, have transmission { format = '{format_torrent}' format += '[\?color=#ffccff [\?not_zero Up:{up}]' format += '[\?not_zero Down:{down}][\?not_zero Have:{have}]]' }

# add a format that sucks less than the default plain format transmission { format_torrent = '[\?if=is_focused&color=bad X ]' format_torrent += '[[\?if=status=Idle&color=degraded {status}]' format_torrent += '|[\?if=status=Stopped&color=bad {status}]' format_torrent += '|[\?if=status=Downloading&color=good {status}]' format_torrent += '|[\?if=status=Verifying&color=good {status}]' format_torrent += '|\?color=degraded {status}]' format_torrent += ' {name} [\?color=done {done}]' }

# show percent thresholds transmission { format_torrent = '{name} [\?color=done {done}]' thresholds = [(0, 'bad'), (1, 'degraded'), (100, 'good')] }

# download the rainbow transmission { format_torrent = '[\?if=is_focused&color=bad X ]' format_torrent += '{status} [\?color=index {name}] [\?color=done {done}%]' thresholds = { 'done': [(0, '#ffb3ba'), (1, '#ffffba'), (100, '#baefba')], 'index': [ (1, '#ffb3ba'), (2, '#ffdfba'), (3, '#ffffba'), (4, '#baefba'), (5, '#baffc9'), (6, '#bae1ff'), (7, '#bab3ff') ] } } author lasers

120 Chapter 3. Modules py3status Documentation, Release 3.21

3.89 twitch

Display if a Twitch channel is currently streaming or not. Configuration parameters: • cache_timeout how often we refresh this module in seconds (default 60) • client_id Your client id. Create your own key at https://dev.twitch.tv (default None) • format Display format when online (default “{display_name} is live!”) • format_offline Display format when offline (default “{display_name} is offline.”) • stream_name name of streamer(twitch.tv/) (default None) Format placeholders: • {display_name} streamer display name, eg Ultrabug Color options: • color_bad Stream offline • color_good Stream is live Client ID: Example settings when creating your app at https://dev.twitch.tv Name: _py3status OAuth Redirect URI: https://localhost Application Category: Application In- tegration author Alex Caswell [email protected] license BSD

3.90 uname

Display system information. Configuration parameters: • format display format for this module (default ‘{system} {release}’) Format placeholders: • {system} system/OS name, e.g. ‘Linux’, ‘Windows’, or ‘Java’ • {node} computer’s network name (may not be fully qualified!) • {release} system’s release, e.g. ‘2.2.0’ or ‘NT’ • {version} system’s release version, e.g. ‘#3 on degas’ • {machine} machine type, e.g. ‘x86_64’ • {processor} the (real) processor name, e.g. ‘amdk6’

3.89. twitch 121 py3status Documentation, Release 3.21 author ultrabug (inspired by ndalliard)

3.91 uptime

Display system uptime. Configuration parameters: • format display format for this module (default ‘up {days} days {hours} hours {minutes} minutes’) Format placeholders: • {decades} decades • {years} years • {weeks} weeks • {days} days • {hours} hours • {minutes} minutes • {seconds} seconds If you don’t use a placeholder, its value will be carried over to the next placeholder. For example, an uptime of 1 hour 30 minutes will give you 90 if {minutes} or 1:30 if {hours}:{minutes}. You also can specify strftime characters to print system up since with or without placeholders. See man strftime for more information. Examples:

# show uptime without zeroes uptime { format = 'up [\?if=weeks {weeks} weeks ][\?if=days {days} days ] [\?if=hours {hours} hours ][\?if=minutes {minutes} minutes ]' }

# show uptime in multiple formats using group module group uptime { format = "up {output}" uptime { format = '[\?if=weeks {weeks} weeks ][\?if=days {days} days ] [\?if=hours {hours} hours ][\?if=minutes {minutes} minutes]' } uptime { format = '[\?if=weeks {weeks}w ][\?if=days {days}d ] [\?if=hours {hours}h ][\?if=minutes {minutes}m]' } uptime { format = '[\?if=days {days}, ][\?if=hours {hours}:] [\?if=minutes {minutes:02d}]' } }

(continues on next page)

122 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) # specify strftime characters to display system up since uptime { format = "{days}d {hours}:{minutes:02d}:{seconds:02d}" format += ", up since %Y-%m-%d %H:%M:%S" }

author Alexis “Horgix” Chotard , Volkov “BabyWolf” Semjon license BSD

3.92 usbguard

Allow or Reject newly plugged USB devices using USBGuard. Configuration parameters: • format display format for this module (default ‘{format_device}’) • format_button_allow display format for allow button filter (default ‘\[Allow\]’) • format_button_reject display format for reject button filter (default ‘\[Reject\]’) • format_device display format for USB devices (default ‘{format_button_reject} [{name}|{usb_id}] {format_button_allow}’) • format_device_separator show separator if more than one (default ‘ ‘) Format placeholders: • {device} number of USB devices • {format_device} format for USB devices format_device: • {format_button_allow} button to allow the device • {format_button_reject} button to reject the device • {id} eg 1, 2, 5, 6, 7, 22, 23, 33 • {policy} eg allow, block, reject • {usb_id} eg 054c:0268 • {name} eg Poker II, PLAYSTATION(R)3 Controller • {serial} eg 0000:00:00.0 • {port} eg usb1, usb2, usb3, 1-1, 4-1.2.1 • {interface} eg 00:00:00:00 00:00:00 00:00:00 • {hash} eg ihYz60+8pxZBi/cm+Q/4Ibrsyyzq/iZ9xtMDAh53sng • {parent_hash} eg npSDT1xuEIOSLNt2RT2EbFrE8XRZoV29t1n7kg6GxXg Requires: • python-gobject Python Bindings for GLib/GObject/GIO/GTK+

3.92. usbguard 123 py3status Documentation, Release 3.21

• usbguard USB device authorization policy framework author @cyrinux, @maximbaz license BSD

3.93 velib_metropole

Display information about Velib Métropole stations. Vélib’ Métropole, https://en.wikipedia.org/wiki/Vélib’_Métropole, is a large- scale public bicycle sharing system in Paris, France and surrounding cities. Configuration parameters: • button_next mouse button to display next station (default 4) • button_previous mouse button to display previous station (default 5) • cache_timeout refresh interval for this module (default 60) • format display format for this module (default ‘{format_station}|No Velib’) • format_station display format for stations (default “{name} [\?if=state=Closed&color=state {state} ]” “[\?color=greenyellow {bike}/{free_dock} ]” “[\?color=deepskyblue {ebike}/{free_edock}]”) • stations specify a list of station codes to use, find your station code at https://www.velib-metropole.fr/ map (default [20043, 11014, 20012, 20014, 10042]) • thresholds specify color thresholds to use (default [(“Operative”, “good”), (“Closed”, “bad”)]) Format placeholders: • {format_station} format for stations • {station} total number of stations, eg 12 format_station placeholders: • {index} index number, eg 1 • {bike} number of available bike, eg 3 • {bike_overflow} number of bike in overflow, eg 0 • {code} code, eg 10042 • {credit_card} credit card, eg no, yes • {density_level} density level, eg 1 • {dock} number of dock, eg 0 • {due_date} due date, eg 1527717600 • {ebike} number of electric bike, eg 0

124 Chapter 3. Modules py3status Documentation, Release 3.21

• {ebike_overflow} overflow bike, eg 0 • {edock} number of electric dock, eg 33 • {free_dock} available bike places, eg 0 • {free_edock} available electric bike places, eg 30 • {kiosk_state} kiosk in working, eg no, yes • {latitude} latitude, eg 48.87242006305313 • {longitude} longitude, eg 2.348395236282807 • {max_bike_overflow} max overflow bike, eg 33 • {name} name, eg Enghien - Faubourg Poissonnière • {overflow} support overflow, eg no, yes • {overflow_activation} state of overflow support, eg no, yes • {state} state, eg Closed, Operative • {type} type, eg no, yes Color thresholds: • format xxx: print a color based on the value of xxx placeholder • format_station xxx: print a color based on the value of xxx placeholder author Cyril Levis (@cyrinux)

3.94 vnstat

Display vnstat statistics. Configuration parameters: • cache_timeout refresh interval for this module (default 180) • format display format for this module (default ‘{total}’) • initial_multi set to 1 to disable first bytes (default 1024) • left_align (default 0) • multiplier_top if value is greater, divide it with unit_multi and get next unit from units (default 1024) • precision (default 1) • statistics_type d for daily, m for monthly (default ‘d’) • thresholds thresholds to use for color changes (default []) • unit_multi value to divide if rate is greater than multiplier_top (default 1024) Format placeholders: • {down} download • {total} total

3.94. vnstat 125 py3status Documentation, Release 3.21

• {up} upload Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • vnstat a console-based network traffic monitor Examples:

# colorize thresholds vnstat { format = '[\?color=total {total}]' thresholds = [ (838860800, "degraded"), # 838860800 B -> 800 MiB (943718400, "bad"), # 943718400 B -> 900 MiB ] } author shadowprince license Eclipse Public License

3.95 volume_status

Volume control. Configuration parameters: • blocks a string, where each character represents a volume level (default “_”) • button_down button to decrease volume (default 5) • button_mute button to toggle mute (default 1) • button_up button to increase volume (default 4) • cache_timeout how often we refresh this module in seconds. (default 10) • card Card to use. amixer supports this. (default None) • channel channel to track. Default value is backend dependent. (default None) • command Choose between “amixer”, “pamixer” or “pactl”. If None, try to guess based on available commands. (default None) • device Device to use. Defaults value is backend dependent (default None) • format Format of the output. (default ‘[\?if=is_input |♪]: {percentage}%’) • format_muted Format of the output when the volume is muted. (default ‘[\?if=is_input |♪]: muted’) • is_input Is this an input device or an output device? (default False) • max_volume Allow the volume to be increased past 100% if available. pactl and pamixer supports this. (default 120)

126 Chapter 3. Modules py3status Documentation, Release 3.21

• thresholds Threshold for percent volume. (default [(0, ‘bad’), (20, ‘degraded’), (50, ‘good’)]) • volume_delta Percentage amount that the volume is increased or decreased by when volume buttons pressed. (default 5) Format placeholders: • {icon} Character representing the volume level, as defined by the ‘blocks’ • {percentage} Percentage volume Color options: • color_muted Volume is muted, if not supplied color_bad is used if set to None then the threshold color will be used. Requires: • alsa-utils an alternative implementation of linux sound support • pamixer pulseaudio command-line mixer like amixer Notes: If you are changing volume state by external scripts etc and want to refresh the module quicker than the i3status interval, send a USR1 signal to py3status in the keybinding. Example: killall -s USR1 py3status Examples:

# Set thresholds to rainbow colors volume_status { thresholds = [ (0, "#FF0000"), (10, "#E2571E"), (20, "#FF7F00"), (30, "#FFFF00"), (40, "#00FF00"), (50, "#96BF33"), (60, "#0000FF"), (70, "#4B0082"), (80, "#8B00FF"), (90, "#FFFFFF") ] } author license BSD

3.96 vpn_status

Drop-in replacement for i3status run_watch VPN module. Expands on the i3status module by displaying the name of the connected vpn using pydbus. Asynchronously updates on dbus signals unless check_pid is True. Configuration parameters:

3.96. vpn_status 127 py3status Documentation, Release 3.21

• cache_timeout How often to refresh in seconds when check_pid is True. (default 10) • check_pid If True, act just like the default i3status module. (default False) • format Format of the output. (default ‘VPN: {name}|VPN: no’) • pidfile Same as i3status pidfile, checked when check_pid is True. (default ‘/sys/class/net/vpn0/dev_id’) Format placeholders: • {name} The name and/or status of the VPN. Color options: • color_bad VPN connected • color_good VPN down Requires: • pydbus Which further requires PyGi. Check your distribution’s repositories. author Nathan Smith

3.97 wanda_the_fish

Display a fortune-telling, swimming fish. Wanda has no use what-so-ever. It only takes up disk space and compilation time, and if loaded, it also takes up precious bar space, memory, and cpu cycles. Anybody found using it should be promptly sent for a psychiatric evaluation. Configuration parameters: • cache_timeout refresh interval for this module (default 0) • format display format for this module (default ‘{nomotion}[{fortune} ]{wanda}{motion}’) • fortune_timeout refresh interval for fortune (default 60) Format placeholders: • {fortune} one of many aphorisms or vague prophecies • {wanda} name of one of the most commonly kept freshwater aquarium fish • {motion} biologically propelled motion through a liquid medium • {nomotion} opposite behavior of motion to prevent modules from shifting Optional: • fortune-mod the fortune cookie program from bsd games Examples:

128 Chapter 3. Modules py3status Documentation, Release 3.21

# disable motions when not in use wanda_the_fish { format = '[\?if=fortune {nomotion}][{fortune} ]' format += '{wanda}[\?if=fortune {motion}]' }

# no updates, no motions, yes fortunes, you click wanda_the_fish { format = '[{fortune} ]{wanda}' cache_timeout = -1 }

# wanda moves, fortunes stays wanda_the_fish { format = '[{fortune} ]{nomotion}{wanda}{motion}' }

# wanda is swimming too fast, slow down wanda wanda_the_fish { cache_timeout = 2 } author lasers

3.98 weather_owm

Display ultimately customizable weather. This module allows you to specify an icon for nearly every weather scenario imaginable. The default configuration options lump many of the icons into a few groups, and due to the limitations of UTF-8, this is really as expressive as it gets. This module uses OpenWeatherMap API (https://openweathermap.org). setting location or city allows you to specify the location for the weather you want displaying. Requires an API key for OpenWeatherMap (OWM), but the free tier allows you enough requests/sec to get accurate weather even up to the minute. I would highly suggest you install an additional font, such as the incredible (and free!) Weather Icons font (https: //erikflowers.github.io/weather-icons), which has icons for most weather scenarios. But, this will still work with the i3bar default font, Deja Vu Sans Mono font, which has Unicode support. You can see the (limited) weather icon support within Unicode in the defaults. For more information, see the documentation (https://openweathermap.org/weather-conditions) on what weather con- ditions are supported. See the configuration options for how to specify each weather icon. Configuration parameters: • api_key Your OpenWeatherMap API key See https://openweathermap.org/appid. Required! (default None)

3.98. weather_owm 129 py3status Documentation, Release 3.21

• cache_timeout The time between API polling in seconds It is recommended to keep this at a higher value to avoid rate limiting with the API’s. (default 1800) • city The city to display for location information. If set, implicitly disables the Geo API for determining city name. (default None) • country The country to display for location information. If set, implicitly disables the Geo API for determining country name. (default None) • forecast_days Number of days to include in the forecast, including today (regardless of the ‘fore- cast_include_today’ flag) (default 3) • forecast_include_today Include today in the forecast? (Boolean) (default False) • format How to display the weather This also dictates the type of forecast. The placeholders here refer to the format_[. . . ] variables found below. Available placeholders: icon, city, clouds, rain, snow, wind, humidity, pressure, temperature, sunrise, sunset, main, description, forecast (default ‘{city} {icon} {tem- perature}[ {rain}], {description} {forecast}’) • format_clouds Formatting for cloud coverage (percentage) Available placeholders: icon, coverage (default ‘{icon} {coverage}%’) • format_forecast Formatting for future forecasts Available placeholders: See ‘format’ This is similar to the ‘format’ field, but contains information for future weather. Notably, this does not include information about sunrise or sunset times. (default ‘{icon}’) • format_forecast_separator Separator between entries in the forecast (default ‘ ‘) • format_humidity Formatting for humidity (percentage) Available placeholders: icon, humidity (de- fault ‘{icon} {humidity}%’) • format_pressure Formatting for atmospheric pressure Available placeholders: icon, pressure, sea_level (default ‘{icon} {pressure} hPa’) • format_rain Formatting for rain volume over the past 3 hours Available placeholders: icon, amount (default ‘[\?if=amount {icon} {amount:.0f} {unit}]’) • format_snow Formatting for snow volume over the past 3 hours Available placeholders: icon, amount (default ‘[\?if=amount {icon} {amount:.0f} {unit}]’) • format_sunrise Formatting for sunrise time Note that this format accepts strftime/strptime place- holders to populate the output with the time information. Available placeholders: icon (default ‘{icon} %-I:%M %p’) • format_sunset Formatting for sunset time This format accepts strftime/strptime placeholders to pop- ulate the output with the time information. Available placeholders: icon (default ‘{icon} %-I:%M %p’) • format_temperature Formatting for temperature Available placeholders: current, icon, max, min (default ‘{icon} [\?color=all {current:.0f}°{unit}]’) • format_wind Formatting for wind degree and speed The ‘gust’ option represents the speed of wind gusts in the wind unit. Available placeholders: icon, degree, speed, gust (default ‘[\?if=speed {icon} {speed:.0f} {unit}]’) • icon_atmosphere Icon for atmospheric conditions, like fog, smog, etc. (default ‘’) • icon_cloud Icon for clouds (default ‘’) • icon_extreme Icon for extreme weather (default ‘’) • icon_humidity Icon for humidity (default ‘’) • icon_pressure Icon for pressure (default ‘’) • icon_rain Icon for rain (default ‘’)

130 Chapter 3. Modules py3status Documentation, Release 3.21

• icon_snow Icon for snow (default ‘’) • icon_sun Icon for sunshine (default ‘’) • icon_sunrise Icon for sunrise (default ‘’) • icon_sunset Icon for sunset (default ‘’) • icon_temperature Icon for temperature (default ‘’) • icon_thunderstorm Icon for thunderstorms (default ‘’) • icon_wind Icon for wind or breeze (default ‘’) • icons A dictionary relating weather code to icon See https://openweathermap.org/weather-conditions for a complete list of supported icons. This will fall-back to the listed icon if there is no specific icon present. However, options included here take precedent over the above ‘icon_{. . . }’ options. There are multiple ways to specify individual icons based on the id: * Use the key ‘601’ to reference the condition with id = 601 (snow) * Use the key ‘230_232’ to reference a span of conditions inclusive, in this case conditions (230, 231, 232) (thunderstorm with drizzle) (default None) • lang An ISO 639-1 code for your language (two letters) (default ‘en’) • location A tuple of floats describing the desired weather location The tuple should follow the form (latitude, longitude), and if set, implicitly disables the Geo API for determining location. (default None) • thresholds Configure temperature colors based on limits The numbers specified inherit the unit of the temperature as configured. The default below is intended for Fahrenheit. If the set value is empty or None, the feature is disabled. You can specify this parameter using a dictionary: * Keys are names. You have the option of ‘current’, ‘min’, ‘max’, or ‘all’ to specify a threshold. The first three are tied to the various temperature values, the last sets the same threshold for all outputs. If both ‘all’ and one of the first three are set (lets say ‘min’ for this example), the threshold will default to be the value in ‘min’, not ‘all’. This goes for any configuration * The values are lists of pairs, with temperature (in the configured unit) as the first and the color as the second * To use the thresholds color, place ‘\?color=all’ in the formatting string for temperature, replacing ‘all’ with any of the valid threshold names for different coloring effects * To have smooth transitions between colors, consider setting the ‘gradients’ configuration parameter to ‘True’, either in the global configuration, or in the module configuration! (default {‘all’: [(-100, ‘#0FF’), (0, ‘#00F’), (50, ‘#0F0’), (150, ‘#FF0’)]}) • unit_rain Unit for rain fall When specified, a unit may be any combination of upper and lower case, such as ‘Ft’, and still be considered valid as long as it is in the below options. Options: cm, ft, in, mm, m, yd (default ‘in’) • unit_snow Unit for snow fall Options: cm, ft, in, mm, m, yd (default ‘in’) • unit_temperature Unit for temperature Options: c, f, k (default ‘F’) • unit_wind Unit for wind speed Options: fsec, msec, mph, kmh (default ‘mph’) Format placeholders: • {icon} The icon associated with a formatting section • format_clouds • {coverage} Cloud coverage percentage • format_humidity • {humidity} Humidity percentage • format_pressure • {pressure} Current atmospheric pressure in Pascals

3.98. weather_owm 131 py3status Documentation, Release 3.21

• {sea_level} Sea-level atmospheric pressure in Pascals. • format_rain • {amount} Rainfall in the specified unit • {unit} The unit specified • format_snow • {amount} Snowfall in the specified unit • {unit} The unit specified • format_temperature • {current} Current temperature • {max} Maximum temperature in the configured unit • {min} Minimum temperature • {unit} The unit specified • format_wind • {degree} Current wind heading • {gust} Wind gusts speed in the specified unit • {speed} Wind speed • {unit} The unit specified format only: • {city} The name of the city where the weather is • {country} The name of the country where the weather is • {forecast} Output of format_forecast format, format_forecast: • {clouds} Output of format_clouds • {description} Natural description of the current weather • {humidity} Output of format_humidity • {main} Short description of the current weather • {pressure} Output of format_pressure • {snow} Output of format_snow • {sunrise} Output of format_sunrise • {sunset} Output of format_sunset • {temperature} Output of format_temperature • {wind} Output of format_wind Examples:

# change icons weather_owm { api_key = icons = { '200': "" '230_232': "" } (continues on next page)

132 Chapter 3. Modules py3status Documentation, Release 3.21

(continued from previous page) }

# set a city weather_owm { api_key = city = 'London' }

# set a location weather_owm { api_key = location = (48.9342, 2.3548) # Saint-Denis } author alexoneill @licence MIT

3.99 whatismyip

Display public IP address and online status. Configuration parameters: • button_refresh mouse button to refresh this module (default 2) • button_toggle mouse button to toggle between states (default 1) • cache_timeout how often we refresh this module in seconds (default 60) • expected define expected values for format placeholders, and use color_degraded to show the output of this module if any of them does not match the actual value. This should be a dict eg {‘country’: ‘France’} (default None) • format available placeholders are {ip} and {country}, as well as any other key in JSON fetched from url_geo (default ‘{ip}’) • hide_when_offline hide the module output when offline (default False) • icon_off what to display when offline (default ‘’) • icon_on what to display when online (default ‘’) • mode default mode to display is ‘ip’ or ‘status’ (click to toggle) (default ‘ip’) • url_geo IP to check for geo location (must output json) (default ‘https://ifconfig.co/json’) Format placeholders: • {icon} eg , • {country} eg France

3.99. whatismyip 133 py3status Documentation, Release 3.21

• {country_iso} eg FR • {ip} eg 123.45.67.890 • {ip_decimal} eg 1234567890 • {city} eg Paris any other key in JSON fetched from url_geo Color options: • color_bad Offline • color_degraded Output is unexpected (IP/country mismatch, etc.) • color_good Online author ultrabug, Cyril Levis (@cyrinux)

3.100 whoami

Display logged-in username. Configuration parameters: • format display format for this module (default ‘{username}’) Format placeholders: • {username} display current username Inspired by i3 FAQ: https://faq.i3wm.org/question/1618/add-user-name-to-status-bar.1.html author ultrabug

3.101 wifi

Display WiFi bit rate, quality, signal and SSID using iw. Configuration parameters: • bitrate_bad Bad bit rate in Mbit/s (default 26) • bitrate_degraded Degraded bit rate in Mbit/s (default 53) • blocks a string, where each character represents quality level (default “_”) • cache_timeout Update interval in seconds (default 10) • device specify name or MAC address of device to use, otherwise auto (default None) • down_color Output color when disconnected, possible values: “good”, “degraded”, “bad” (default “bad”) • format Display format for this module (default ‘W: {bitrate} {bitrate_unit} {signal_percent}% {ssid}|W: down’) • signal_bad Bad signal strength in percent (default 29)

134 Chapter 3. Modules py3status Documentation, Release 3.21

• signal_degraded Degraded signal strength in percent (default 49) • thresholds specify color thresholds to use (default []) Format placeholders: • {bitrate} Display bitrate • {bitrate_unit} Display bitrate unit • {device} Display device name • {freq_ghz} Network frequency in Ghz • {freq_mhz} Network frequency in Mhz • {icon} Character representing the quality based on bitrate, as defined by the ‘blocks’ • {ip} Display IP address • {signal_dbm} Display signal in dBm • {signal_percent} Display signal in percent • {ssid} Display SSID Color options: • color_bad Signal strength signal_bad or lower • color_degraded Signal strength signal_degraded or lower • color_good Signal strength above signal_degraded Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • iw cli configuration utility for wireless devices • ip only for {ip}. may be part of iproute2: ip routing utilities Notes: Some distributions require commands to be run with privileges. You can give commands some root rights to run without a password by editing sudoers file, i.e., sudo visudo, and add a line that requires sudo. ‘ ALL=(ALL) NOPASSWD:/sbin/iw dev,/sbin/iw dev [a-z]* link’ ‘ ALL=(ALL) NOPASSWD:/sbin/ip addr list [a-z]*’ author Markus Weimar license BSD

3.102 window_title

Display window title. This module prints the properties of a focused window at frequent intervals. Configuration parameters: • cache_timeout refresh interval for this module (default 0.5) • format display format for this module (default ‘{title}’)

3.102. window_title 135 py3status Documentation, Release 3.21

• max_width If width of title is greater, shrink it and add ‘. . . ’ (default 120) Format placeholders: • {class} class name • {instance} instance name • {title} title name Examples:

# show heart if no title window_title { format = '{title}|' }

# specify a length window_title { format = '[\?max_length=55 {title}]' }

author shadowprince license Eclipse Public License

3.103 window_title_async

Display window title asynchronously. Uses asynchronous update via i3 IPC events. Provides instant title update only when it required. Configuration parameters: • always_show do not hide the title when it can be already visible (e.g. in tabbed layout). (default False) • empty_title string that will be shown instead of the title when the title is hidden. (default “”) • format format of the title, (default “{title}”) • max_width maximum width of block (in symbols). If the title is longer than max_width, the title will be truncated to max_width - 1 first symbols with ellipsis appended. (default 120) Format placeholders: • {title} window title Requires: • i3ipc an improved python library to control i3wm author Anon1234 https://github.com/Anon1234 license BSD

136 Chapter 3. Modules py3status Documentation, Release 3.21

3.104 wwan

Display WWANs, IP addresses, signals, properties and sms. Configuration parameters: • cache_timeout refresh interval for this module (default 5) • format display format for this module (default ‘\?color=state WW: [\?if=state_name=connected ‘ ‘({sig- nal_quality_0}% at {m3gpp_operator_name}) ‘ ‘[{format_ipv4}[\?soft ]{format_ipv6}]|{state_name}]’ ‘[ SMS {messages} [{format_message}]]’) • format_ipv4 display format for ipv4 network (default ‘[{address}]’) • format_ipv6 display format for ipv6 network (default ‘[{address}]’) • format_message display format for SMS messages (default ‘\?if=index<2 {number} [\?max_length=10 {text}. . . ]’) • format_message_separator show separator if more than one (default ‘ ‘) • format_notification specify notification to use (default None) • format_stats display format for statistics (default ‘{duration_hms}’) • modem specify a modem device to use, otherwise auto (default None) • thresholds specify color thresholds to use (default [(0, ‘bad’), (11, ‘good’)]) Format placeholders: • {access_technologies} network speed, in bit, eg 192 • {access_technologies_name} network speed names, eg LTE • {current_bands} modem band, eg 1 • {current_bands_name} modem band name, eg GSM/GPRS/EDGE 900 MHz • {format_ipv4} format for ipv4 network config • {format_ipv6} format for ipv6 network config • {format_message} format for SMS messages • {format_stats} format for network connection statistics • {interface_name} network interface name, eg wwp0s20f0u2i12 • {m3gpp_registration_state_name} network registration state name, eg HOME • {m3gpp_registration_state} network registration state, eg 1 • {m3gpp_operator_code} network operator code, eg 496 • {m3gpp_operator_name} network operator name, eg Py3status Telecom • {message} number of messages, eg 2 • {messages} total number of messages, eg 30 • {signal_quality_0} signal quality percentage, eg 88

3.104. wwan 137 py3status Documentation, Release 3.21

• {signal_quality_1} signal quality refreshed, eg True/False • {state} network state, eg 0, 7, 11 • {state_name} network state name, eg searching, connected format_ipv4 placeholders: • {address} ip address • {dns1} dns1 • {dns2} dns2 • {gateway} gateway • {mtu} mtu • {prefix} netmask prefix format_ipv6 placeholders: • {address} ip address • {dns1} dns1 • {dns2} dns2 • {gateway} gateway • {mtu} mtu • {prefix} netmask prefix format_message placeholders: • {index} message index • {text} text received, eg: ‘hello how are you?’ • {number} contact number, eg: ‘+33601020304’ format_stats placeholders: • {duration} time since connected, in seconds, eg 171 • {duration_hms} time since connected, in [hh:]mm:ss, eg 02:51 • {tx_bytes} transmit bytes • {rx_bytes} receive bytes Color thresholds: • format xxx: print a color based on the value of xxx placeholder Requires: • modemmanager mobile broadband modem management service • networkmanager network connection manager and user applications • pydbus pythonic dbus library Examples:

138 Chapter 3. Modules py3status Documentation, Release 3.21

# show state names, eg initializing, searching, registered, connecting. wwan { format = '\?color=state WWAN: {state_name}' }

# show state names, and when connected, show network information too. wwan { format = 'WWAN:[\?color=state [ {format_ipv4}]' format += '[ {format_ipv6}] {state_name}]' }

# show internet access technologies name with up/down state. wwan { format = 'WWAN: [\?color=state [{access_technologies_name}]' format += '[\?soft ][\?if=state_name=connected up|down]]' }

# show SMS messages only wwan { format = '[SMS: {format_message}]' }

# SMS counter wwan { format = 'SMS: {message}/{messages}' }

# add starter pack thresholds. you do not need to add them all. wwan { thresholds = { 'access_technologies': [ (2, 'bad'), (32, 'orange'), (512, 'degraded'), (16384, 'good') ], 'signal_quality_0': [ (0, 'bad'), (10, 'orange'), (30, 'degraded'), (50, 'good') ], 'signal_quality_1': [ (False, 'darkgrey'), (True, 'degraded') ], 'state': [ (-1, 'bad'), (4, 'orange'), (5, 'degraded'), (11, 'good') ] } }

# customize WWAN format wwan { format = 'WWAN: [\?color=state {state_name}] ' format += '[\?if=m3gpp_registration_state_name=HOME {m3gpp_operator_name} ] ' format += '[\?if=m3gpp_registration_state_name=ROAMING {m3gpp_operator_name} ]' format += '[\?color=access_technologies {access_technologies_name} ]' format += '[([\?color=signal_quality_0 {signal_quality_0}]]' format += '[\?if=!signal_quality_1&color=signal_quality_1 \[!\]|] ' format += '[\?if=state_name=connected [{format_ipv4}] [{format_stats}]]') }

(continues on next page)

3.104. wwan 139 py3status Documentation, Release 3.21

(continued from previous page) # notify users when an event occur... such as new messages, change in state, # disconnected, etc. you need to specify formatting correctly so it does not # return anything. otherwise, you always get notifications. wwan { # notify users on low signal percent 25% format_notification = '\?if=signal_quality_0<25 Low signal'

# notify users on connected state format_notification = '[\?if=state_name=connected Connected.]' format_notification += '[\?if=state_name=disconnected Disconnected.]'

# message notification format_message = '[\?if=index=1 [{number}] [{text}]]' format_notification = '[\?if=message>0 {format_message}]' } author Cyril Levis (@cyrinux), girst (https://gir.st/)

3.105 wwan_status

Display network and IP address for newer Huwei modems. It is tested for Huawei E3276 (usb-id 12d1:1506) aka Telekom Speed Stick LTE III but may work on other devices too. Configuration parameters: • baudrate There should be no need to configure this, but feel free to experiment. (default 115200) • cache_timeout How often we refresh this module in seconds. (default 5) • consider_3G_degraded If set to True, only 4G-networks will be considered ‘good’; 3G connections are shown as ‘degraded’, which is yellow by default. Mostly useful if you want to keep track of where there is a 4G connection. (default False) • format_down What to display when the modem is not plugged in (default ‘WWAN: down’) • format_error What to display when modem can’t be accessed. (default ‘WWAN: {error}’) • format_no_service What to display when the modem does not have a network connection. This allows to omit the (then meaningless) network generation. (default ‘WWAN: {status} {ip}’) • format_up What to display upon regular connection (default ‘WWAN: {status} ({netgen}) {ip}’) • interface The default interface to obtain the IP address from. For wvdial this is most likely ppp0. For netctl it can be different. (default ‘ppp0’) • modem The device to send commands to. (default ‘/dev/ttyUSB1’) • modem_timeout The timespan between querying the modem and collecting the response. (default 0.4) Color options: • color_bad Error or no connection

140 Chapter 3. Modules py3status Documentation, Release 3.21

• color_degraded Low generation connection eg 2G • color_good Good connection Requires: • netifaces portable module to access network interface information • pyserial multiplatform serial port module for python author Timo Kohorst [email protected] PGP: B383 6AE6 6B46 5C45 E594 96AB 89D2 209D DBF3 2BB5

3.106 xkb_layouts

Switch keyboard layouts. Configuration parameters: • button_next mouse button to cycle next layout (default 4) • button_prev mouse button to cycle previous layout (default 5) • cache_timeout refresh interval for this module (default 10) • format display format for this module (default “[\?color=s {s}][ {v}]”) • thresholds specify color thresholds to use (default [(“fr”, “#268BD2”), (“ru”, “#F75252”), (“ua”, “#FCE94F”), (“us”, “#729FCF”)]) Format placeholders: • xkblayout-state • {c} layout number, eg 0 • {n} layout name, eg English • {s} layout symbol, eg us • {v} layout variant, eg basic • {e} layout variant, {v} or {s}, eg dvorak • {C} layout count, eg 2 • xkbgroup • {c} layout number, eg 0 • {n} layout name, eg English (US) • {s} layout symbol, eg us • {v} layout variant, eg basic • {e} layout variant, {v} or {s}, eg dvorak • {C} layout count, eg 2

3.106. xkb_layouts 141 py3status Documentation, Release 3.21

• xkb-switch • {s} layout symbol, eg us • {e} layout variant, compatibility alias to {s}, eg us • {C} layout count, eg 2 Color thresholds: • xxx print a color based on the value of xxx placeholder Requires: • xkblayout-state a small command-line program to get/set the current keyboard layout • xkbgroup query and change xkb layout state • xkb-switch program that allows to query and change the xkb layout state author lasers, saengowp

3.107 xrandr

Control screen layout. This modules allows you to handle your screens outputs directly from your bar! • Detect and propose every possible screen combinations • Switch between combinations using click events and mouse scroll • Activate the screen or screen combination on a single click • It will detect any newly connected or removed screen automatically For convenience, this module also proposes some added features: • Dynamic parameters for POSITION and WORKSPACES assignment (see below) • Automatic fallback to a given screen or screen combination when no more screen is available (handy for laptops) • Automatically apply this screen combination on start: no need for xorg! • Automatically move workspaces to screens when they are available • Define your own subset of output combinations to use Configuration parameters: • cache_timeout how often to (re)detect the outputs (default 10) • command a custom command to be run after display configuration changes (default None)

142 Chapter 3. Modules py3status Documentation, Release 3.21

• fallback when the current output layout is not available anymore, fallback to this layout if available. This is very handy if you have a laptop and switched to an external screen for presentation and want to automatically fallback to your laptop screen when you disconnect the external screen. (default True) • fixed_width show output as fixed width (default True) • force_on_change switch display layout to the leftmost combination mode of the given list whenever it is available. The combination modes are checked from left (high priority) to right (less priority) until one matches. Example: We have a laptop with internal screen and we are often moving from our desk where another screen is available. We want the layout to follow our changes so that we do not have to switch manually. So whenever we plug at our desk, we want the second monitor to be used, and whenever we go away we want everything back on the laptop screen automatically:

force_on_change = ["eDP1+DP1", "eDP1"]

NOTES: Click controls will override force_on_change until the layout changes in the background so you can still manually control your layout changes on the bar. Use the force_on_start to handle initial layout setup on module startup along with this feature to benefit from fully dynamic and automated changes of screen layouts. (default []) • force_on_start switch to the given combination mode if available when the module starts (saves you from having to configure xorg) (default None) • format display format for xrandr (default ‘{output}’) • hide_if_single_combination hide if only one combination is available (default False) • icon_clone icon used to display a ‘clone’ combination (default ‘=’) • icon_extend icon used to display a ‘extend’ combination (default ‘+’) • on_udev_drm dynamic variable to watch for drm udev subsystem events to trigger specified action. (default ‘refresh_and_freeze’) • output_combinations string used to define your own subset of output combinations to use, instead of generating every possible combination automatically. Provide the values in the format that this module uses, splitting the combinations using ‘|’ character. The combinations will be rotated in the exact order as you listed them. When an output layout is not available any more, the configurations are automatically filtered out. Example: Assuming the default values for icon_clone and icon_extend are used, and assuming you have two screens ‘eDP1’ and ‘DP1’, the following setup will reduce the number of output combinations from four (every possible one) down to two.

output_combinations = "eDP1|eDP1+DP1"

(default None) Dynamic configuration parameters: • _icon use this icon instead of OUTPUT name as text Example: DP1_icon = “” • _pos apply the given position to the OUTPUT Example: DP1_pos = “-2560x0” Example: DP1_pos = “above eDP1” Example: DP1_pos = “below eDP1” Example: DP1_pos = “left-of LVDS1” Example: DP1_pos = “right-of eDP1” • _workspaces comma separated list of workspaces to move to the given OUTPUT when it is activated Example: DP1_workspaces = “1,2,3” • _rotate rotate the output as told Example: DP1_rotate = “left” • _mode define the mode (resolution) for the output if not specified use –auto : prefered mode Example: eDP1_mode = “2560x1440

3.107. xrandr 143 py3status Documentation, Release 3.21

_primary apply the primary to the OUTPUT Example: DP1_primary = True Format placeholders: • {output} xrandr output Color options: • color_bad Displayed layout unavailable • color_degraded Using a fallback layout • color_good Displayed layout active Notes: Some days are just bad days. Running xrandr --query command can cause unexplainable brief screen freezes due to an overall combination of computer hardware, installed , your choice of linux distribution, and/or some other unknown factors such as recent system updates. Configuring cache_timeout with a different number, eg 3600 (an hour) or -1 (runs once) can be used to remedy this issue. See issue #580. Examples:

# start with a preferable setup xrandr { force_on_start = "eDP1+DP1" DP1_pos = "left-of eDP1" VGA_workspaces = "7" } author ultrabug

3.108 xrandr_rotate

Control screen rotation. Configuration parameters: • cache_timeout how often to refresh this module. (default 10) • format a string that formats the output, can include placeholders. (default ‘{icon}’) • hide_if_disconnected a boolean flag to hide icon when screen is disconnected. It has no effect unless screen option is also configured. (default False) • horizontal_icon a character to represent horizontal rotation. (default ‘H’) • horizontal_rotation a horizontal rotation for xrandr to use. Available options: ‘normal’ or ‘in- verted’. (default ‘normal’) • screen display output name to rotate, as detected by xrandr. If not provided, all enabled screens will be rotated. (default None) • vertical_icon a character to represent vertical rotation. (default ‘V’) • vertical_rotation a vertical rotation for xrandr to use. Available options: ‘left’ or ‘right’. (default ‘left’)

144 Chapter 3. Modules py3status Documentation, Release 3.21

Format placeholders: • {icon} a rotation icon, specified by horizontal_icon or vertical_icon. • {screen} a screen name, specified by screen option or detected automatically if only one screen is connected, otherwise ‘ALL’. Color options: • color_degraded Screen is disconnected • color_good Displayed rotation is active author Maxim Baz (https://github.com/maximbaz) license BSD

3.109 xscreensaver

Control Xscreensaver. This script is useful for people who let Xscreensaver manage DPMS settings. Xscreensaver has its own DPMS vari- ables separate from xset. DPMS can be safely turned off in xset as long as Xscreensaver is running. Settings can be managed using “xscreensaver-demo”. Configuration parameters: • button_activate mouse button to activate Xscreensaver (default 3) • button_toggle mouse button to toggle Xscreensaver (default 1) • cache_timeout refresh interval for this module (default 15) • format display format for this module (default ‘{icon}’) • icon_off show when Xscreensaver is not running (default ‘XSCR’) • icon_on show when Xscreensaver is running (default ‘XSCR’) Format placeholders: • {icon} Xscreensaver icon Color options: • color_on Enabled, defaults to color_good • color_off Disabled, defaults to color_bad author neutronst4r, lasers

3.110 xsel

3.109. xscreensaver 145 py3status Documentation, Release 3.21

Display X selection. Configuration parameters: • cache_timeout refresh interval for this module (default 0.5) • command the clipboard command to run (default ‘xsel –output’) • format display format for this module (default ‘{selection}’) • log_file specify the clipboard log to use (default None) • max_size strip the selection to this value (default 15) • symmetric show beginning and end of the selection string with respect to configured max_size. (default True) Format placeholders: • {selection} output from clipboard command Requires: • xsel a command-line program to retrieve/set the X selection Examples: xsel { max_size = 50 command = "xsel --clipboard --output" on_click 1 = "exec xsel --clear --clipboard" log_file = "~/.local/share/xsel/clipboard_log" } author Sublim3 [email protected] license BSD

3.111 yandexdisk_status

Display Yandex.Disk status. Configuration parameters: • cache_timeout refresh interval for this module (default 10) • format display format for this module (default ‘Yandex.Disk: {status}’) • status_busy show when Yandex.Disk is busy (default None) • status_off show when Yandex.Disk isn’t running (default ‘Not started’) • status_on show when Yandex.Disk is idling (default ‘Idle’) Format placeholders:

146 Chapter 3. Modules py3status Documentation, Release 3.21

• {status} Yandex.Disk status Color options: • color_bad Not started • color_degraded Idle • color_good Busy Requires: • yandex-disk command line interface for Yandex.Disk author Vladimir Potapev (github:vpotapev) license BSD

3.112 yubikey

Show an indicator when YubiKey is waiting for a touch. Configuration parameters: • format Display format for the module. (default ‘[YubiKey[\?if=is_gpg ][\?if=is_u2f ]]’) • socket_path A path to the yubikey-touch-detector socket file. (default ‘$XDG_RUNTIME_DIR/yubikey-touch-detector.socket’) Control placeholders: • {is_gpg} a boolean, True if YubiKey is waiting for a touch due to a gpg operation. • {is_u2f} a boolean, True if YubiKey is waiting for a touch due to a pam-u2f request. Requires: • github.com/maximbaz/yubikey-touch-detector tool to detect when YubiKey is waiting for a touch author Maxim Baz (https://github.com/maximbaz) license BSD

3.112. yubikey 147 py3status Documentation, Release 3.21

148 Chapter 3. Modules CHAPTER 4

py3-cmd

py3status can be controlled remotely via the py3-cmd cli utility. This utility allows you to run a number of commands.

# button numbers 1= left click 2= middle click 3= right click 4= scroll up 5= scroll down

4.1 Commands available

4.1.1 click

Send a click event to a module as though it had been clicked on. You can specify the button to simulate.

# send a left/middle/right click py3-cmd click --button1 dpms # left py3-cmd click --button2 sysdata # middle py3-cmd click --button3 pomodoro # right

# send a up/down click py3-cmd click --button4 volume_status # up py3-cmd click --button5 volume_status # down

# toggle button in frame module py3-cmd click --button1 --index button frame # left

# change modules in group module py3-cmd click --button5 --index button group # down (continues on next page)

149 py3status Documentation, Release 3.21

(continued from previous page)

# change time units in timer module py3-cmd click --button4 --index hours timer # up py3-cmd click --button4 --index minutes timer # up py3-cmd click --button4 --index seconds timer # up

4.1.2 list

Print a list of modules or module docstrings.

# list one or more modules py3-cmd list clock loadavg xrandr # full py3-cmd list coin* git* window* # fnmatch py3-cmd list[a-e] * # abcde

# list all modules py3-cmd list --all

# show full (i.e. docstrings) py3-cmd list vnstat uname -f

4.1.3 refresh

Cause named module(s) to have their output refreshed.

# refresh all instances of the wifi module py3-cmd refresh wifi

# refresh multiple modules py3-cmd refresh coin_market github weather_yahoo

# refresh module with instance name py3-cmd refresh "weather_yahoo chicago"

# refresh all modules py3-cmd refresh --all

4.2 Calling commands from i3 py3-cmd can be used in your i3 configuration file. To send a click event to the whatismyip module when Mod+x is pressed bindsym $mod+x exec py3-cmd click whatismyip

This example shows how volume control keys can be bound to change the volume and then cause the volume_status module to be updated.

150 Chapter 4. py3-cmd py3status Documentation, Release 3.21

bindsym XF86AudioRaiseVolume exec "amixer -q sset Master 5%+ unmute; py3-cmd refresh

˓→volume_status" bindsym XF86AudioLowerVolume exec "amixer -q sset Master 5%- unmute; py3-cmd refresh

˓→volume_status" bindsym XF86AudioMute exec "amixer -q sset Master toggle; py3-cmd refresh

˓→volume_status"

Note: py3-cmd was added in py3status version 3.6 if you are using a source installation from a prior version, then you may have to run setup.py again so that it is correctly installed see Setting up a development environment.

4.2. Calling commands from i3 151 py3status Documentation, Release 3.21

152 Chapter 4. py3-cmd CHAPTER 5

Writing custom py3status modules

Note: This guide covers the new style of py3status modules. These are only available in version 3.0 and above.

Writing custom modules for py3status is easy. This guide will teach you how.

5.1 Importing custom modules py3status will try to find custom modules in the following locations: • ~/.config/py3status/modules • ~/.config/i3status/py3status • ~/.config/i3/py3status • ~/.i3/py3status which if you are used to XDG_CONFIG paths relates to: • XDG_CONFIG_HOME/py3status/modules • XDG_CONFIG_HOME/i3status/py3status • XDG_CONFIG_HOME/i3/py3status • ~/.i3/py3status You can also specify the modules location using py3status -i in your i3 configuration file.

5.2 Publishing custom modules on PyPI

153 py3status Documentation, Release 3.21

Note: Available since py3status version 3.20.

You can share your custom modules and make them available for py3status users even if they are not directly part of the py3status main project! All you have to do is to package your module and publish it to PyPI. py3status will discover custom modules if they are installed in the same host interpreter and if an entry_point in your package setup.py is defined: setup( entry_points={"py3status":["module = package_name.py3status_module_name"]}, )

The awesome pewpew module can be taken as an example on how to do it easily: • Module repository: https://github.com/obestwalter/py3status-pewpew • Example setup.py: https://github.com/obestwalter/py3status-pewpew/blob/master/setup.py We will gladly add extra_requires pointing to your modules so that users can require them while installing py3status. Just open an issue to request this or propose a PR. If you have installed py3status in a virtualenv (maybe because your custom module has dependencies that need to be available) you can also create an installable package from your module and publish it on PyPI.

Note: To clearly identify your py3status package and for others to discover it easily it is recommended to name the PyPI package py3status-.

5.3 Example 1: The basics - Hello World!

Now let’s start by looking at a simple example. Here we start with the most basic module that just outputs a static string to the status bar.

#-*- coding: utf-8 -*- """ Example module that says 'Hello World!'

This demonstrates how to produce a simple custom module. """ class Py3status:

def hello_world(self): return { 'full_text':'Hello World!', 'cached_until': self.py3.CACHE_FOREVER }

154 Chapter 5. Writing custom py3status modules py3status Documentation, Release 3.21

5.3.1 Running the example

Save the file as hello_world.py in a directory that py3status will check for modules. By default it will look in $HOME/.i3/py3status/ or you can specify additional directories using --include when you run py3status. You need to tell py3status about your new module, so in your i3status.conf add:

order += "hello_world"

Then restart i3 by pressing Mod + Shift + R. Your new module should now show up in the status bar.

5.3.2 How does it work?

The Py3status class tells py3status that this is a module. The module gets loaded. py3status then calls any public methods that the class contains to get a response. In our example there is a single method hello_world(). Read more here: [module methods](#module_methods).

5.3.3 The response

The response that a method returns must be a python dict. It should contain at least two key / values.

5.3.4 full_text

This is the text that will be displayed in the status bar.

5.3.5 cached_until

This tells py3status how long it should consider your response valid before it should re-run the method to get a fresh response. In our example our response will not need to be updated so we can use the special self.py3. CACHE_FOREVER constant. This tells py3status to consider our response always valid. cached_until should be generated via the self.py3.time_in() method.

5.3.6 self.py3

This is a special object that gets injected into py3status modules. It helps provide functionality for the module, such as the CACHE_FOREVER constant. Read more about the py3 module helper.

5.4 Example 2: Configuration parameters

Allow users to supply configuration to a module.

#-*- coding: utf-8 -*- """ Example module that says 'Hello World!' that can be customised.

This demonstrates how to use configuration parameters.

Configuration parameters: (continues on next page)

5.4. Example 2: Configuration parameters 155 py3status Documentation, Release 3.21

(continued from previous page) format: Display format (default 'Hello World!') """ class Py3status:

format='Hello World!'

def hello_world(self): return { 'full_text': self.format, 'cached_until': self.py3.CACHE_FOREVER }

This module still outputs ‘Hello World’ as before but now you can customise the output using your i3status. config for example to show the text in French. hello_world { format = 'Bonjour tout le monde!' }

In your module self.format will have been set to the value supplied in the config.

5.5 Example 3: Click events

Catch click events and perform an action.

#-*- coding: utf-8 -*- """ Example module that handles events

This demonstrates how to use events. """ class Py3status:

def __init__(self): self.full_text='Click me'

def click_info(self): return { 'full_text': self.full_text, 'cached_until': self.py3.CACHE_FOREVER }

def on_click(self, event): """ event will be a dict like {'y': 13, 'x': 1737, 'button': 1, 'name': 'example', 'instance': 'first'} """ button= event['button'] # update our output (self.full_text) format_string='You pressed button {button}' (continues on next page)

156 Chapter 5. Writing custom py3status modules py3status Documentation, Release 3.21

(continued from previous page) data={'button': button} self.full_text= self.py3.safe_format(format_string, data) # Our modules update methods will get called automatically.

The on_click method of a module is special and will get called when the module is clicked on. The event parameter will be a dict that gives information about the event. A typical event dict will look like this: {'y': 13, 'x': 1737, 'button': 1, 'name': 'example', 'instance': 'first'} You should only receive events for the module clicked on, so generally we only care about the button. The __init__() method is called when our class is instantiated.

Note: __init__ is called before any config parameters have been set.

We use the safe_format() method of py3 for formatting. Read more about the py3 module helper.

5.6 Example 4: Status string placeholders

Status string placeholders allow us to add information to formats.

#-*- coding: utf-8 -*- """ Example module that demonstrates status string placeholders

Configuration parameters: format: Initial format to use (default 'Click me') format_clicked: Display format to use when we are clicked (default 'You pressed button {button}')

Format placeholders: {button} The button that was pressed """ class Py3status: format='Click me' format_clicked='You pressed button {button}'

def __init__(self): self.button= None

def click_info(self): if self.button: data={'button': self.button} full_text= self.py3.safe_format(self.format_clicked, data) else: full_text= self.format

return { 'full_text': full_text, 'cached_until': self.py3.CACHE_FOREVER (continues on next page)

5.6. Example 4: Status string placeholders 157 py3status Documentation, Release 3.21

(continued from previous page) }

def on_click(self, event): """ event will be a dict like {'y': 13, 'x': 1737, 'button': 1, 'name': 'example', 'instance': 'first'} """ self.button= event['button'] # Our modules update methods will get called automatically.

This works just like the previous example but we can now be customised. The following example assumes that our module has been saved as click_info.py. click_info { format = "Cliquez ici" format_clicked = "Vous avez appuyé sur le bouton {button}" }

5.7 Example 5: Using color constants self.py3 in our module has color constants that we can access, these allow the user to set colors easily in their config.

Note: py3 colors constants require py3status 3.1 or higher

#-*- coding: utf-8 -*- """ Example module that uses colors.

We generate a random number between and color it depending on its value. Clicking on the module will update it an a new number will be chosen.

Configuration parameters: format: Initial format to use (default 'Number {number}')

Format placeholders: {number} Our random number

Color options: color_high: number is 5 or higher color_low: number is less than 5 """ from random import randint class Py3status: format='Number {number}'

def random(self): number= randint(0,9) (continues on next page)

158 Chapter 5. Writing custom py3status modules py3status Documentation, Release 3.21

(continued from previous page) full_text= self.py3.safe_format(self.format, {'number': number})

if number<5: color= self.py3.COLOR_LOW else: color= self.py3.COLOR_HIGH

return { 'full_text': full_text, 'color': color, 'cached_until': self.py3.CACHE_FOREVER }

def on_click(self, event): # by defining on_click pressing any mouse button will refresh the # module. pass

The colors can be set in the config in the module or its container or in the general section. The following example assumes that our module has been saved as number.py. Although the constants are capitalized they are defined in the config in lower case. number { color_high = '#FF0000' color_low = '#00FF00' }

5.8 Module methods

Py3status will call a method in a module to provide output to the i3bar. Methods that have names starting with an underscore will not be used in this way. Any methods defined as static methods will also not be used.

5.8.1 Outputs

Output methods should provide a response dict. Example response:

{ 'full_text':"This text will be displayed", 'cached_until': 1470922537, # Time in seconds since the epoch }

The response can include the following keys cached_until The time (in seconds since the epoch) that the output will be classed as no longer valid and the output function will be called again. Since version 3.1, if no cached_until value is provided the output will be cached for cache_timeout seconds by default this is 60 and can be set using the -t or --timeout option when running py3status. To never expire the self.py3.CACHE_FOREVER constant should be used. cached_until should be generated via the self.py3.time_in() method.

5.8. Module methods 159 py3status Documentation, Release 3.21 color The color that the module output will be displayed in. composite Used to output more than one item to i3bar from a single output method. If this is provided then full_text should not be. full_text This is the text output that will be sent to i3bar. index The index of the output. Allows composite output to identify which component of their output had an event triggered. separator If False no separator will be shown after the output block (requires i3bar 4.12). urgent If True the output will be shown as urgent in i3bar.

5.8.2 Special methods

Some special method are also defined. kill() Called just before a module is destroyed. on_click(event) Called when an event is received by a module. post_config_hook() Called once an instance of a module has been created and the configuration parameters have been set. This is useful for any work a module must do before its output methods are run for the first time. post_config_hook() introduced in version 3.1

5.9 Py3 module helper

Py3 is a special helper object that gets injected into py3status modules, providing extra functionality. A module can access it via the self.py3 instance attribute of its py3status class. For details see py3 module helper.

5.10 Composites

Whilst most modules return a simple response eg:

{ 'full_text':, 'cached_until':, }

160 Chapter 5. Writing custom py3status modules py3status Documentation, Release 3.21

Sometimes it is useful to provide a more complex, composite response. A composite is made up of more than one simple response which allows for example a response that has multiple colors. Different parts of the response can also be differentiated between when a click event occurs and so allow clicking on different parts of the response to have different outcomes. The different parts of the composite will not have separators between them in the output so they will appear as a single module to the user. The format of a composite is as follows:

{ 'cached_until':, 'composite':[ { 'full_text':, }, { 'full_text':, 'index': }, ] }

The index key in the response is used to identify the individual block and when the modules on_click() method is called the event will include this. Supplied index values should be strings. If no index is given then it will have an integer value indicating its position in the composite.

5.11 Module data storage

Py3status allows modules to maintain state through the use of the storage functions of the Py3 helper. Currently bool, int, float, None, unicode, dicts, lists, datetimes etc are supported. Basically anything that can be pickled. We do our best to ensure that the resulting pickles are compatible with both python versions 2 and 3. The following helper functions are defined in the modules py3 module helper. These functions may return None if storage is not available as well as some metadata such as storage creation times- tamp _ctime and last modification timestamp _mtime. Example:

def module_function(self): # set some storage self.py3.storage_set('my_key', value) # get the value or None if key not present value= self.py3.storage_get('my_key')

5.12 Module documentation

All contributed modules should have correct documentation. This documentation is in a specific format and is used to generate user documentation. The docstring of a module is used. The format is as follows: • Single line description of the module followed by a single blank line. • Longer description of the module providing more detail.

5.11. Module data storage 161 py3status Documentation, Release 3.21

• Configuration parameters. This section describes the user settable parameters for the module. All parameters should be listed (in alphabetical order). default values should be given in parentheses eg (default 7). • Format placeholders. These are used for substituting values in format strings. All placeholders should be listed (in alphabetical order) and describe the output that they provide. • Color options. These are the color options that can be provided for this module. All color options should be listed (in alphabetical order) that the module uses. • Requires. A list of all the additional requirements for the module to work. These may be command line utilities, python libraries etc. • Example. Example configurations for the module can be given. • Author and license. Finally information on the modules author and a license can be provided. Here is an example of a docstring.

""" Single line summary

Longer description of the module. This should help users understand the modules purpose.

Configuration parameters: parameter: Explanation of this parameter (default ) parameter_other: This parameter has a longer explanation that continues onto a second line so it is indented. (default )

Format placeholders: {info} Description of the placeholder

Color options: color_meaning: what this signifies, defaults to color_good color_meaning2: what this signifies

Requires: program: Information about the program python_lib: Information on the library

Example:

``` module { parameter = "Example" parameter_other = 7 } ```

@author @license """

5.13 Deprecation of configuration parameters

Sometimes it is necessary to deprecate configuration parameters. Modules are able to specify information about deprecation so that it can be done automatically. Deprecation information is specified in the Meta class of a py3status

162 Chapter 5. Writing custom py3status modules py3status Documentation, Release 3.21 module using the deprecated attribute. The following types of deprecation are supported. The deprecation types will be performed in the order here. rename The parameter has been renamed. We will update the configuration to use the new name. class Py3status:

class Meta:

deprecated={ 'rename':[ { 'param':'format_available', # parameter name to be renamed 'new':'icon_available', # the parameter that will get the value 'msg':'obsolete parameter use `icon_available`', # message }, ], } format_fix_unnamed_param Some formats used {} as a placeholder this needs to be updated to a named placeholder eg {value}. class Py3status:

class Meta:

deprecated={ 'format_fix_unnamed_param':[ { 'param':'format', # parameter to be changed 'placeholder':'percent', # the place holder to use 'msg':'{} should not be used in format use `{percent}`', #

˓→message }, ], } rename_placeholder We can use this to rename placeholders in format strings class Py3status:

class Meta:

deprecated={ 'rename_placeholder':[ { 'placeholder':'cpu', # old placeholder name 'new':'cpu_usage', # new placeholder name 'format_strings':['format'], # config settings to update }, ], } update_placeholder_format

5.13. Deprecation of configuration parameters 163 py3status Documentation, Release 3.21

This allows us to update the format of a placeholder in format strings. The key value pairs {placeholder: format} can be supplied as a dict in placeholder_formats or the dict can be provided by function the function will be called with the current config and must return a dict. If both are supplied then placeholder_formats will be updated using the dict supplied by the function. class Py3status:

class Meta:

deprecated={ 'update_placeholder_format':[ { 'function': update_placeholder_format, # function returning dict 'placeholder_formats':{ # dict of placeholder:format 'cpu_usage':':.2f', }, 'format_strings':['format'], # config settings to update } ], } substitute_by_value This allows one configuration parameter to set the value of another. class Py3status:

class Meta:

deprecated={ 'substitute_by_value':[ { 'param':'mode', # parameter to be checked for substitution 'value':'ascii_bar', # value that will trigger the substitution 'substitute':{ 'param':'format', # parameter to be updated 'value':'{ascii_bar}', # the value that will be set }, 'msg':'obsolete parameter use `format ="{ascii_bar}"`',

˓→#message }, ], } function For more complex substitutions a function can be defined that will be called with the config as a parameter. This function must return a dict of key value pairs of parameters to update class Py3status:

class Meta:

# Create a function to be called def deprecate_function(config): # This function must return a dict return {'thresholds':[ (0,'bad'), (continues on next page)

164 Chapter 5. Writing custom py3status modules py3status Documentation, Release 3.21

(continued from previous page) (config.get('threshold_bad', 20),'degraded'), (config.get('threshold_degraded', 50),'good'), ], }

deprecated={ 'function':[ { 'function': deprecate_function, # function to be called }, ], }

remove The parameters will be removed.

class Py3status:

class Meta:

deprecated={ 'remove':[ { 'param':'threshold_bad', # name of parameter to remove 'msg':'obsolete set using thresholds parameter', #message }, ], }

5.14 Updating of configuration parameters

Sometimes it is necessary to update configuration parameters. Modules are able to specify information about updates so that it can be done automatically. Config updating information is specified in the Meta class of a py3status module using the update_config attribute. The following types of updates are supported. update_placeholder_format This allows us to update the format of a placeholder in format strings. The key value pairs {placeholder: format} can be supplied as a dict in placeholder_formats or the dict can be provided by function the function will be called with the current config and must return a dict. If both are supplied then placeholder_formats will be updated using the dict supplied by the function. This is similar to the deprecation method but is to allow default formatting of placeholders to be set. In a module like sysdata we have placeholders eg {cpu_usage} this ends up having a value something like 20. 542317173377157 which is strange as the value to use but gives the user the ability to have as much precision as they want. A module writer may decide that they want this displayed as 20.54 so {cpu_usage:.2f} would do this. Having a default format containing that just looks long/silly and the user setting a custom format just wants to do format = 'CPU: {cpu_usage}%' and get expected results ie not the full precision. If they don’t like the default formatting of the number they could still do format = ‘CPU: {cpu_usage:d}%’ etc. So using this allows sensible defaults formatting and allows simple placeholders for user configurations.

5.14. Updating of configuration parameters 165 py3status Documentation, Release 3.21

class Py3status:

class Meta:

update_config={ 'update_placeholder_format':[ { 'placeholder_formats':{ # dict of placeholder:format 'cpu_usage':':.2f', }, 'format_strings':['format'], # config settings to update } ], }

5.15 Module testing

Each module should be able to run independently for testing purposes. This is simply done by adding the following code to the bottom of your module. if __name__ =="__main__": """ Run module in test mode. """ from py3status.module_test import module_test module_test(Py3status)

If a specific config should be provided for the module test, this can be done as follows. if __name__ =="__main__": """ Run module in test mode. """ config={ 'always_show': True, } from py3status.module_test import module_test module_test(Py3status, config=config)

Such modules can then be tested independently by running python /path/to/module.py.

$ python loadavg.py [{'full_text': 'Loadavg ', 'separator': False, 'separator_block_width':0, 'cached_until': 1538755796.0}, {'full_text': '1.87 1.73 1.87', 'color': '#9DD7FB'}] ^C

We also can produce an output similar to i3bar output in terminal with python /path/to/module.py --term.

$ python loadavg.py --term Loadavg1.411.611.82 Loadavg1.411.611.82 Loadavg1.411.611.82 ^C

166 Chapter 5. Writing custom py3status modules CHAPTER 6

py3 module helper

Py3 is a special helper object that gets injected into py3status modules, providing extra functionality. A module can access it via the self.py3 instance attribute of its py3status class.

6.1 Constants

CACHE_FOREVER Special constant that when returned for cached_until will cause the module to not update unless externally trig- gered. LOG_ERROR Show as Error LOG_INFO Show as Informational LOG_WARNING Show as Warning

6.2 Exceptions exception CommandError An error occurred running the given command. This exception provides some additional attributes error_code: The error code returned from the call output: Any output returned by the call error: Any error output returned by the call

167 py3status Documentation, Release 3.21

exception Py3Exception Base Py3 exception class. All custom Py3 exceptions derive from this class. exception RequestException A Py3.request() base exception. This will catch any of the more specific exceptions. exception RequestInvalidJSON The request has not returned valid JSON exception RequestTimeout A timeout has occurred during a request made via Py3.request(). exception RequestURLError A URL related error has occurred during a request made via Py3.request().

6.3 Methods

build_composite(format_string, param_dict=None, composites=None, attr_getter=None)

Note: deprecated in 3.3 use safe_format().

Build a composite output using a format string. Takes a format_string and treats it the same way as safe_format() but also takes a composites dict where each key/value is the name of the placeholder and either an output eg {'full_text': 'something'} or a list of outputs. check_commands(cmd_list) Checks to see if commands in list are available using which. returns the first available command. If a string is passed then that command will be checked for. command_output(command, shell=False, capture_stderr=False, localized=False) Run a command and return its output as unicode. The command can either be supplied as a sequence or string. param command command to run can be a str or list param shell if True then command is run through the shell param capture_stderr if True then STDERR is piped to STDOUT param localized if False then command is forced to use its default (English) locale A CommandError is raised if an error occurs command_run(command) Runs a command and returns the exit code. The command can either be supplied as a sequence or string. An Exception is raised if an error occurs composite_create(item) Create and return a Composite. The item may be a string, dict, list of dicts or a Composite.

168 Chapter 6. py3 module helper py3status Documentation, Release 3.21 composite_join(separator, items) Join a list of items with a separator. This is used in joining strings, responses and Composites. A Composite object will be returned. composite_update(item, update_dict, soft=False) Takes a Composite (item) if item is a type that can be converted into a Composite then this is done automatically. Updates all entries it the Composite with values from update_dict. Updates can be soft in which case existing values are not overwritten. A Composite object will be returned. error(msg, timeout=None) Raise an error for the module. param msg message to be displayed explaining the error param timeout how long before we should retry. For permanent errors py3.CACHE_FOREVER should be returned. If not supplied then the modules cache_timeout will be used. flatten_dict(d, delimiter=’-’, intermediates=False, parent_key=None) Flatten a dictionary. Values that are dictionaries are flattened using delimiter in between (eg. parent-child) Values that are lists are flattened using delimiter followed by the index (eg. parent-0) example:

{ 'fish_facts':{ 'sharks':'Most will drown if they stop moving', 'skates':'More than 200 species', }, 'fruits':['apple','peach','watermelon'], 'number': 52 }

# becomes

{ 'fish_facts-sharks':'Most will drown if they stop moving', 'fish_facts-skates':'More than 200 species', 'fruits-0':'apple', 'fruits-1':'peach', 'fruits-2':'watermelon', 'number': 52 }

# if intermediates is True then we also get unflattened elements # as well as the flattened ones.

{ 'fish_facts':{ 'sharks':'Most will drown if they stop moving', 'skates':'More than 200 species', }, 'fish_facts-sharks':'Most will drown if they stop moving', 'fish_facts-skates':'More than 200 species', (continues on next page)

6.3. Methods 169 py3status Documentation, Release 3.21

(continued from previous page) 'fruits':['apple','peach','watermelon'], 'fruits-0':'apple', 'fruits-1':'peach', 'fruits-2':'watermelon', 'number': 52 }

format_contains(format_string, names) Determines if format_string contains a placeholder string names or a list of placeholders names. names is tested against placeholders using fnmatch so the following patterns can be used:

* matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any character not in seq

This is useful because a simple test like '{placeholder}' in format_string will fail if the format string contains placeholder formatting eg '{placeholder:.2f}' format_units(value, unit=’B’, optimal=5, auto=True, si=False) Takes a value and formats it for user output, we can choose the unit to use eg B, MiB, kbits/second. This is mainly for use with bytes/bits it converts the value into a human readable form. It has various additional options but they are really only for special cases. The function returns a tuple containing the new value (this is a number so that the user can still format it if required) and a unit that is the units that we have been converted to. By supplying unit to the function we can force those units to be used eg unit=KiB would force the output to be in Kibibytes. By default we use non-si units but if the unit is si eg kB then we will switch to si units. Units can also be things like Mbit/sec. If the auto parameter is False then we use the unit provided. This only makes sense when the unit is singular eg ‘Bytes’ and we want the result in bytes and not say converted to MBytes. optimal is used to control the size of the output value. We try to provide an output value of that number of characters (including decimal point), it may also be less due to rounding. If a fixed unit is used the output may be more than this number of characters. get_color_names_list(format_string, matches=None) Returns a list of color names in format_string. param format_string Accepts a format string. param matches Filter results with a string or a list of strings. If matches is provided then it is used to filter the result using fnmatch so the following patterns can be used:

* matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any character not in seq

get_composite_string(format_string) Return a string from a Composite. get_output(module_name)

170 Chapter 6. py3 module helper py3status Documentation, Release 3.21

Return the output of the named module. This will be a list. get_placeholder_formats_list(format_string) Parses the format_string and returns a list of tuples [(placeholder, format), . . . ]. eg '{placeholder:.2f}' will give [('placeholder', ':.2f')] get_placeholders_list(format_string, matches=None) Returns a list of placeholders in format_string. If matches is provided then it is used to filter the result using fnmatch so the following patterns can be used:

* matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any character not in seq

This is useful because we just get simple placeholder without any formatting that may be applied to them eg '{placeholder:.2f}' will give ['{placeholder}'] get_wm_msg() Return the control program of the current window manager. On i3, will return “i3-msg” On sway, will return “swaymsg” i3s_config() returns the i3s_config dict. is_color(color) Tests to see if a color is defined. Because colors can be set to None in the config and we want this to be respected in an expression like. color = self.py3.COLOR_MUTED or self.py3.COLOR_BAD The color is treated as True but sometimes we want to know if the color has a value set in which case the color should count as False. This function is a helper for this second case. is_composite(item) Check if item is a Composite and return True if it is. is_gevent() Checks if gevent monkey patching is enabled or not. is_my_event(event) Checks if an event triggered belongs to the module receiving it. This is mainly for containers who will also receive events from any children they have. Returns True if the event name and instance match that of the module checking. is_python_2() True if the version of python being used is 2.x Can be helpful for fixing python 2 compatibility issues log(message, level=LOG_INFO) Log the message. The level must be one of LOG_ERROR, LOG_INFO or LOG_WARNING notify_user(msg, level=LOG_INFO, rate_limit=5, title=None, icon=None)

6.3. Methods 171 py3status Documentation, Release 3.21

Send a notification to the user. level must be ‘info’, ‘error’ or ‘warning’. rate_limit is the time period in seconds during which this message should not be repeated. icon must be an icon path or icon name. play_sound(sound_file) Plays sound_file if possible. prevent_refresh() Calling this function during the on_click() method of a module will request that the module is not refreshed after the event. By default the module is updated after the on_click event has been processed. register_function(function_name, function) Register a function for the module. The following functions can be registered content_function() Called to discover what modules a container is displaying. This is used to determine when updates need passing on to the container and also when modules can be put to sleep. the function must return a set of module names that are being displayed.

Note: This function should only be used by containers.

urgent_function(module_names) This function will be called when one of the contents of a container has changed from a non-urgent to an urgent state. It is used by the group module to switch to displaying the urgent module. module_names is a list of modules that have become urgent

Note: This function should only be used by containers. request(url, params=None, data=None, headers=None, timeout=None, auth=None, cookiejar=None, retry_times=None, retry_wait=None) Make a request to a url and retrieve the results. If the headers parameter does not provide an ‘User-Agent’ key, one will be added automatically following the conven- tion: py3status/ param url url to request eg http://example.com param params extra query string parameters as a dict param data POST data as a dict. If this is not supplied the GET method will be used param headers http headers to be added to the request as a dict param timeout timeout for the request in seconds param auth authentication info as tuple (username, password) param cookiejar an object of a CookieJar subclass param retry_times how many times to retry the request param retry_wait how long to wait between retries in seconds returns HttpResponse

172 Chapter 6. py3 module helper py3status Documentation, Release 3.21 safe_format(format_string, param_dict=None, force_composite=False, attr_getter=None) Parser for advanced formatting. Unknown placeholders will be shown in the output eg {foo}. Square brackets [] can be used. The content of them will be removed from the output if there is no valid placeholder contained within. They can also be nested. A pipe (vertical bar) | can be used to divide sections the first valid section only will be shown in the output. A backslash \ can be used to escape a character eg \[ will show [ in the output. \? is special and is used to provide extra commands to the format string, example \?color=#FF00FF. Multiple commands can be given using an ampersand & as a separator, example \?color=#FF00FF&show. \?if= can be used to check if a placeholder exists. An exclamation mark ! after the equals sign = can be used to negate the condition. \?if== can be used to determine if {} would be replaced with . [] in don’t need to be escaped. {} will be converted, or removed if it is None or empty. Formatting can also be applied to the placeholder Eg {number:03.2f}. example format_string: "[[{artist} - ]{title}]|{file}" This will show artist - title if artist is present, title if title but no artist, and file if file is present but not artist or title. param_dict is a dictionary of placeholders that will be substituted. If a placeholder is not in the dictionary then if the py3status module has an attribute with the same name then it will be used.

Note: Added in version 3.3

Composites can be included in the param_dict. The result returned from this function can either be a string in the case of simple parsing or a Composite if more complex. If force_composite parameter is True a composite will always be returned. attr_getter is a function that will when called with an attribute name as a parameter will return a value. stop_sound() Stops any currently playing sounds for this module. storage_del(key=None) Remove the value stored with the key from storage. If key is not supplied then all values for the module are removed. storage_get(key) Retrieve a value for the module. storage_items() Return key, value pairs of the stored data for the module. Keys will contain the following metadata entries: - ‘_ctime’: storage creation timestamp - ‘_mtime’: storage last modification timestamp storage_keys()

6.3. Methods 173 py3status Documentation, Release 3.21

Return a list of the keys for values stored for the module. Keys will contain the following metadata entries: - ‘_ctime’: storage creation timestamp - ‘_mtime’: storage last modification timestamp storage_set(key, value) Store a value for the module. threshold_get_color(value, name=None) Obtain color for a value using thresholds. The value will be checked against any defined thresholds. These should have been set in the i3status configuration. If more than one threshold is needed for a module then the name can also be supplied. If the user has not supplied a named threshold but has defined a general one that will be used. If the gradients config parameter is True then rather than sharp thresholds we will use a gradient between the color values. param value numerical value to be graded param name accepts a string, otherwise ‘threshold’ accepts 3-tuples to allow name with different values eg (‘name’, ‘key’, ‘thresholds’) time_in(seconds=None, sync_to=None, offset=0) Returns the time a given number of seconds into the future. Helpful for creating the cached_until value for the module output.

Note: from version 3.1 modules no longer need to explicitly set a cached_until in their response unless they wish to directly control it.

param seconds specifies the number of seconds that should occur before the update is required. Passing a value of CACHE_FOREVER returns CACHE_FOREVER which can be useful for some modules. param sync_to causes the update to be synchronized to a time period. 1 would cause the update on the second, 60 to the nearest minute. By default we synchronize to the nearest second. 0 will disable this feature. param offset is used to alter the base time used. A timer that started at a certain time could set that as the offset and any synchronization would then be relative to that time. trigger_event(module_name, event) Trigger an event on a named module. update(module_name=None) Update a module. If module_name is supplied the module of that name is updated. Otherwise the module calling is updated. update_placeholder_formats(format_string, formats) Update a format string adding formats if they are not already present. This is useful when for example a placeholder has a floating point value but by default we only want to show it to a certain precision.

174 Chapter 6. py3 module helper CHAPTER 7

Developing and Contributing

Contributions to py3status including documentation, the core code, or for new or existing modules are very welcome. Please read carefully the Zen of py3status describing the minimal things to keep in mind when contributing or partici- pating to this project. Feel free to open an issue to propose your ideas as request for comments [RFC] and to join us on IRC Freenode #py3status channel for a live chat.

7.1 Zen of py3status

7.1.1 efficient and simple defaults

We like py3status because it’s a drop-in replacement of i3status. i3 users don’t expect fancy and magical things, they use i3 because it’s simple and efficient. Keep configuration options and default formats as simple as possible

7.1.2 it’s not because you can that you should

On modules, expose things that you WILL use, not things that you COULD use. On core, make features and options as seamless as possible (lazy loading) with sane defaults and no mandatory requirements.

7.1.3 good enough is good enough

Strive for and accept “good enough” features / proposals. We shall refrain from refining indefinitely.

7.1.4 one feature/idea at a time

Trust and foster iteration with your peers by refraining from digressions. Keep discussions focused on the initial topic and easy to get into. Proposals should not contain multiple features or corrections at once.

175 py3status Documentation, Release 3.21

7.1.5 modules are responsible for user information and interactions

That is what’s written in the bar and its behavior on clicks etc.

7.1.6 core is responsible for user experience

Core features and configuration options should focus on user experience. Things that are related to the general output of the bar are handled by core. Smart things overlaying modules (such as standardized options) should also end up in the core.

7.1.7 rely on i3status color scheme

No fancy colors by default, only i3status good/degraded/bad. If we want to provide enhanced coloring, this should be through a core feature such as thresholds.

7.1.8 rely on the i3bar protocol

what’s possible with it, we should support and offer.

7.2 What you will need

• python3/python2 • i3status – https://i3wm.org/i3status/ – https://github.com/i3/i3status • pytest pytest-flake8 – https://pypi.python.org/pypi/pytest – https://pypi.python.org/pypi/pytest-flake8 • black – https://pypi.org/project/black/ • tox – https://pypi.org/project/tox/

7.3 Setting up a development environment

First clone the git repository

# using https git clone https://github.com/ultrabug/py3status.git

# using ssh (needs github account) git clone [email protected]:ultrabug/py3status.git

Run setup.py to install

176 Chapter 7. Developing and Contributing py3status Documentation, Release 3.21

# cd to the directory containing setup.py cd py3status

# install you may need to use sudo to have required permissions python setup.py develop

you can now run py3status and any changes to the code you make will be available after a reload.

Note: py3status will only be installed for the version of python that you used to run setup.py. To run against a different version of python You should repeat the above step eg python2.7 setup.py develop. If you wish to have multiple versions available. First run setup.py develop using the required python versions. Next copy the executable eg sudo cp /usr/bin/py3status /usr/bin/py3status2 Then edit the hash- bang to point to your chosen python version.

7.4 Python versions

py3status code, including modules, should run under both python 2 and python 3. Starting with version 4.0, py3status will only run using python 3.

7.5 tox

Py3status uses tox for testing. All submissions to the project must pass testing. To install these via pip use

pip install pytest pip install pytest-flake8 pip install tox pip install black # needs python 3.6+

The tests can be run by using tox in the py3status root directory. Tests are kept in the tests directory.

7.6 Travis CI

When you create your Pull Request, some checks from Travis CI will automatically run; you can see previous builds if you want to. If something fails in the CI: • Take a look the build log • If you don’t get what is failing or why it is failing, feel free to tell it as a comment in your PR: people here are helpful and open-minded :) • Once the problem is identified and fixed, rebase your commit with the fix and push it on your fork to trigger the CI again For reference, you can take a look at this PR; you won’t see the old failed CI runs, but you’ll get an idea of the PR flow.

7.4. Python versions 177 py3status Documentation, Release 3.21

7.7 Coding in containers

Warning, by default (at least on Archlinux), i3status has cap_net_admin capabilities, which will make it fail with operation not permitted when running inside a Docker container.

$ getcap`which i3status` /usr/sbin/i3status= cap_net_admin+ep

To allow it to run without these capabilities (hence disabling some of the functionalities), remove it with: setcap -r`which i3status`

7.8 Building documentation

Py3status documentation is build using sphinx. The requirements needed to build the documentation are in doc/ doc-requirements.txt make sure you have them installed. To build the documentation.

# cd to the doc directory cd doc

# build documentation make html

The created documentation will be found in _build/html

7.9 Profiling py3status

A small tool to measure py3status performance between changes and allows testing of old versions, etc. It’s a little clunky but it does the job. https://github.com/tobes/py3status-profiler

# pprofile Running tests for 10 minutes. [] 100.00% 10:00 (22.12) user 21.41s system 0.71s total 22.12s

# vmprof Running tests for 10 minutes. [] 100.00% 10:00 (2.10) user 1.77s system 0.33s total 2.1s

# cprofile Running tests for 10 minutes. [] 100.00% 10:00 (0.92) user 0.87s system 0.05s total 0.92

178 Chapter 7. Developing and Contributing py3status Documentation, Release 3.21

7.10 Contributions

To make a contribution please create a pull request. Any functional change should be done via pull requests, even by people with push access. Each PR requires at least one approval from project maintainers before a PR can be merged.

7.10. Contributions 179 py3status Documentation, Release 3.21

180 Chapter 7. Developing and Contributing Index

B L build_composite() (built-in function), 168 log() (built-in function), 171 LOG_ERROR, 167 C LOG_INFO, 167 CACHE_FOREVER, 167 LOG_WARNING, 167 check_commands() (built-in function), 168 command_output() (built-in function), 168 N command_run() (built-in function), 168 notify_user() (built-in function), 171 CommandError, 167 composite_create() (built-in function), 168 P composite_join() (built-in function), 168 play_sound() (built-in function), 172 composite_update() (built-in function), 169 prevent_refresh() (built-in function), 172 content_function() (built-in function), 172 Py3Exception, 167 E R error() (built-in function), 169 register_function() (built-in function), 172 request() (built-in function), 172 F RequestException, 168 flatten_dict() (built-in function), 169 RequestInvalidJSON, 168 format_contains() (built-in function), 170 RequestTimeout, 168 format_units() (built-in function), 170 RequestURLError, 168 G S get_color_names_list() (built-in function), 170 safe_format() (built-in function), 173 get_composite_string() (built-in function), 170 stop_sound() (built-in function), 173 get_output() (built-in function), 170 storage_del() (built-in function), 173 get_placeholder_formats_list() (built-in storage_get() (built-in function), 173 function), 171 storage_items() (built-in function), 173 get_placeholders_list() (built-in function), storage_keys() (built-in function), 173 171 storage_set() (built-in function), 174 get_wm_msg() (built-in function), 171 T I threshold_get_color() (built-in function), 174 i3s_config() (built-in function), 171 time_in() (built-in function), 174 is_color() (built-in function), 171 trigger_event() (built-in function), 174 is_composite() (built-in function), 171 is_gevent() (built-in function), 171 U is_my_event() (built-in function), 171 update() (built-in function), 174 is_python_2() (built-in function), 171

181 py3status Documentation, Release 3.21 update_placeholder_formats() (built-in func- tion), 174 urgent_function() (built-in function), 172

182 Index