Commit graph

71 commits

Author SHA1 Message Date
Tobias Witek
ef7cbd5c2e [core] Add alias test 2019-09-09 21:03:05 +02:00
Tobias Witek
c09ce71fce [core] Replace aliases logic with simple dict
Since aliases are so rarely used, just hardcode the list of aliases
inside the engine for now.

This combines the advantage of the speedup of the previous
implementation with the robustness of the first implementation. As
trade-off, extensibility suffers, but given the small number of aliases,
that's OK for now.

fixes #437
2019-09-09 20:17:03 +02:00
adario7
56c3b77d0e
put back the method all_modules
even if no longer used by `_read_aliases` it is still needed in other parts of the program.
2019-09-03 14:24:02 +02:00
adario
b956e8e2a6 find aliases without importing modules 2019-08-28 19:08:42 +02:00
adario7
574735adab performance improves to module 'title' 2019-08-24 15:01:40 +02:00
Tobias Witek
eb72d59ed1 [core] Each module can now access theme data
Add a method "theme()" to the generic module to have access to the theme
information.

Specifically, "theme().get(widget, attribute, default_value)" can be
used to retrieve theming for a widget with an arbitrary attribute.

This is in response to #412 - thanks to @bbernhard for the suggestion!
2019-08-01 20:41:13 +02:00
Tobias Witek
1359f1000f [engine] Nicer handling of module exceptions
Do not throw exceptions during exception handling, that causes really
hard-to-interpret error messages.

Instead, log a message and throw outside the exception handler (the code
could do with some cleanup, but is localized enough for now).

see #367
2019-03-01 21:02:51 +01:00
Tobias Witek
47eeac00a0 Revert "Merge branch 'partial-update-on-input'"
This reverts commit a2cc828e58, reversing
changes made to 87f185e62b.
2019-01-26 19:40:08 +01:00
Tobias Witek
b377a93e49 [core] Add debug output for partial bar update
see #353
2019-01-20 07:34:27 +01:00
Tobias Witek
23be352ec3 [core/engine] Ensure that full updates still take place regularly
Ensure that a full update still happens, even if continuous scrolling
triggers new events (and therefore, partial updates) all the time.

see #353
2019-01-19 14:18:48 +01:00
Tobias Witek
3d9279c444 [core] Update only affected widgets on input event
When receiving an input event, only update affected widgets, identified by
their instance ID.

see #353
2019-01-19 14:07:17 +01:00
Tobias Witek
0d9b3113f4 [modules/sensors2] Alternate sensor module
Show all sensor data reported by sensors -u and color widget with
warning/critical if sensor limits are exceeded.

fixes #326
2018-11-17 13:38:35 +01:00
Tobias Witek
7152bb17f2 [core] Generic collapsible widgets
Each widget can now be collapsed and expanded using the middle mouse
click, by default.
2018-09-15 14:40:52 +02:00
Frederic Junod
f46671a85f Use 'is None' instead of '== None' 2018-06-04 14:50:51 +02:00
Tobias Witek
290f95d6b4 [core] Collapse modules by using middle mouse
When pressing the middle mouse button (and it's not assigned to any
other functionality), the module (i.e. all widgets of that module) will
disappear and be replaced with the module's icon (or prefix, as
fallback) and an ellipsis.

fixes #264
2018-05-30 10:42:31 +02:00
WORD559
705c18dbcd Can force status bar to update early by sending a USR1 signal to the process 2018-05-06 09:31:46 +01:00
Tobias Witek
186169343d [engine] do not fail on module import
If a module import fails, simply log a warning. The module, clearly,
cannot be used, though.

fixes #227
2018-02-01 18:44:48 +01:00
Tobias Witek
bf84498df3 [core/engine] handle single-module errors
instead of terminating the whole status bar when an error occurs, just
show a (truncated) error for that single widget.

this should also enable auto-recovery if the module returns to a "good"
state, but that hasn't been tested yet.

see #221 and #222
2018-01-12 18:39:36 +01:00
Tobias Witek
650e0b933e Revert "[modules/getcrypto] Deal with kraken service downtime"
This reverts commit 3615e60e5b.

Time to go to sleep, so many mistakes...
2018-01-11 20:31:48 +01:00
Tobias Witek
3615e60e5b [modules/getcrypto] Deal with kraken service downtime
see #222
2018-01-11 20:29:45 +01:00
Tobias Witek
166437649c Revert "[modules/battery] Fix syntax error"
This reverts commit f236c24b92.
2018-01-11 20:26:14 +01:00
Tobias Witek
f236c24b92 [modules/battery] Fix syntax error
see #221
2018-01-11 20:22:30 +01:00
Tobias Witek
776be11137 [engine] Add generic interval mechanism
Add a generic mechanism to set a specific interval (in minutes, as this
is primarily intended for modules that want to "slow down" updates).

This gives *all* modules the parameter "interval" and allows each module
to set the default interval using the method "interval(<value>) in the
module constructor.

see #220
2018-01-07 20:25:32 +01:00
Tobias Witek
57064dcf54 [core/engine] Option to disable workspace wrap
Add a new parameter engine.workspacewrap (default to true) that, if set
to false, makes the workspace change via mouse wheel stop when hitting
the first/last workspace of an output (identical to how i3wm bar itself
behaves).

fixes #188
2017-10-21 13:06:36 +02:00
Tobias Witek
abd58d2fba [core/engine] Add parameter 'engine.workspacewheel'
Add a parameter that allows the user to enable/disable workspace
scrolling via the status bar.

By default, scrolling is enabled, to disable it, add the following
parameter to your bumblebee-status invokation:

-p <other parameters> engine.workspacewheel=false

see #188
2017-10-21 08:46:48 +02:00
Frederic Junod
6f28726758 Fix unused-import errors found by pylint 2017-10-17 18:59:28 +02:00
Frederic Junod
57204a215e Fix bad-whitespace errors found by pylint 2017-10-17 18:59:23 +02:00
Tobias Witek
9f69cc6ae9 [core] Add ability to "hide" a module with all its widgets
* A module can override the method "hidden" to specify when all it's
widgets should be hidden.
* Implement hidden for cmus and spotify
* Fix problem that cmus widgets were not displayed correctly

fixes #157
2017-08-12 17:03:04 +02:00
Tobias Witek
e763b55b86 [modules/disk] Backwards compatibility
Add support for showUsed, showSize and showPercent, but mark them as
deprecated.

see #151
2017-08-02 05:52:53 +02:00
Tobias Witek
5ca9ab796d [engine] Add logging for configuration file
For troubleshooting.

see #138
2017-07-14 17:11:20 +02:00
Frederic Junod
effea548ce [engine] Use RawConfigParser instead of SafeConfigParser
To allow percent signs in the config file
2017-07-14 09:33:24 +02:00
Frederic Junod
fe9c2835ad [engine] Add debug logging 2017-07-14 09:33:24 +02:00
Tobias Witek
ab989d8ddf [engine] Allow config parameter fallback to config file
If a configuration parameter is *not* specified with -p on the
commandline, look for a INI style configuration file as fallback in
~/.bumblebee-status.conf or ~/.config/bumblebee-status.conf.

Section must be "module-parameters", like this:
[module-parameters]
github.token=<your github token>

fixes #138
2017-07-12 18:37:59 +02:00
Tobias Witek
7d13268f66 [engine] Report current module when error occurs
Keep track of the latest updated module in the engine part, so that the
module causing an exception can be reported correctly.

fixes #110
2017-06-10 14:08:49 +02:00
Tobias Witek
b20e83cb8a [engine] Fix interval configuration
Until now, manually specifying an interval did not work, as a cast to
float was missing. Now, it's possible to specify an update interval in
seconds via "-p interval=<interval>"

fixes #54
2017-03-16 21:04:24 +01:00
Tobi-wan Kenobi
8724af2906 [tests/battery] Add tests for battery module 2017-03-05 09:35:56 +01:00
Tobi-wan Kenobi
5e305bf3b6 [engine/input] Re-enable mouse button parameter bindings
Re-enable the possibility to define custom mouse actions by binding
commands to "<alias|module>.<left-click|right-click|...>". These
commands are then executed as shell commands.

fixes #30
2016-12-15 19:41:50 +01:00
Tobi-wan Kenobi
1d6ca352b9 [modules/xrandr] Re-enable xrandr module
Displays the connected screens and allows the user to enable/disable
them.

see #23
2016-12-11 12:23:33 +01:00
Tobi-wan Kenobi
23d7d53fca [modules] critical/warning threshold refactoring
Quite a lot of modules use the "if higher X -> critical, if higher Y ->
warning" idiom now, so extracted that into a common function for reuse.

see #23
2016-12-11 08:25:54 +01:00
Tobi-wan Kenobi
2cc2cf8282 [core/engine] Add aliasing mechanism to modules
Allow modules to define aliases. This replaces the symlink mechanism
that was in place previously, because it was a bit ugly (and confused
code climate).

see #23
2016-12-11 07:18:06 +01:00
Tobi-wan Kenobi
0489ce1b51 [core/engine] Register wheel up/down callbacks for desktop switch
Switch desktop to prev/next on wheel up/down.

see #23
2016-12-10 12:14:12 +01:00
Tobi-wan Kenobi
918d7a6046 [core/input] Add callback deregistration
Enable components to unregister callbacks (i.e. for dynamic widgets).

see #23
2016-12-10 10:26:07 +01:00
Tobi-wan Kenobi
38a42e4a77 [tests/cmus] Add tests for cmus mouse interaction
see #23
2016-12-10 08:37:04 +01:00
Tobi-wan Kenobi
e72c25b0bc [core] Add input processing
Create infrastructure for input event handling and add i3bar event
processing. For each event, callbacks can be registered in the input
module.
Modules and widgets both identify themselves using a unique ID (the
module name for modules, a generated UUID for the widgets). This ID is
then used for registering the callbacks. This is possible since both
widgets and modules are statically allocated & do not change their IDs.

Callback actions can be either callable Python objects (in which case
the event is passed as parameter), or strings, in which case the string
is interpreted as a shell command.

see #23
2016-12-09 19:29:16 +01:00
Tobi-wan Kenobi
e59e969bdc [core] Refactor -> replace some getter/setter pairs with attributes
Remove some set_* methods and replace them with a simple attribute.

see #23
2016-12-09 11:49:59 +01:00
Tobi-wan Kenobi
0c7884d170 [all] pylint refinements
Improve code by bringing up the pylint score a bit.

see #23
2016-12-09 08:43:14 +01:00
Tobi-wan Kenobi
252260c249 [modules/datetime] Use parameter functionality to get format
Make the format string of the datetime module configurable using the new
parameter() method in the module.

Also, restructured the setting of the config information a bit so that
the parameter() method can be used in the constructor of a module.

see #23
2016-12-09 08:23:53 +01:00
Tobi-wan Kenobi
f33711f49f [core] Pass configuration parameters to modules
User can now use -p <key>=<value> to pass configuration parameters to
modules. For this, the module gets a "parameter()" method. Parameter
keys are in the format <name>.<key> where <name> is the name of the
loaded module. This is either the name of the module itself (e.g. "cpu")
or its alias, if the user specified it, for example:

bumblebee-status -m cpu -p cpu.warning=90

vs.

bumblebee-status -m cpu:test -p test.warning=90

see #23
2016-12-09 08:00:26 +01:00
Tobi-wan Kenobi
a7e756e015 [tests] Generic module tests
Add a helper function that lists all existing modules and modify the CPU
module test so that it now generically iterates all available modules
and tests their widgets.

see #23
2016-12-09 07:27:01 +01:00
Tobi-wan Kenobi
f40418475f [modules/datetime] Re-enable datetime module
Add datetime module + aliases date and time.

see #23
2016-12-09 07:11:23 +01:00