Commit graph

282 commits

Author SHA1 Message Date
tobi-wan-kenobi
d0200b656d [core/config] Allow string formatted intervals
Allow users to specify intervals such as '5m', for convenience
2020-04-02 16:55:36 +02:00
tobi-wan-kenobi
0f6dfb3f1a [core/input] do not throw on wrong event type
until now, if a module had registered callbacks, events for nonexistent
buttons caused the trigger mechanism to raise an exception.
2020-04-02 16:21:07 +02:00
tobi-wan-kenobi
885cc09636 [core/output] Add some more tests 2020-03-31 20:57:09 +02:00
tobi-wan-kenobi
95410e4adf [core/input] __ for private variables, use id as property 2020-03-29 14:43:04 +02:00
tobi-wan-kenobi
11ebcee29a [tests] Fix kernel module test 2020-03-29 14:35:20 +02:00
tobi-wan-kenobi
2a93a001b2 [theme] Add unit tests for WAL loading 2020-03-28 14:51:48 +01:00
tobi-wan-kenobi
5ade8e47f0 [core/theme] Add some unit tests 2020-03-28 14:03:50 +01:00
tobi-wan-kenobi
908ef67109 [core/widget] bump test coverage 2020-03-27 13:54:22 +01:00
Tobias Witek
9755a70578 [tests] Make tests pass again (configurable update interval) 2020-03-23 15:40:53 +01:00
Tobias Witek
8efa101380 [util/format] Tests and minor renaming 2020-03-07 13:33:28 +01:00
Tobias Witek
7c866f1476 [tests] Add tests for byte formats 2020-03-06 15:00:03 +01:00
Tobias Witek
48c21a902e [tests/module] Skip failing tests in Python 3.{4,5} 2020-03-06 14:45:09 +01:00
Tobias Witek
51faef9fd4 [modules/kernel] Make widget dynamic (update if kernel changes) 2020-03-06 14:31:08 +01:00
Tobias Witek
efc2e4f94e [modules] Separate modules into core & contrib
Also, improve errors when importing a module fails.

Also, add more tests.
2020-03-06 14:14:34 +01:00
Tobias Witek
47950240d0 [tests/core/module] Add tests for widget retrieval by name 2020-03-05 21:17:06 +01:00
Tobias Witek
d19eb72296 [tests/module] Test generation of error widget
When a module/widget throws, an error widget should be produced.
2020-03-04 21:06:09 +01:00
Tobias Witek
533b8ca0cc [modules] Re-add module nic 2020-03-01 14:36:12 +01:00
Tobias Witek
a1aec8fff6 [core/module] Add error widgets if a module throws
Module should have to care less about thrown exceptions.
2020-03-01 14:08:16 +01:00
Tobias Witek
cb3482ae27 [core/decorators] Simplify and test scrolling 2020-02-29 14:05:02 +01:00
Tobias Witek
b99ac07ef0 [core/decorators] Add more tests 2020-02-27 21:39:04 +01:00
Tobias Witek
37e1deaa6f [tests] Add (partial) decorator tests 2020-02-24 14:20:54 +01:00
Tobias Witek
fd57af9325 [tests] Make tests pass again 2020-02-23 14:55:13 +01:00
Tobias Witek
a2446a36af [core/theme] Better separator handling
Add a generic method to the theme to get the "previous" value of an
attribute.
2020-02-23 14:31:30 +01:00
Tobias Witek
30c539f1f2 [util/cli] Add option to ignore return codes
Add an option that ignores the return code of an execute, instead of
throwing an error (which sometimes causes ugly try/except blocks in
client code)
2020-02-23 13:44:49 +01:00
Tobias Witek
7a1cd4b613 [util] Add 'formatting' utility methods
Add helpers to unify formatting of bool/list/int values.
2020-02-23 13:43:44 +01:00
Tobias Witek
3bb857f250 [core/theme] Add iconset support
Allow themes to specify iconsets. To do so, add a new util library
"util.algorithm", which currently contains support for deep merging of
dicts.
2020-02-22 14:07:24 +01:00
Tobias Witek
38410adcb8 [core/theme|output] Add separators
Add a way for themes to specify custom separators. Doing that, make
nicer interfaces for drawing "supplementary" components (separators)
for widgets and generalize the attribute retrieval within the theme.
2020-02-22 13:42:44 +01:00
Tobias Witek
6e5e297d93 [core/theme] Add true cycling support
Using the freshly introduced eventing system, enable cycling of widget
attributes.
2020-02-16 14:39:10 +01:00
Tobias Witek
c1df1686c1 [core/event] Initial commit of simplistic event engine 2020-02-16 14:27:17 +01:00
Tobias Witek
26ae63b5ad [core/theme] Add preliminary cycling support
Add support for cycling values in a theme, for now as long as the cycle
size is 0 :P
2020-02-16 14:02:21 +01:00
Tobias Witek
affeba5b8f [core/theme] Add simple theme stub
Add support for default fg/bg colors
2020-02-15 14:05:27 +01:00
Tobias Witek
5d971267db [core/theme] Add preparatory work for themes
Add two new parameters: theme and iconset

Add a placeholder class core.theme.Theme, an instance of which is passed
in to the i3 output object (which is the only object that should ever
have need of the theme, hopefully).
2020-02-09 13:46:56 +01:00
Tobias Witek
4e2a645bd3 [core/input] Separate module/widget update and retrieval
To make it easier to update individual modules, separate the call to
update() and the call to actually drawing the status.

Additionally, this avoids the "side effect" of updating when drawing the
status line.
2020-02-09 13:25:34 +01:00
Tobias Witek
cc0139e517 [tests/input] Add test for non-callable callback 2020-02-08 14:09:14 +01:00
Tobias Witek
fca364554e [core/output] Add id of widget and module to output
In the process of that, fix a bug in how the parent class constructors
were invoked.
2020-02-08 13:45:52 +01:00
Tobias Witek
9d4936b596 [util/cli] Add new CLI utilities
For now, this just allows executing commands
2020-02-08 13:39:35 +01:00
Tobias Witek
e0df8b84e5 [core] Add input handling
Add a (half-finished) input library, that for now simply allows
registration and triggering of events.

As next steps, the trigger will happen as part of a separate thread that
reads input events.

Additionally, invoking commands via a execute() will be supported.

Thirdly, there is need of a way to selectively update the affected
modules (widgets), which should be possible given that the event
contains both the instance (widget ID) and name (module name).
2020-02-07 21:28:29 +01:00
Tobias Witek
6adc497f68 [core] Add support for module parameters
Parse '-p' parameters and make them accessible via 'parameter()' from
within a module (basically, restore the previous configuration
facility).

Still TODO: Add support for configuration files.
2020-02-04 21:09:11 +01:00
Tobias Witek
3a531c359f [core/module] Add config to module
Add access for all modules to the commandline parameters (called
"config" in bumblebee-status)
2020-02-03 21:30:06 +01:00
Tobias Witek
854d7dc470 [modules] Add first "real" module: kernel
Since 'kernel' is small and shows static information, have this be the
very first module added.
2020-02-02 14:41:22 +01:00
Tobias Witek
445c5a65f1 [core/output] Move widget/module handling inside output
The core.output module now manages the list of modules and retrieves the
widgets inside draw() itself. That way, details of drawing/updating
widgets are not visible from the outside anymore.
2020-02-02 14:18:13 +01:00
Tobias Witek
66537fbe05 [core/output] Rewrite to hide sys.stout
Add generic "draw()" method that redirects internally to the actual
calls. These can now produce JSON, which is nicer because:

1. Easier to use during testing
2. More flexible
3. Centralizes printing (somewhat)

Still, the "suffix" concept isn't really nice, but so far, I have no
better approach.
2020-02-01 21:37:38 +01:00
Tobias Witek
fbd44618dc [test] Python 3.5 compatibility
Use assert_called_once_with() instead of assert_called_once() to
maintain compatibility with Python 3.5
2020-01-26 14:17:14 +01:00
Tobias Witek
7a9cb8b533 [core/module] Add very basic widget capability 2020-01-26 14:06:09 +01:00
Tobias Witek
fee7cf7882 [core/widget] Add widget class
To maintain backwards compatibility (and because I think it's an OK
design choice), keep the widget concept (a single module can produce
multiple widgets).
2020-01-26 13:58:29 +01:00
Tobias Witek
acf9d6214e [tests] Restructure
Put tests into directory structure equivalent to that of the code
itself, for better separation (hopefully)
2020-01-25 14:27:41 +01:00
Tobias Witek
5a60a23ebd [core/config] Add interval (as parameter store)
Add a generic parameter store to the configuration and use it to set the
parameter "interval" (backwards compatibility)
2020-01-25 14:24:21 +01:00
Tobias Witek
8a2ef5ea5d [core] Add util.store for store-like get/set 2020-01-25 14:20:25 +01:00
Tobias Witek
bd12a51bfb [core] Add simple module loading
Add a way to load modules located in modules/*
2020-01-19 16:06:21 +01:00
Tobias Witek
8622673114 [core] Re-enable preliminary module loading (stubbed)
Add logic for parsing commandline options, and a preliminary stub for
loading modules.

Note: The idea is that core.module.load() will return a valid, but
empty, module that displays an error, if the module cannot be loaded
2020-01-19 15:36:52 +01:00
Tobias Witek
e931bb93c6 [core] Rework core implementation
Experimental re-implementation of core functionality with the aim:
- Depend only on the Python Standard Library for core
- If modules are missing elsewhere, *never* throw
- Unit test *everything*
- Cleaner and more minimal implementation
- Better integration points for existing implementations (charts,
  braille, etc.)
- Full backwards-compatibility with existing module system (except where
  modules can be vastly simplified)
2020-01-19 13:29:34 +01:00
me
d952661b28 add tests with custom format for bumblebee.util.bytefmt() 2020-01-12 20:33:51 +02:00
me
c45c5134a7 add txtbars 2020-01-01 22:22:31 +02:00
Tobias Witek
c4cf1da337 [tests] Fix failing tests
* better checks for "brightness" modules
* add mocking for output config
2019-12-26 13:56:53 +01:00
user
d4946f2c13 hddtemp module 2019-12-25 03:12:06 +02:00
Tobias Witek
f80fcfa60c [tests] Remove test about listing modules
If an import fails, this test fails, which is not the original
intention.

Until such time that the listing of existing modules is fixed, this test
is removed.

fixes #491
2019-12-23 13:35:05 +01:00
Tobias Witek
14813f5fee [tests] improve output
see #491
2019-12-22 14:25:00 +01:00
Tobias Witek
2305ce4622 [tests] Remove generic test_modules
This module doesn't *really* perform tests and causes more trouble than
it is worth at the moment.

see #456 and #457 for reasons why the tests need to be overhauled a bit
anyhow.
2019-10-27 20:25:57 +01:00
WORD559
fb2fb796da add test for asbool 2019-10-04 15:18:11 +01:00
mw
ac418caa59 Add test cases 2019-09-05 20:19:20 +02:00
Tobias Witek
5ee612da2d [doc] Add screenshot for network_traffic
Add http status module

fix

chore: update modules number
2019-07-24 12:37:59 +02:00
Tobias Witek
682d2f47dd [core/theme] State == "" causes backtraces
Empty states ("" rather than None) caused a backtrace in the theme
engine. Fix that by being a bit more robust, and add a test that checks
for regressions.

fixes #406
2019-07-02 20:19:26 +02:00
Tobias Witek
928c37a972 [core+tests] Improved poll handling
- mock poll instead of epoll
- increase timeout for poll (1ms is a lot of system load for nothing)
2019-06-23 16:51:28 +02:00
Frank Scherrer
a6eb5a43a5
fix code for flake8 linter 2018-09-04 10:04:18 +02:00
Frank Scherrer
a52c3e8e12
add further tests for which
* test which for always present binary "ls"
* test which for garbage input
2018-09-04 09:58:52 +02:00
Frank Scherrer
872c2047e5
add test for util.which
* and make runtests.sh dash-compatible for debian-like OS
2018-08-28 14:52:17 +02:00
Tobias Witek
be8669270e [tests] Removed memory test, as psutil is not used anymore
mocking psutil doesn't bring much to the table now...
2017-09-20 06:28:47 +02:00
Tobias Witek
115f03cb0f [module/battery] Add remaining time, if available
Add remaining time directly to widget, if available, and if not on
charge.

see #146
2017-07-26 16:41:30 +02:00
Frederic Junod
37434aa5e5 [module/memory] Add new format string parameter 2017-07-15 09:48:23 +02:00
Tobias Witek
e5061b4d5f [tests/brightness] Disable failing test
Honestly: I don't know why Travis is failing on this test, it works fine
on my machine with Python 2.7. Therefore, I will disable this test until
I can get to the bottom of it.
2017-06-26 20:42:33 +02:00
Tobias Witek
fd7c5f6f0b [tests/brightness] Create open call, if it does not exist
Hopefully, this fixes the failing Travis build.
2017-06-26 20:33:06 +02:00
Tobias Witek
d37218ce4a [tests/brightness] Fix FileNotFoundError for Python 2.7 2017-06-26 19:10:51 +02:00
jmg5e
fc912a8fbc fixed tests for brightness module 2017-06-26 06:07:19 -05:00
Tobias Witek
d69f13f0b4 [modules/battery] Autodetect battery devices
The module now creates a widget for each battery device it detects and
shows the status for each of them (I don't know of anyone with more than
a single battery, but if I'm overhauling the module anyhow, might as
well do it comprehensively).

fixes #117
2017-06-18 11:35:06 +02:00
Tobias Witek
c7e2f39132 [tests/cpu] Fix expectation for CPU module output 2017-06-15 14:06:45 +02:00
Tobias Witek
c75ad75920 [tests/module/disk] Adapt to new input parameters
Open application now defaults to xdg-open, replace with nautilus
manually.
2017-06-01 19:57:50 +02:00
Tobias Witek
94c72a1e6a [tests] Fix failing test for i3bar protocol 2017-04-26 07:50:27 +02:00
Tobias Witek
59fc835b88 [tests] Fix broken cmus test
Adding scrollable output broke the cmus test.
2017-04-22 13:17:09 +02:00
Tobias Witek
0f34826cac [tests] Fix broken tests caused by new theme methods
Add "minwidth()" and "align()" mocks for i3bar output tests.
2017-04-22 13:14:52 +02:00
Tobi-wan Kenobi
bb2ed63528 [test/disk] Fix unit test for disk module 2017-03-10 08:26:33 +01:00
Tobi-wan Kenobi
935b50a23b [tests] Maybe patching the platform call fixes the issue with Travis 2017-03-05 14:18:34 +01:00
Tobi-wan Kenobi
11c68310bb [tests] generic modules tests don't work on Travis
Maybe this fixes it...
2017-03-05 14:08:26 +01:00
Tobi-wan Kenobi
a47860e73c [tests] Add unit tests for pulseaudio module 2017-03-05 14:02:11 +01:00
Tobi-wan Kenobi
e59a870a1e [tests] Add unit tests for memory module 2017-03-05 13:58:15 +01:00
Tobi-wan Kenobi
e07a889393 [tests/cpu] Cleaned up unnecessary import 2017-03-05 13:49:52 +01:00
Tobi-wan Kenobi
be01980afe [tests] Add unit tests for disk module 2017-03-05 13:49:45 +01:00
Tobi-wan Kenobi
826c568625 [tests] Add generic module tests
These tests check that all widgets of all modules conform to some basic
principles, at least.
2017-03-05 13:30:10 +01:00
Tobi-wan Kenobi
f9984ba386 [tests] Add unit tests for load module 2017-03-05 13:16:13 +01:00
Tobi-wan Kenobi
c7621caf78 [tests] Add unit tests for the store class 2017-03-05 13:04:20 +01:00
Tobi-wan Kenobi
00849aa4fa [tests] Refactor setting up complex I/O mocking for modules
Modules now only have to have a single setup/teardown line in their code
to fully set up the I/O part of a test.
2017-03-05 13:01:28 +01:00
Tobi-wan Kenobi
69dceca7d0 [tests/cpu] Add unit tests for module cpu 2017-03-05 12:30:37 +01:00
Tobi-wan Kenobi
46977f4d36 [tests/cmus] Add unit tests for cmus module 2017-03-05 12:15:29 +01:00
Tobi-wan Kenobi
939d9851bd [tests/brightness] Remove unused import 2017-03-05 12:15:13 +01:00
Tobi-wan Kenobi
e6d44e7898 [tests/caffeine] Add unit tests for caffeine 2017-03-05 11:48:33 +01:00
Tobi-wan Kenobi
aaaf62673d [tests/brightness] Remove unneeded mock for stdout 2017-03-05 11:48:19 +01:00
Tobi-wan Kenobi
36848770a5 [tests] Add unit tests for brightness module 2017-03-05 11:24:30 +01:00
Tobi-wan Kenobi
463850eddc [tests/battery] Add unused variables 2017-03-05 11:24:11 +01:00
Tobi-wan Kenobi
ce22e9dc75 [tests] remove accidentially committed backup module 2017-03-05 11:23:52 +01:00
Tobi-wan Kenobi
1217aa1f60 [tests/battery] Try to fix failing CI tests 2017-03-05 10:39:08 +01:00
Tobi-wan Kenobi
e4f728327e [tests] Fix imports for Python3 compatibility 2017-03-05 09:40:15 +01:00
Tobi-wan Kenobi
30f3c898ed [tests] Do not use string.lowercase, as Python3 complains about it 2017-03-05 09:37:59 +01:00
Tobi-wan Kenobi
8724af2906 [tests/battery] Add tests for battery module 2017-03-05 09:35:56 +01:00
Tobi-wan Kenobi
728cb73189 [test_i3bar-output] Added i3bar output test modules 2017-03-05 09:34:47 +01:00
Tobi-wan Kenobi
70f138b97b [tests/i3bar-input] Add input tests for i3bar protocol
Also, replaced the MockModule with a generic mock object.
2017-03-05 08:35:15 +01:00
Tobi-wan Kenobi
cdbddcfff7 [tests/i3bar-input] Add tests for i3bar input processing 2017-03-05 07:56:10 +01:00
Tobi-wan Kenobi
90dd636b43 [tests/engine] Add test for module aliasing 2017-03-04 18:53:31 +01:00
Tobi-wan Kenobi
6a14681a65 [tests/theme] Add tests for theme.py 2017-03-04 14:17:27 +01:00
Tobi-wan Kenobi
64523119af [tests] Added engine and module tests
Added those two unit tests together, as they are tightly linked together
anyhow.
2017-03-04 13:44:51 +01:00
Tobi-wan Kenobi
f65ab6bcae [tests/config] Add unit tests for config.py 2017-03-04 12:11:43 +01:00
Tobi-wan Kenobi
f0013c7581 [tests/util] Add test for execute with wait=False 2017-03-04 11:35:46 +01:00
Tobi-wan Kenobi
6dbe440cb5 [tests] Purge tests and start with a clean implementation of subprocess
Seems like subprocess and friends (Popen, communicate) are not so easy
to mock cleanly. Therefore, start from scratch and carefully write test
by test, until (at least) the old test coverage has been restored.
2017-03-04 11:25:52 +01:00
Tobi-wan Kenobi
d3fc5094f8 [modules/gpmdp] Make unit tests run through
* full_text needs to return a string *always*
* relax full_text check to also allow unicode results
2017-01-02 22:26:57 +01:00
Tobi-wan Kenobi
846d28714a [tests] Add tests for bumblebee.util
Add tests for the utility functions and fix a few embarrassing bugs in
the process.
2016-12-17 09:00:49 +01:00
Tobi-wan Kenobi
9a350ddc2a [tests/config] Add tests for helptexts
Ensure that each theme is listed in the helptext and that there is a
helptext entry for every module.
2016-12-17 08:42:23 +01:00
Tobi-wan Kenobi
f6be25bc73 [core/input] Move from select to epoll
Use epoll instead of select in order to be able to use level-triggered
semantics and not get stuck on the first event.
2016-12-17 07:43:38 +01:00
Tobi-wan Kenobi
31f9154be2 [help] Add theme and module listing
Re-enable the possibility to list available themes and modules.

fixes #29
2016-12-17 07:05:23 +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
75f5af4866 [core/input] Skip partial events
Clicking on a separator creates partial events ("instance" missing).
Ignore those events, as they crash the input processor.

fixes #31
2016-12-11 13:43:34 +01:00
Tobi-wan Kenobi
9878bbf971 [tests] Fix automated testrun in Travis
Forgot to mock Popen() in setUp
2016-12-11 12:31:37 +01:00
Tobi-wan Kenobi
9fe0915730 [tests] Add mocking for module tests 2016-12-11 12:26:28 +01:00
Tobi-wan Kenobi
71582cbcd7 [modules/ping] Re-enable ping module
Show RTT measured by ICMP echo request/replies for a given host.

For that to work correctly, change the "full_text" callback for a widget
so that the widget itself is also passed as argument in the callback
method. That actually makes a lot of sense, since the widget can now be
used as a repository of state information.

see #23
2016-12-11 11:37:24 +01:00
Tobi-wan Kenobi
666daff9a6 [modules/pulseaudio] Re-enable pulseaudio module
Display volume for default PulseAudio source/sink, change volume and
mute/unmute device.

see #23
2016-12-11 08:51:56 +01:00
Tobi-wan Kenobi
c2c70da4ef [tests/disk] Fix copy/paste error - duplicate method name 2016-12-11 08:45:43 +01:00
Tobi-wan Kenobi
e603a2cb26 [tests/battery] Forgot a mock in previous commit 2016-12-11 08:14:55 +01:00
Tobi-wan Kenobi
7db80b6d3b [tests/battery] Mock exists() call for Travis CI 2016-12-11 08:11:26 +01:00
Tobi-wan Kenobi
c8fc75a401 [modules/load] Re-enable load module
Display system load and show warning/critical error when load is above a
certain threshold (compared to the number of available CPUs).

see #23
2016-12-11 08:01:43 +01:00
Tobi-wan Kenobi
4bd13c2f63 [tests] Refactor i3barinput
Use the assertMouseEvent helper in i3barinput.

see #23
2016-12-11 08:01:16 +01:00
Tobi-wan Kenobi
716bafa90e [tests] Fix unit tests (at least on my system) 2016-12-10 19:45:13 +01:00
Tobi-wan Kenobi
2e2351a69e [tests] Mock Popen() in module tests 2016-12-10 19:35:38 +01:00
Tobi-wan Kenobi
d41c142d4a [modules/memory] Re-enable memory usage module
Add module that shows RAM consumption and opens the gnome-system-monitor
on click.

see #23
2016-12-10 19:20:19 +01:00
Tobi-wan Kenobi
16a4613e57 [tests] Minor refactoring
Draw some commonly-used assertion logic into common functions.

see #23
2016-12-10 19:08:29 +01:00
Tobi-wan Kenobi
e15147fe10 [tests/disk] Add critical/warning threshold tests for disk module
see #23
2016-12-10 18:49:25 +01:00
Tobi-wan Kenobi
12f5ce5977 [modules/disk] Re-enable disk usage module
Add a module that shows the disk usage for various paths and opens
nautilus on that path whenever it is clicked.

see #23
2016-12-10 18:21:01 +01:00
Tobi-wan Kenobi
771c597ce9 [modules/caffeine] Re-implement caffeine module
Add caffeine module & add a framework for testing it (no tests yet,
though).

see #23
2016-12-10 15:36:18 +01:00
Tobi-wan Kenobi
163419063d [tests/battery] Add some tests for the battery module
see #23
2016-12-10 14:50:49 +01:00
Tobi-wan Kenobi
1b8385b33f [modules/brighness] Re-enable brightness module
Add a module for reporting, increasing and decreasing the brightness of
a display.

see #23
2016-12-10 14:31:18 +01:00
Tobi-wan Kenobi
029492e16d [core] Non-blocking input thread for i3bar events
Make input thread non-blocking by using select(). This increases the CPU
utilization a bit (depending on the timeout), but makes the thread exit
cleanly, even if an exception is thrown in the main thread.

see #23
2016-12-10 13:45:54 +01:00
Tobi-wan Kenobi
a045962d00 [modules/nic] Re-enable NIC module
Re-add the NIC module with all its functionality (hopefully...).

This introduces a new concept: Instead of having separate queries for
critical and warning (which really are just another set of states), a
module can now return a list of states for each widget. All the state
information is then merged together into a single theme. So, for
instance, the NIC module can return a state saying "critical -
wlan-down", which applies the theme information for both "critical" and
"wlan-down".

see #23
2016-12-10 11:25:02 +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
761b81970d [modules/cpu] Pad to 3 digits before comma to fix width
I cannot get the min_width property to work right now, so in order to
fix the width of the CPU widget, pad the utilization to 3 digits (so
that even 100% aligns nicely).

see #23
2016-12-10 09:04:12 +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
225d471c6a [modules/cpu] Add configurable warning and critical thresholds
The cpu module now has cpu.warning and cpu.critical thresholds. If the
CPU utilization is higher than any of those values, the widget's state
changes to warning or critical, respectively.

see #23
2016-12-10 08:09:13 +01:00
Tobi-wan Kenobi
87e76b9e40 [modules/cmus] Re-add cmus module
Re-add a first version of the cmus module originally contributed by
@paxy97.

Still missing:
* Icon themes (status)
* On-click actions

see #23
2016-12-10 07:47:24 +01:00
Tobi-wan Kenobi
9ce7739efb [tests] Add specific tests for CPU module
* Check that the left mouse button action works
* Check that the format is OK

see #23
2016-12-09 22:28: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
fa30b9505b [all] More pylint fixes
see #23
2016-12-09 16:33:29 +01:00
Tobi-wan Kenobi
4baf63f88c [core/themes] Add state themes
Each widget can now return a state using the method "state()". This
string is then used to look up a theme information which is used instead
of the default or module theme, if found.

see #23
2016-12-09 13:32:22 +01:00
Tobi-wan Kenobi
88b36417f8 [core/theme] Fix padding
Missing prefix/suffix broke padding.

see #23
2016-12-09 13:06:08 +01:00
Tobi-wan Kenobi
c1f1e1a939 [core/themes] Add separator customization
Add customized separators:
* The default separators are automatically disabled if custom separators
  are used (to "just" disable the default, use empty custom separators)
* Use previous background color as their background color and the
  current background color as foreground color
* Allow the separator-block-width to be configured

see #23
2016-12-09 12:55:16 +01:00
Tobi-wan Kenobi
527489e0de [core/themes] Add "cycling" support
Allow a theme to define a "cycle" of attributes that are cycled through
on a widget-per-widget basis (e.g. for alternating the widget
background). These cycles take precedence over the default values, but
can be overridden by module-specific theme instructions.

see #23
2016-12-09 12:28:39 +01:00