diff --git a/docs/changelog.rst b/docs/changelog.rst index 11e56a1..aa7a1f3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -26,6 +26,7 @@ master branch * Server used for checking internet connectivity is now an option (``internet_check`` of :py:class:`.Status`) * Added double click support for click events * Formatter data is now available with most modules for program callbacks +* Changed default mode to standalone mode * ``self`` is not passed anymore by default to external Python callbacks (see :py:func:`.get_module`) * :py:mod:`.dota2wins`: Now accepts usernames in place of a Steam ID * dota2wins: Changed win percentage to be a float diff --git a/docs/configuration.rst b/docs/configuration.rst index 0247b8c..eefe795 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -13,7 +13,7 @@ example): from i3pystatus import Status - status = Status(standalone=True) + status = Status() # Displays clock like this: # Tue 30 Jul 11:59:46 PM KW31 @@ -470,9 +470,10 @@ Or make two modules look like one. Refreshing the bar ------------------ -The whole bar can be refreshed by sending SIGUSR1 signal to i3pystatus process. -This feature is available only in standalone operation (:py:class:`.Status` was -created with ``standalone=True`` parameter). +The whole bar can be refreshed by sending SIGUSR1 signal to i3pystatus +process. This feature is not available in chained mode +(:py:class:`.Status` was created with ``standalone=False`` parameter +and gets it's input from ``i3status`` or a similar program). To find the PID of the i3pystatus process look for the ``status_command`` you use in your i3 config file. diff --git a/i3pystatus/__init__.py b/i3pystatus/__init__.py index 15effd2..e6c4ac8 100644 --- a/i3pystatus/__init__.py +++ b/i3pystatus/__init__.py @@ -28,6 +28,6 @@ logger.setLevel(logging.CRITICAL) def main(): from i3pystatus.clock import Clock - status = Status(standalone=True) + status = Status() status.register(Clock()) status.run() diff --git a/i3pystatus/core/__init__.py b/i3pystatus/core/__init__.py index c560084..16e3bd3 100644 --- a/i3pystatus/core/__init__.py +++ b/i3pystatus/core/__init__.py @@ -48,20 +48,20 @@ class Status: :param tuple internet_check: Address of server that will be used to check for internet connection by :py:class:`.internet`. """ - def __init__(self, standalone=False, **kwargs): + def __init__(self, standalone=True, click_events=True, interval=1, + input_stream=None, logfile=None, internet_check=None): self.standalone = standalone - self.click_events = kwargs.get("click_events", True if standalone else False) - interval = kwargs.get("interval", 1) - input_stream = kwargs.get("input_stream", sys.stdin) - if "logfile" in kwargs: + self.click_events = standalone and click_events + input_stream = input_stream or sys.stdin + if logfile: logger = logging.getLogger("i3pystatus") for handler in logger.handlers: logger.removeHandler(handler) - handler = logging.FileHandler(kwargs["logfile"], delay=True) + handler = logging.FileHandler(logfile, delay=True) logger.addHandler(handler) logger.setLevel(logging.CRITICAL) - if "internet_check" in kwargs: - util.internet.address = kwargs["internet_check"] + if internet_check: + util.internet.address = internet_check self.modules = util.ModuleList(self, ClassFinder(Module)) if self.standalone: diff --git a/i3pystatus/updates/__init__.py b/i3pystatus/updates/__init__.py index de45265..e0d1a69 100644 --- a/i3pystatus/updates/__init__.py +++ b/i3pystatus/updates/__init__.py @@ -33,7 +33,7 @@ class Updates(Module): from i3pystatus import Status from i3pystatus.updates import pacman, cower - status = Status(standalone=True) + status = Status() status.register("updates", format = "Updates: {count}",