Commit graph

46 commits

Author SHA1 Message Date
tobi-wan-kenobi
32444ed49f [modules/cmus] Update to latest API 2020-04-28 20:25:28 +02:00
tobi-wan-kenobi
f1341772e5 [core/output] Evaluate "hidden()" callback of modules 2020-04-28 20:13:31 +02:00
tobi-wan-kenobi
cfa1a5c896 [modules/cpu2] Update to latest API 2020-04-26 10:34:25 +02:00
tobi-wan-kenobi
94ef496ee6 [core] Add a decorator for never updating a module 2020-04-13 09:27:03 +02:00
tobi-wan-kenobi
9e32cdef5d [core] Rename events for more clarity 2020-04-12 20:11:02 +02:00
tobi-wan-kenobi
07ca5cf383 [core/output] Make it possible to update modules via events
Add an event callback "update-modules" that allows various pieces of
bumblebee-status to update the status bar.
2020-04-12 14:44:02 +02:00
tobi-wan-kenobi
99a6a11e3a [core/output] Fix drawing of separator backgrounds 2020-04-08 14:13:18 +02:00
tobi-wan-kenobi
32e5d633f4 [core/output] Add tests for pango formatting 2020-04-07 20:59:26 +02:00
tobi-wan-kenobi
c0cc1ccd75 [core] Remove "intelligent" theme accessors
To simplify code, remove the auto-generated theme accessors for
attributes, and instead use a generic "get" method.
2020-04-07 20:44:01 +02:00
tobi-wan-kenobi
23215303ca [core] Add "merged" pango support
With this commit, it is possible to add pango directives inside every
piece that supports direct output (e.g. defaults/prefix or <module
name>/prefix) and those will be merged - i.e. it is possible to specify
defaults inside "defaults" and override/specify in the particular
modules.
2020-04-05 14:57:52 +02:00
tobi-wan-kenobi
e653624f5a [core/output] Re-enable basic pango support
Re-enable pango as simple "pango" dict wherever a normal value (e.g.
prefix, suffix) can go.
2020-04-05 14:27:09 +02:00
tobi-wan-kenobi
37cca1c3b9 [core/output] Fully switch to i3 block abstraction
According to the unit tests, at least, the old functionality is back
again - with the additional i3 block abstraction in output in place.

Also, pango support is temporarily removed again and will be
re-implemented based on the new architecture.
2020-04-05 13:58:59 +02:00
tobi-wan-kenobi
f5052473fb [core] Add preliminary block abstraction to output
The idea is to simplify the way the output module currently works by:
- introducing an abstraction that represents blocks; these abstractions
  contain all data - uninterpreted - required to draw a block
- separately from that, whenever the block is serialized into JSON,
  do the interpretation (pango vs. non-pango, etc.)

This - theoretically - should simplify code by creating two separate
concerns: collecting the data and actually interpreting it.
2020-04-05 10:53:17 +02:00
tobi-wan-kenobi
b5c2ca6ccf [core/output] Add generic pango support
Allow any piece of a theme that specifies a set of attributes (default,
cycles, states, widgets) to use pango *instead* of the usual attributes.

If pango is present, this will have precedence.

A practical example of this can be found in the powerline-pango theme,
which is added solely for demonstration purposes.

fixes #531
2020-04-04 14:38:37 +02:00
tobi-wan-kenobi
a6eb6c3a11 [core/output] Use __ for private variables 2020-04-04 13:57:42 +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
b66b13211e [modules/dunst] Fix toggling
At least Void Linux doesn't like kill -SIGUSR<N>

Also, added some debugging to inspect state changes for modules/widgets.

Also also, fix problem with min width, if no minwidth is set
2020-03-29 14:14:30 +02:00
tobi-wan-kenobi
d5820160dc [modules/sensors2] Fix runtime errors 2020-03-28 13:44:45 +01:00
Tobias Witek
e8288ef793 [core] Add per-module interval configuration
Allow individual modules to set different update intervals by using an
overriding 'interval' parameter.

see #574
2020-03-23 15:32:06 +01:00
Tobias Witek
9076b30325 [core/output] Make tests pass again
Using an empty configuration vs. no configuration at all to make tests
run again.
2020-03-15 14:02:48 +01:00
Tobias Witek
f2dc5f4b40 [core/output] Implement autohide
Allow output to automatically hide widgets that are *not* in any
critical mode
2020-03-15 14:01:09 +01:00
Tobias Witek
47e8d5b82b [core] replace widget.minwidth with widget.set('theme.minwidth') 2020-03-07 13:21:19 +01:00
Tobias Witek
d2e8057141 [modules] Add CPU module
Also, change minwidth from theme.minwidth to widget property
2020-03-06 14:33:40 +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
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