diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index 55db11f..021e1eb 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -11,7 +11,7 @@ def description(): return "Displays battery status, percentage and whether it's charging or discharging." class Module(bumblebee.module.Module): - def __init__(self, args): + def __init__(self, output, args): super(Module, self).__init__(args) self._battery = "BAT0" if not args else args[0] self._capacity = 0 diff --git a/bumblebee/modules/cpu.py b/bumblebee/modules/cpu.py index 7de26db..cb7cd7f 100644 --- a/bumblebee/modules/cpu.py +++ b/bumblebee/modules/cpu.py @@ -11,7 +11,7 @@ def description(): return "Displays CPU utilization across all CPUs." class Module(bumblebee.module.Module): - def __init__(self, args): + def __init__(self, output, args): super(Module, self).__init__(args) self._perc = psutil.cpu_percent(percpu=False) diff --git a/bumblebee/modules/disk.py b/bumblebee/modules/disk.py index cbe0a36..eea8e8f 100644 --- a/bumblebee/modules/disk.py +++ b/bumblebee/modules/disk.py @@ -12,10 +12,13 @@ def description(): return "Shows free diskspace, total diskspace and the percentage of free disk space." class Module(bumblebee.module.Module): - def __init__(self, args): + def __init__(self, output, args): super(Module, self).__init__(args) self._path = args[0] if args else "/" + output.add_callback(module=self.__module__, + button=1, cmd="nautilus {instance}") + def data(self): st = os.statvfs(self._path) diff --git a/bumblebee/modules/dnf.py b/bumblebee/modules/dnf.py index 7521c0c..be62596 100644 --- a/bumblebee/modules/dnf.py +++ b/bumblebee/modules/dnf.py @@ -50,7 +50,7 @@ def get_dnf_info(obj): class Module(bumblebee.module.Module): - def __init__(self, args): + def __init__(self, output, args): super(Module, self).__init__(args) self._interval = args[0] if args else 30*60 self._counter = {} diff --git a/bumblebee/modules/memory.py b/bumblebee/modules/memory.py index 0e72fce..b338211 100644 --- a/bumblebee/modules/memory.py +++ b/bumblebee/modules/memory.py @@ -12,7 +12,7 @@ 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): + def __init__(self, output, args): super(Module, self).__init__(args) self._mem = psutil.virtual_memory() diff --git a/bumblebee/modules/nic.py b/bumblebee/modules/nic.py index fdca861..e04fd6d 100644 --- a/bumblebee/modules/nic.py +++ b/bumblebee/modules/nic.py @@ -12,7 +12,7 @@ def description(): return "Displays the names, IP addresses and status of each available interface." class Module(bumblebee.module.Module): - def __init__(self, args): + def __init__(self, output, args): super(Module, self).__init__(args) self._exclude = ( "lo", "virbr" ) self._interfaces = [ i for i in netifaces.interfaces() if not i.startswith(self._exclude) ] diff --git a/bumblebee/modules/pulseaudio.py b/bumblebee/modules/pulseaudio.py index 7f71ae5..fe4e26a 100644 --- a/bumblebee/modules/pulseaudio.py +++ b/bumblebee/modules/pulseaudio.py @@ -26,7 +26,7 @@ def description(): return "See 'pasource'." class Module(bumblebee.module.Module): - def __init__(self, args): + def __init__(self, output, args): super(Module, self).__init__(args) self._module = self.__module__.split(".")[-1] diff --git a/bumblebee/modules/spacer.py b/bumblebee/modules/spacer.py index fa94c5e..189939d 100644 --- a/bumblebee/modules/spacer.py +++ b/bumblebee/modules/spacer.py @@ -11,7 +11,7 @@ def description(): return "Draws an empty field." class Module(bumblebee.module.Module): - def __init__(self, args): + def __init__(self, output, args): super(Module, self).__init__(args) def data(self): diff --git a/bumblebee/modules/time.py b/bumblebee/modules/time.py index 10f9039..48b8916 100644 --- a/bumblebee/modules/time.py +++ b/bumblebee/modules/time.py @@ -18,7 +18,7 @@ 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): + def __init__(self, output, args): super(Module, self).__init__(args) module = self.__module__.split(".")[-1] diff --git a/bumblebee/output.py b/bumblebee/output.py index 743b08f..af542e6 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -5,6 +5,8 @@ class Output(object): self._callbacks = {} def add_callback(self, cmd, button, module=None): + if module: + module = module.replace("bumblebee.modules.", "") self._callbacks[( button, module, diff --git a/i3bumblebee b/i3bumblebee index 8a01a65..7070fc0 100755 --- a/i3bumblebee +++ b/i3bumblebee @@ -42,8 +42,8 @@ def print_theme_list(): def main(): parser = argparse.ArgumentParser(description="display system data in the i3bar") - parser.add_argument("-m", "--modules", nargs="+", help="List of modules to load. The order of the list determines their order in the i3bar (from left to right)") - parser.add_argument("-e", "--events", nargs="+", help="List of click events that should be handled. Format is: