Commit graph

22 commits

Author SHA1 Message Date
Tobias Witek
b99ac07ef0 [core/decorators] Add more tests 2020-02-27 21:39:04 +01:00
Tobias Witek
0cc744ed15 [core/output] Cache widget output for selective redraw
To make redraw work correctly and elegantly with supplementary elements
(e.g. prefix, postfix, separators), always do a full redraw of the bar
(to make the theme update correctly, but cache the actual *data* to
display inside the output.
2020-02-24 15:05:58 +01:00
Tobias Witek
1a093a73b1 [core] Add prefix/postfix support 2020-02-24 14:54:11 +01:00
Tobias Witek
0a266b607e [core/output] Unify common i3 attributes 2020-02-24 14:06:57 +01:00
Tobias Witek
84833dc7db [core] Add (partial) support for states
Add states to the modules and widgets. Widgets are mostly just a
pass-through (backwards compatibility, and ease of use - making states
directly inside the widgets would require more code inside the modules
to ensure that each widget is correctly updated).

Still missing:
- Separators during partial update (right now, it takes one interval
until separators are drawn correctly)
2020-02-23 21:13:49 +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
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
808c46f551 [core/theme] Add separator-block-width 2020-02-16 14:54:20 +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
a4904d998f [core] Use core.event to decouple main and output
Make output act on events, not on concrete calls.
2020-02-16 14:30:45 +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
b157aa9fb5 [core/output] Minor refactoring - widget assembly 2020-02-09 13:30:40 +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
5810a12944 [core/output] Start implementation of a partial update
Add a "patch()" method that eventually will only update affected
modules.
2020-02-08 14:22:43 +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
74e74bb78b [core/output] Make bar actually work (flush output)
Seems adding a \n isn't sufficient for flushing, instead explicitly
flush stdout to produce a result reliably in the i3bar.
2020-02-02 21:21:24 +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
a17cd4759c [core/output] Implement simple wait
To pace the output lines, implement a simple wait() call for the i3
output.
2020-01-26 13:31:20 +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