Coverage for src/system/notify.py: 100.00%
13 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-10-18 15:02 +0000
« prev ^ index » next coverage.py v7.15.4, created at 2026-10-18 15:02 +0000
1#!/usr/bin/env python3
3# Standard libraries
4from os import environ
5from subprocess import CalledProcessError, check_output, DEVNULL
7# Components
8from ..package.bundle import Bundle
10# Notify class, pylint: disable=too-few-public-methods
11class Notify:
13 # Members
14 __binary: str = 'notify-send'
16 # Constructor
17 def __init__(self) -> None:
19 # Configure binary
20 if environ.get(Bundle.ENV_NOTIFY_BINARY_PATH, ''):
21 self.__binary = environ[Bundle.ENV_NOTIFY_BINARY_PATH]
23 # Notify
24 def notify(self, message: str) -> None:
26 # Result
27 try:
28 check_output(
29 [self.__binary, message],
30 shell=False,
31 stderr=DEVNULL,
32 )
33 except (CalledProcessError, FileNotFoundError):
34 pass