Commit graph

65 commits

Author SHA1 Message Date
tobi-wan-kenobi
bd7ff3c8f1 [core] Allow modules to specify default update interval
Expanding on the implementation in d582016, add a decorator
`core.module.every()` that allows a module to specify how often to
update the module's state.

This can still be overridden using the CLI parameter `interval`.
2020-03-29 14:32:47 +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
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
d5820160dc [modules/sensors2] Fix runtime errors 2020-03-28 13:44:45 +01:00
tobi-wan-kenobi
908ef67109 [core/widget] bump test coverage 2020-03-27 13:54:22 +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
5851b104c5 [modules/xrandr] Adapt to new API 2020-03-13 13:56:08 +01:00
Tobias Witek
41dc387d0c [core] Re-enable WAL support
Implement a generic "load keywords and replace during runtime"
mechanism, with the first concrete use-case of WAL colors (load them
during startup, and during runtime, whenever a matching name is found in
the keywords, replace with the actual color)
2020-03-08 14:19:21 +01:00
Tobias Witek
47e8d5b82b [core] replace widget.minwidth with widget.set('theme.minwidth') 2020-03-07 13:21:19 +01:00
Tobias Witek
b841ba3c93 [modules/battery] Re-enable battery module 2020-03-06 20:57:32 +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
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
0a0e39b516 [modules] Re-add load module 2020-03-05 21:13:15 +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
162398c6b6 [core/output] Make error widgets critical 2020-02-24 15:07:34 +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
37e1deaa6f [tests] Add (partial) decorator tests 2020-02-24 14:20:54 +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
5e673482d3 [core] Nicify error widget 2020-02-23 14:52:58 +01:00
Tobias Witek
65186baea6 [core] Make error widget scrollable
Restrict error module to 15 characters and make it scrollable.
2020-02-23 14:47:47 +01:00
Tobias Witek
a69e058dd1 [core] Add decorators library
For now, simply add a decorator that allows for scrolling of text
2020-02-23 14:47:20 +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
a9c1c3581a [core/theme] Iconset needs to be auto by default 2020-02-22 14:11:10 +01:00
Tobias Witek
30d34b12e0 [core/theme] Fix loading of custom iconset 2020-02-22 14:08:28 +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
ef75e593f7 [core/config] Add stub for autohide
Add stub for autohide so that my status bar doesn't terminate with an
error (easier testing)
2020-02-22 13:44:44 +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
d3fc648c08 [core/theme] Dynamically create theme accessors
Dynamically generate the accessors for a theme's attributes.

NB: This might be even nicer coming from a JSON rather than inside the
code.
2020-02-16 21:15:14 +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
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
99cca7002c [core/module] Fix error display 2020-02-15 14:04:53 +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
468e30ce66 [main] Add input thread logic and logging
To the main application, add an input thread that "simply" reads
sys.stdin events and transmits them via core.input.

Additionally, set up some initial logging (yeah, for threading, this is
needed immediately)
2020-02-08 13:56:52 +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
4d34fa9261 [core/input] Use util.cli to execute commands
If the registered callback is not callable (i.e. no Python method),
assume it's a command that should be invoked via a shell.
2020-02-08 13:40:51 +01:00