Skip to main content

1 cmus-notify

https://github.com/AntoineGagne/cmus-notify/actions/workflows/check.yaml/badge.svg?branch=master https://img.shields.io/pypi/v/cmus-notify.svg
Author:

Antoine Gagné

1.1 Requirements

To install this program, you must have the following:

  • python 3.9+

1.2 Installation

To install this program, you can simply run the following command:

python setup.py install

This program can also be found on Pypi which means you can install it by downloading the wheel or by using the following command:

pip install cmus-notify

You can check if it installed correctly by doing the following command:

cmus_notify -h

It should display a message.

1.3 Hooking To Cmus

To hook this program to cmus, you have to create a shell script that have the following lines in it:

#! /bin/sh

cmus_notify "$*" &

Then, you must make the file executable by using the following command (assuming your script’s name is cmus_notify.sh):

chmod +x cmus_notify.sh

Finally, once you are in cmus, you can add the hook by using the following command:

:set status_display_program=<path-to-the-shell-script>

1.4 Customization

If you want you can specify the formatting of the notification by specifying format strings. For example:

#! /bin/sh

cmus_notify --title "Now playing: {title} by {artist}" --body "$(printf "<b>Album:</b> {album}\n<b>Duration:</b> {duration}")" "$*"

You can also specify a configuration to read these values from. By default, the program will search for a configuration file named ~/.cmus-notify. It has the following format:

[notifications]
    application_name = Cmus
    custom_notification = /home/user/.cmus/custom_notification.py

[format]
    title = Now playing: {title} by {artist}
    body = <b>Album:</b> {album}
           <b>Duration:</b> {duration}

The options accepts the same values as their command-line options equivalent.

1.5 Options

To view the full options, you can run the following command:

cmus_notify --help

which will display the following prompt:

usage: cmus_notify [-h] [-a APPLICATION_NAME] [-b BODY_FORMAT_STRING]
                   [-t TITLE_FORMAT_STRING] [-f CONFIGURATION_FILE]
                   [-c CUSTOM_NOTIFICATION]
                   INFORMATION

Display a notification about Cmus's current status

positional arguments:
  INFORMATION           Parse the given information

optional arguments:
  -h, --help            show this help message and exit
  -a APPLICATION_NAME, --application_name APPLICATION_NAME
                        The name of the application
  -b BODY_FORMAT_STRING, --body BODY_FORMAT_STRING
                        A format string that can be specified to tell the
                        software how to format the body. The syntax is the
                        same as Python's. The available options are specified
                        at the end of this help message. (i.e. 'Artist:
                        {artist}')
  -t TITLE_FORMAT_STRING, --title TITLE_FORMAT_STRING
                        A format string that can be specified to tell the
                        software how to format the title. The syntax is the
                        same as Python's. The available options are specified
                        at the end of this help message. (i.e. 'Now playing:
                        {title}')
  -f CONFIGURATION_FILE, --configuration_file CONFIGURATION_FILE
                        The path to the configuration file. If it is not
                        specified, the program will use the default values of
                        the other options.
  -c CUSTOM_NOTIFICATION, --custom_notification CUSTOM_NOTIFICATION
                        The path to a custom implementation of the
                        notification class. If it is not specified, the
                        standard implementation will be used (the one using
                        notify2).

Format String Parameters
========================

The available arguments to the format strings are the following:

  - album: The song's album
  - albumartist: The song's album's artist
  - artist: The song's artist
  - date: The song's release date
  - discnumber: The song's disc's number
  - duration: The song's duration
  - file: The song's file's path
  - status: Cmus current status
  - title: The song's title
  - tracknumber: The song's track number

1.6 Documentation

The project’s documentation can be found here.

Metadata

Release files for cmus-notify 1.4.2

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

Source distribution (sdist)

Source distribution for cmus-notify 1.4.2
File Size Uploaded
cmus_notify-1.4.2.tar.gz 26.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmus-notify 1.4.2
File Interpreter ABI Platform
cmus_notify-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.9 kB

Release files / cmus_notify-1.4.2.tar.gz

Download URL cmus_notify-1.4.2.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
800003dbdf2d9b1688883bec57e259a180c3095d2dc9fb79b7b764ccfdd8a199
BLAKE2b-256 checksum
How to use checksums
f9eb1c4f622811d0338f4c9bfed24c3dd0991ffd0496232a88ddd05bc8153e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / cmus_notify-1.4.2-py3-none-any.whl

Download URL cmus_notify-1.4.2-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f8ea9942bada4389450e446f7f472f0bd30db81369334ff43d2512b7d2fb9a5
BLAKE2b-256 checksum
How to use checksums
6d0528aefb6578295ae419b554448a81a8e5e8a533db9b57c9578470e528bde4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.4.2 This release

2 release files

1.4.1

1 release file

1.4.0

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.2.2

3 release files

1.2.0

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