Commit graph

73 commits

Author SHA1 Message Date
WORD559
f1410b7c1f Use util.asbool rather than manual true-value parsing 2019-10-03 16:36:26 +01:00
WORD559
c8d5346d81 Add parameter to prevent scrollable decorator from fixing the module width 2019-10-02 21:30:55 +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
d9df96adcb Merge branch 'master' into partial-update-on-input
To make sure that all conflicts are resolved and because the
autohide feature is so nice.
2019-01-19 14:56:25 +01:00
Tobias Witek
7b07ef538a [core] Add "autohide" for distraction-free programming
Add a new parameter "-a|--autohide" that allows you to specify a
list of module names (or aliases) that will be hidden from the bar
*unless* their state is either warning or critical.
2019-01-19 14:51:48 +01:00
Tobias Witek
2b91ce5861 [core/output] Refactor full/partial refresh
Creating the "raw", cached widget data out of the widget object was done
two places now.

see  #353
2019-01-19 14:12:32 +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
WORD559
8ea9762472 Modified behaviour of bumblebee.output.scrollable to allow for custom scroll speed and toggling "bouncing" of text, and applied it to deadbeef and spotify 2018-12-28 21:27:38 +00:00
Tobias Witek
7d55bdce6c [engine/output] Use (experimental) custom widget padding
When padding a widget, instead of using the "min_width" field of the
i3bar protocol, which seems to "swallow" click events, perform a custom
padding by simply extending the right-hand side with spaces.

fixes #334
2018-11-25 17:50:05 +01:00
Tobias Witek
e80ae8b91e [core] Add option to draw widgets right-to-left
fixes #295
2018-09-22 14:40:32 +02: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
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
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
Frederic Junod
70a58715f3 Fix unused-variables errors found by pylint 2017-10-18 08:36:07 +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
Yves Hoppe
ec2b39f04c
[Output] Only draw widget when full text is not empty 2017-05-26 21:36:01 +02:00
Tobias Witek
fdcc908d83 [core] Use class theme, if no specific module theme matches
For modules that use aliases, until now, *only* the alias theme was
considered. This is typically a bad idea (tm), as the "generic" case is
that of a module theme (e.g. "disk", not that of a theme per instance of
the module (i.e. "home", "root", etc.)).

Therefore, introduce the concept of a "class" theme that can be
optionall overridden by a specific module theme.

As a pleasant side-effect, this should bring back the disk icons for all
instances of the disk module :)

fixes #79
2017-05-10 20:01:29 +02:00
Tobias Witek
02f3559734 [input] Terminate i3 protocol header with newline
According to https://i3wm.org/docs/i3bar-protocol.html, the header block
needs to be terminated by a newline.

fixes #76
2017-04-26 07:37:47 +02:00
Tobias Witek
2e5ea91291 Merge branch 'meain-traffic' 2017-04-23 07:18:15 +02:00
Tobias Witek
1a82a717fa [core] Calculate minwidth including pre/suffix
Add the length of the prefix and suffix to the minimum width, if
applicable.
2017-04-23 07:15:07 +02:00
Tobias Witek
928940d848 [core] Add a "scrollable" modifier for widget texts callbacks
If a module defines a callback for a widget's text, an optional
decorator "@bumblebee.output.scrollable" can be used to make the text
scrollable.

In those cases, the desired width is set to (in decreasing order of
priority):
1. whatever the widget defines as "theme.width"
2. whatever the theme defines as "width" for the module
3. whatever the commandline parameter "width" for the module is set to
4. 30 (determined by unfair dice roll)

see #27
2017-04-22 13:07:50 +02:00
Tobias Witek
92be7d3020 [core] Added min-width and alignment themeing
Added theme-options ("minwidth" and "align") for setting the minimum
width and the alignment of a widget.

Also, allow widget to provide defaults for the theme options by setting
an attribute in their store called "theme-<name of the theme option>".

For example, a widget can now define a default alignment by using:
widget.set("theme-align", "default-value").
2017-04-22 13:00:53 +02:00
Tobias Witek
5db5e02086 [core] Added min-width and alignment themeing
Added theme-options ("minwidth" and "align") for setting the minimum
width and the alignment of a widget.

Also, allow widget to provide defaults for the theme options by setting
an attribute in their store called "theme-<name of the theme option>".

For example, a widget can now define a default alignment by using:
widget.set("theme-align", "default-value").
2017-04-22 08:24:52 +02:00
Tobias Witek
251f8d2e9f [core] Add debugging capabilities
* If an exception is thrown, catch it and show a (somewhat) nice error
  message in the i3bar instead of the normal content
* Add a flag "-d" for debugging into a debug log. Currently, this only
  logs commandline calls as they occur and their return values, as well
  as exceptions.

fixes #58
2017-04-02 08:31:23 +02: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
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
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
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
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
c52cb99518 [core/theme] Add support for foreground and background colors
Themes can now define "fg" and "bg" attributes that are used for
foreground (text) color and background color.

see #23
2016-12-09 09:02:19 +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
Tobi-wan Kenobi
2fa8d7b778 [core/themes] Add module-specific themes
Allow module-specific theme information to overload "default"
configuration. I.e. it is now possible to have specific prefix or
postfix configurations for different modules. The module name is derived
for each widget from the module (__module__) from which it was
instantiated.

see #23
2016-12-08 12:44:52 +01:00
Tobi-wan Kenobi
394ef61760 [core/theme] Add support for default -> prefix/suffix in themes
Themes can now define default prefix and suffix strings.

see #23
2016-12-08 11:52:47 +01:00
Tobi-wan Kenobi
64f5fc100e [core/theme] Add prefix/postfix methods
Add a way to specify prefix and postfix strings to the full text of a
widget's text. Currently, the theme does not fill those yet.

see #23
2016-12-08 11:31:20 +01:00
Tobi-wan Kenobi
c44744fa50 [core/output] Small refactoring 2016-12-08 09:04:47 +01:00
Tobi-wan Kenobi
f645203579 [core] Widget creation/update overhaul
Until now, widgets were re-created during each iteration. For multiple,
reasons, using static widget objects is much easier, so instead of
creating new widgets continuously, modules now create the widgets during
instantiation and get the list of widgets passed as parameter whenever
an update occurs. During the update, they can still manipulate the
widget list by removing and adding elements as needed.

Advantages:
* Less memory fragmentation (fewer (de)allocations)
* Easier event management (widgets now have static IDs)
* Easier module code (widget contents can simply be the result of a
  callback)

see #23
2016-12-08 08:44:54 +01:00
Tobi-wan Kenobi
aacc56a4e2 [modules/cpu] Add initial version of CPU utilization module
Re-enable the CPU utilization module as proof-of-concept for the new
core engine.

see #23
2016-12-04 17:45:42 +01:00
Tobi-wan Kenobi
b6eb3ee8e6 [output/i3bar] Add flush method
flush() terminates a single iteration of widget drawing.

see #23
2016-12-04 16:14:43 +01:00
Tobi-wan Kenobi
712d958e18 [core/output] Add widget drawing
Add basic drawing of widgets. Each module instance returns a list of
widgets using the widgets() method which is then forwarded to the draw()
method of the configured output.

see #23
2016-12-04 12:53:18 +01:00
Tobi-wan Kenobi
6f52825ef0 [core/output] Add initial version of i3bar output
Add output handler for i3bar protocol and add some tests for it. Right
now, it only support start and end.

see #23
2016-12-04 12:26:20 +01:00
Tobi-wan Kenobi
a8a6c9bba2 [core] Refactor engine
This is going to be a bit more comprehensive than anticipated. In order
to cleanly refactor the core and the engine, basically start from
scratch with the implementation.

Goals:

* Test coverage
* Maintain backwards compatibility with module interface as much as
  possible (but still make modules easier to code)
* Simplicity

see #23
2016-12-03 20:38:54 +01:00
Tobi-wan Kenobi
f306366629 [core] Minor refactoring
Use a small helper function from util, tidy up some parts of the
output.
2016-12-02 17:52:05 +01:00
Tobi-wan Kenobi
bf381794bd [output] Ignore empty commands
When receiving a "nop" (None) command, skip it. Otherwise, an exception
is thrown and input processing stops.

Also, remove the "communicate()" call to *not* wait until a process has
finished until resuming input processing. Otherwise, whenever an
external program (pavucontrol, nautilius, ...) is started, any further
input processing is stalled until the program has been closed again.

fixes #24
2016-11-29 19:35:54 +01:00