Commit graph

23 commits

Author SHA1 Message Date
Tobias Witek
4e0e3ef427 [general] Add Python3 support
* Change some formatting to please python3
* remote pyroute2 dependency, for which I didn't find a python3 module
  in Fedora24

this solves #1
2016-11-05 16:33:35 +01:00
Tobias Witek
26f5fd3064 [modules] Re-enable preconfigured on-click actions 2016-11-05 15:28:33 +01:00
Tobias Witek
bd0089dac0 [modules] Re-enable "disk" module 2016-11-05 13:23:46 +01:00
Tobias Witek
286aff2aa0 [output] Allow modules to pass back a single widget
Since "single widget" is the 99% use-case, make it easier for a module
to return a single widget.
2016-11-05 13:12:30 +01:00
Tobias Witek
98acd15edf [theme] Re-implement colorscheme cycling
Again, allow the "default" section to contain cycles that are used one
after the other for each widget.
2016-11-05 11:40:27 +01:00
Tobias Witek
bab7821607 [all] Refactor module <-> output communication
Modules now return "bumblebee.output.Widget" objects, so that they can
actually define a list of items to be drawn in the bar.
2016-11-05 08:59:43 +01:00
Tobias Witek
d62258c89d [all] Major refactoring
Introduce an "Engine" class to abstract some of the details of loading
modules, registering events, etc.
2016-11-04 21:03:12 +01:00
Tobias Witek
b99c454a5a [main] Redraw on click
Whenever a module in the bar is clicked, immediately redraw the line, to
make for a snappier user experience (especially when muting/unmuting).
2016-11-04 19:11:10 +01:00
Tobias Witek
7b62aeb67c [output/i3] Restrict workspace rotation to current output 2016-11-01 08:31:59 +01:00
Tobias Witek
7c2170f58a [i3] Use Popen instead of call - async call
subprocess.call() blocks until the command finishes - Popen is better
for executing in the background :)
2016-11-01 07:58:12 +01:00
Tobias Witek
579381978e [output] Add support for click-events in i3
The i3 output now has a separate thread that continuously monitors stdin
for incoming click events. The generic output class also has methods for
registering callbacks (as commands). For now, by default, scroll events
will be used to emulate the next/previous workspace.
2016-11-01 07:46:26 +01:00
Tobias Witek
f29ddae47a [modules/nic] Fix status display
First, cache lookups were bugged... Second, the output needs to call
data() first, everything else later.

This is a bit nasty, and I'll consider re-visiting this, but right now,
I don't see any other way, given that modules can now be iterated.
2016-10-31 13:09:52 +01:00
Tobias Witek
0f6b418385 [modules] Add NIC module
Add a module that displays the status of all NICs (interface name, list
of IPs and state).

In its status, it also exposes whether it's a WiFi or a wired NIC.

For this functionality, additional code was implemented to allow a
module to add multiple elements to the bar at once. The framework calls
the module until its "next()" method return False.
2016-10-31 13:03:16 +01:00
Tobias Witek
14bce293eb [themes] Add support for generic warning/critical colors
Font and background colors for warning and critical elements can now be
specified using fg-warning, fg-critical, bg-warning and bg-critical.

Also, optionally, the "urgent" flag will be set towards the i3bar, if
possible.
2016-10-31 11:35:12 +01:00
Tobias Witek
2a35905b89 [themes] Add "cycle" theme capability
It is now possible to add a list of theme configurations in the
"default" section called "cycle". These configuration items will be
cycled through module by module. to create "alternate style" effects.
This is *only* possible in the "default" configuration part, but any
module-specific configurations still take precedence.

Also, removed the capability of per-widget themes. That simply
complicates things and probably doesn't really bring any benefits.
2016-10-31 10:45:15 +01:00
Tobias Witek
656c499c95 [themes] Add custom separators
Add the possibility to configure custom separators in the theme file.
These will only be used if the default i3bar separators have been
disabled. Background color will always be taken from the previous
element (to work nicely with my long-term plan, a powerline-like status
line).
2016-10-31 08:14:12 +01:00
Tobias Witek
7b48b08365 [themes] Add font and background colors to themes
Themes can now specify "fg" (font color) and "bg" (background color) on
all levels.
2016-10-31 07:54:18 +01:00
Tobias Witek
8538f272d6 [rework] Replace old-style string formatting with new-style 2016-10-31 07:46:21 +01:00
Tobias Witek
60f63f3269 [themes] Configure presence of default i3bar separators
For each theme & module, it is now possible to configure whether the
default i3bar separators should be drawn or not.
2016-10-31 07:39:26 +01:00
Tobias Witek
3ca53dd0fa [themes] Make individual items theme-able (a bit)
Individual items in the bar can now be configured with a prefix and a
suffix. It works like this:

* If there is a specific module configuration in the theme
  configuration, use that (i.e. { "<modulename>": { "prefix: " a " } })
* Otherwise, if there is a configuration in the "default" section of the
  theme, use that
* Otherwise, if the module object itself has a method called like the
  required attribute (prefix, suffix), use that
* Otherwise, leave prefix/suffix empty ("")
2016-10-31 07:18:57 +01:00
Tobias Witek
4ad41a8ee0 [themes] Add themeing framework
Add - again a very simplistic - method for themeing the output.
Essentially, the plan is to have JSON-formatted configuration files in
bumblebee/themes/ and have a separate class for querying the config
whenever the output needs to know about semantic formatting/coloring.

Note that the theme object is stored on a per-module basis. Right now,
that doesn't have any effect (except looking particularly wasteful), but
the idea is to be able to have different themes for different modules in
the future.
2016-10-30 17:56:04 +01:00
Tobias Witek
4133ae1907 [modules] Initial module loading framework
Add a very simplistic framework for loading modules that query system
data. The user can provide a list of modules via an argument switch, and
the name of the module is used to look up a Python module that has to
have a class called "Module".

The outer framework (the outputs, in particular) then uses various query
methods of that class to construct a meaningful output.
2016-10-30 17:30:09 +01:00
Tobias Witek
c4683f3700 [output] Create preliminary framework for output handling
Prepare a framework for having modular outputs. Essentially, the main
application uses a output-type object to format strings for the
preamble, the actual data items, and a "postamble" (finalizer). The
printing of that representation, again, is up to the main application,
not the output framework.

Probably, at some point in the future, an interface class will be in
order, but right now, I want to keep it lean - seeing as for the
forseeable future, i3bar is going to be the one and only consumer of
this.
2016-10-30 15:58:35 +01:00