From c0421163d421256f40e48ea17e25dad561e96122 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Mon, 31 Oct 2016 16:08:03 +0100 Subject: [PATCH] [doc] Add description, usage and notes to all modules --- bumblebee/modules/battery.py | 6 +++--- bumblebee/modules/cpu.py | 9 +++++++++ bumblebee/modules/disk.py | 9 +++++++++ bumblebee/modules/dnf.py | 9 +++++++++ bumblebee/modules/memory.py | 9 +++++++++ bumblebee/modules/nic.py | 9 +++++++++ bumblebee/modules/pulseaudio.py | 20 ++++++++++++++++++++ bumblebee/modules/spacer.py | 9 +++++++++ bumblebee/modules/time.py | 14 ++++++++++++++ i3bumblebee | 1 + 10 files changed, 92 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index 2b27d97..55db11f 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -2,13 +2,13 @@ import datetime import bumblebee.module def usage(): - return "battery::" + return "battery or battery::" def notes(): - return "Reads /sys/class/power_supply//[capacity|status]" + return "Reads /sys/class/power_supply//[capacity|status]. Warning is at 20% remaining charge, Critical at 10%." def description(): - return "Displays battery status, percentage and whether it's charging or discharging" + return "Displays battery status, percentage and whether it's charging or discharging." class Module(bumblebee.module.Module): def __init__(self, args): diff --git a/bumblebee/modules/cpu.py b/bumblebee/modules/cpu.py index ce9daa6..7de26db 100644 --- a/bumblebee/modules/cpu.py +++ b/bumblebee/modules/cpu.py @@ -1,6 +1,15 @@ import bumblebee.module import psutil +def usage(): + return "cpu" + +def notes(): + return "Warning is at 70%, Critical at 80%." + +def description(): + return "Displays CPU utilization across all CPUs." + class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) diff --git a/bumblebee/modules/disk.py b/bumblebee/modules/disk.py index 5f4739a..9f98f91 100644 --- a/bumblebee/modules/disk.py +++ b/bumblebee/modules/disk.py @@ -2,6 +2,15 @@ import os import bumblebee.util import bumblebee.module +def usage(): + return "disk or disk::" + +def notes(): + return "Warning is at 20% free diskspace, Critical at 10%." + +def description(): + return "Shows free diskspace, total diskspace and the percentage of free disk space." + class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) diff --git a/bumblebee/modules/dnf.py b/bumblebee/modules/dnf.py index 58aea4c..7521c0c 100644 --- a/bumblebee/modules/dnf.py +++ b/bumblebee/modules/dnf.py @@ -6,6 +6,15 @@ import subprocess import bumblebee.module import bumblebee.util +def usage(): + return "dnf or dnf::" + +def notes(): + return "Spawns a separate thread that invokes 'dnf updateinfo' every seconds. Critical status is if there is either more than 50 updates pending, or at least one of them is a security update." + +def description(): + return "Checks DNF for updated packages and displays the number of /// pending updates." + def get_dnf_info(obj): while True: try: diff --git a/bumblebee/modules/memory.py b/bumblebee/modules/memory.py index 89f96a1..0e72fce 100644 --- a/bumblebee/modules/memory.py +++ b/bumblebee/modules/memory.py @@ -2,6 +2,15 @@ import psutil import bumblebee.module import bumblebee.util +def usage(): + return "memory" + +def notes(): + return "Warning is at 20% available RAM, Critical at 10%." + +def description(): + return "Shows available RAM, total amount of RAM and the percentage of available RAM." + class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) diff --git a/bumblebee/modules/nic.py b/bumblebee/modules/nic.py index f5b341c..e93688f 100644 --- a/bumblebee/modules/nic.py +++ b/bumblebee/modules/nic.py @@ -2,6 +2,15 @@ import pyroute2 import netifaces import bumblebee.module +def usage(): + return "nic" + +def notes(): + return "Interfaces starting with 'lo' or 'virbr' are ignored. Critical if the status of an interface is 'down', Warning if it is anything else but 'up'. Interface status is derived from whether an IP address is available or not." + +def description(): + return "Displays the names, IP addresses and status of each available interface." + class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) diff --git a/bumblebee/modules/pulseaudio.py b/bumblebee/modules/pulseaudio.py index bdcc173..7f71ae5 100644 --- a/bumblebee/modules/pulseaudio.py +++ b/bumblebee/modules/pulseaudio.py @@ -5,6 +5,26 @@ import subprocess import bumblebee.module import bumblebee.util +def usage(): + module = __name__.split(".")[-1] + if module == "pasource": + return "pasource" + if module == "pasink": + return "pasink" + return "pulseaudio" + +def notes(): + return "Invokes 'pactl' to retrieve information." + pass + +def description(): + module = __name__.split(".")[-1] + if module == "pasink": + return "Shows volume and mute status of the default PulseAudio Sink." + if module == "pasource": + return "Shows volume and mute status of the default PulseAudio Source." + return "See 'pasource'." + class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) diff --git a/bumblebee/modules/spacer.py b/bumblebee/modules/spacer.py index 06fc948..fa94c5e 100644 --- a/bumblebee/modules/spacer.py +++ b/bumblebee/modules/spacer.py @@ -1,6 +1,15 @@ import bumblebee.module import bumblebee.util +def usage(): + return "spacer" + +def notes(): + return "none" + +def description(): + return "Draws an empty field." + class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) diff --git a/bumblebee/modules/time.py b/bumblebee/modules/time.py index a436c29..10f9039 100644 --- a/bumblebee/modules/time.py +++ b/bumblebee/modules/time.py @@ -3,6 +3,20 @@ from __future__ import absolute_import import datetime import bumblebee.module +def usage(): + module = __name__.split(".")[-1] + if module == "date": + return "date::" + if module == "time": + return "time::" + return "datetime::" + +def notes(): + return "none" + +def description(): + return "Displays the current time, using the optional format string as input for strftime." + class Module(bumblebee.module.Module): def __init__(self, args): super(Module, self).__init__(args) diff --git a/i3bumblebee b/i3bumblebee index 5ddd88d..1545208 100755 --- a/i3bumblebee +++ b/i3bumblebee @@ -25,6 +25,7 @@ def print_module_list(): print textwrap.fill("Description: {}".format(desc), 80, initial_indent=" ", subsequent_indent=" ") print textwrap.fill("Usage : {}".format(usage), 80, initial_indent=" ", subsequent_indent=" ") print textwrap.fill("Notes : {}".format(notes), 80, initial_indent=" ", subsequent_indent=" ") + print "\n" def main(): parser = argparse.ArgumentParser(description="display system data in the i3bar")