Skip to main content

mmtools - i3 status bar and notification script for Mattermost

mmtools are various tools using the mattermost API.

Changelog

1.0.0

Breaking change for mmwaybar: it now stays running and listens for Mattermost websocket events, writing updated JSON status lines as the unread status changes. Integrations that expect mmwaybar to exit after a single status check must be updated to handle the long-running process.

Installation

sudo pip3 install mmtools

This will install mmtols from pypi, including the following required packages:

  • caep
  • pydantic
  • mattermostdriver
  • passpy
  • notify2
  • dbus-python
  • requests

For dbus-python to build, you need to have the libdbus-1-dev package installed. On debian you can do

sudo apt install libdbus-1-dev

Tools

The following tools are included:

mmstatus

mmstatus connects to the mattermost API to get unread messages in all channels. It then outputs a statusbar (usable in i3blocks) of unread messages and exits. Supports private/public/user channels and different coloring on group chats and user chats.

Example configuration for i3blocks:

[mattermost]
command=/usr/local/bin/mmstatus
separator=true
interval=60
signal=12

mmpolybar

mmpolybar same as mmstatus, but with polybar colors.

Example configuration for polybar:

[module/mmpolybar]
type = custom/script
exec = mmpolybar
tail = true

mmwaybar

mmwaybar outputs the initial unread status and then listens for Mattermost websocket events, writing a new JSON line whenever messages or channel views can change the unread status.

Example configuration for waybar:

"custom/mattermost": {
    "exec": "mmwaybar",
    "return-type": "json"
}

mmwatch

mmwatch connects to the mattermost websocket API and can display notification on messages and send SIGUSR2 to i3blocks to update statusbar before next interval.

Configuration

All tools can be configured using both command line arguments and a configuration file.

mmtools will first look for a configuration in ~/.config/mmtools/config-<HOSTNAME> with fallback to ~/.config/mmtools/config.

Use the following command to create the configuration ~/.config/mmtools/config. The same configuration file is used for both tools.

mmconfig init

In this file you must specify at least:

# Mattermost server
server = <SERVER>

# Mattermost user
user = <USERNAME>

# either password
password = <MATTERMOST PASSWORD>

# OR pass entry (https://www.passwordstore.org)
password-pass-entry = <PASS ENTRY>

User service for mmwatch

mmwatch can be started as a systemd user service by creating the following file:

.config/systemd/user/mmwatch.service

with this content:

[Unit]
Description=mm watch

[Service]
ExecStart=/usr/local/bin/mmwatch

Restart=always

# time to sleep before restarting a service
RestartSec=30

[Install]
WantedBy=default.target

Enable at login

systemctl --user enable mmwatch

Start manually

systemctl --user start mmwatch

Local development

For local development, se uv.

Release files for mmtools 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mmtools 1.0.0
File Interpreter ABI Platform
mmtools-1.0.0-py3-none-any.whl Python 3 none any Details

Release files / mmtools-1.0.0-py3-none-any.whl

Download URL mmtools-1.0.0-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ecce289d5abbd702ab467c14b0e9ef089925410e2dd43aa6ff98ad004b60c79
BLAKE2b-256 checksum
How to use checksums
45f9ca01cf47ae56961f889b52cb5c9e87a283694886cc2fb2b80e806cbadef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

0.0.39

1 release file

0.0.38

1 release file

0.0.37

1 release file

0.0.36

1 release file

0.0.35

1 release file

0.0.34

1 release file

0.0.33

1 release file

0.0.32

1 release file

0.0.31

1 release file

0.0.30

1 release file

0.0.29

1 release file

0.0.28

1 release file

0.0.27

1 release file

0.0.26

1 release file

0.0.25

1 release file

0.0.24

1 release file

0.0.23

1 release file

0.0.22

1 release file

0.0.21

1 release file

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page