Skip to main content

mmtools

Project description

mmtools - i3 status bar and notification script for Mattermost

mmtools are various tools using the mattermost API.

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 same as mmstatus, but with output for waybar.

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 user

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, execute:

pip3 install -e .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmtools-0.0.24-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file mmtools-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: mmtools-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for mmtools-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 6eb440e35d646e85cd4bfd5d1abe81f027398fde0fa6a817b895a0d34c51b5ae
MD5 28051bf2e7b8472ded67be4c288ccea5
BLAKE2b-256 86374b68c8c39d68cb48383cf4fce61a94cc15d3becb0ea1ce403d9f1f2968f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page