Commit graph

299 commits

Author SHA1 Message Date
Tobi-wan Kenobi
666daff9a6 [modules/pulseaudio] Re-enable pulseaudio module
Display volume for default PulseAudio source/sink, change volume and
mute/unmute device.

see #23
2016-12-11 08:51:56 +01:00
Tobi-wan Kenobi
23d7d53fca [modules] critical/warning threshold refactoring
Quite a lot of modules use the "if higher X -> critical, if higher Y ->
warning" idiom now, so extracted that into a common function for reuse.

see #23
2016-12-11 08:25:54 +01:00
Tobi-wan Kenobi
edfccd2d31 [modules/spacer] Re-enable "spacer", the text-display widget
see #23
2016-12-11 08:17:37 +01:00
Tobi-wan Kenobi
c8fc75a401 [modules/load] Re-enable load module
Display system load and show warning/critical error when load is above a
certain threshold (compared to the number of available CPUs).

see #23
2016-12-11 08:01:43 +01:00
Tobi-wan Kenobi
1a4cddb0b6 [core] Fix callback registration ("shadowed" events)
Until now, as soon as a widget registered *any* callback, the default
callbacks (e.g. scroll up/down to go to next/previous workspace) didn't
work anymore, as there was a better match for the general registration
(even though not for the button).

To fix this, merge the callback registration into a flat registration,
where a key is calculated from the ID of the registrar and the
registered button.

see #23
2016-12-11 07:38:56 +01:00
Tobi-wan Kenobi
d91294f010 [modules/battery] Fix ac and unknown display
If the computer runs on AC, display that instead of showing "100%" in
the status.

Also, if reading the charging status fails for some reason (except the
computer being on AC), go into critical state and display "n/a".

see #23
2016-12-11 07:28:15 +01:00
Tobi-wan Kenobi
2cc2cf8282 [core/engine] Add aliasing mechanism to modules
Allow modules to define aliases. This replaces the symlink mechanism
that was in place previously, because it was a bit ugly (and confused
code climate).

see #23
2016-12-11 07:18:06 +01:00
Tobi-wan Kenobi
a1455c9687 [modules/battery] Handle inexistent battery more gracefully 2016-12-10 19:54:31 +01:00
Tobi-wan Kenobi
14b8feeef1 [modules/datetime] Add help text 2016-12-10 19:30:25 +01:00
Tobi-wan Kenobi
d41c142d4a [modules/memory] Re-enable memory usage module
Add module that shows RAM consumption and opens the gnome-system-monitor
on click.

see #23
2016-12-10 19:20:19 +01:00
Tobi-wan Kenobi
e15147fe10 [tests/disk] Add critical/warning threshold tests for disk module
see #23
2016-12-10 18:49:25 +01:00
Tobi-wan Kenobi
8f6bb7b45d [core/input] Remove "valid input required" logic from input
Accidentially committed a experimental way to enforce waiting for a
valid input, mainly for testing.

see #23
2016-12-10 18:22:05 +01:00
Tobi-wan Kenobi
12f5ce5977 [modules/disk] Re-enable disk usage module
Add a module that shows the disk usage for various paths and opens
nautilus on that path whenever it is clicked.

see #23
2016-12-10 18:21:01 +01:00
Tobi-wan Kenobi
771c597ce9 [modules/caffeine] Re-implement caffeine module
Add caffeine module & add a framework for testing it (no tests yet,
though).

see #23
2016-12-10 15:36:18 +01:00
Tobi-wan Kenobi
163419063d [tests/battery] Add some tests for the battery module
see #23
2016-12-10 14:50:49 +01:00
Tobi-wan Kenobi
1b8385b33f [modules/brighness] Re-enable brightness module
Add a module for reporting, increasing and decreasing the brightness of
a display.

see #23
2016-12-10 14:31:18 +01:00
Tobi-wan Kenobi
029492e16d [core] Non-blocking input thread for i3bar events
Make input thread non-blocking by using select(). This increases the CPU
utilization a bit (depending on the timeout), but makes the thread exit
cleanly, even if an exception is thrown in the main thread.

see #23
2016-12-10 13:45:54 +01:00
Tobi-wan Kenobi
0489ce1b51 [core/engine] Register wheel up/down callbacks for desktop switch
Switch desktop to prev/next on wheel up/down.

see #23
2016-12-10 12:14:12 +01:00
Tobi-wan Kenobi
7ea8c5320d [modules] Add help texts
see #23
2016-12-10 12:03:58 +01:00
Tobi-wan Kenobi
4d4a7bf29d [modules/battery] Re-enable battery module
Extend theme to be able to accept lists of values and cycle through
them. Use this to "animate" the charging symbol for the battery.

see #23
2016-12-10 12:00:08 +01:00
Tobi-wan Kenobi
72e375ac8b [modules/nic] Check for vanished interfaces
If a widget exists for an interface that is not there anymore (i.e. a
tunnel interface that has been removed, or a USB device that has been
unplugged), remove that widget from the list.

see #23
2016-12-10 11:33:35 +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
c820223d0c [core/input] Execute commands in background
When spawning a command from an input interaction, do it in the
background, so as to not block further interactions.

see #23
2016-12-10 10:47:23 +01:00
Tobi-wan Kenobi
918d7a6046 [core/input] Add callback deregistration
Enable components to unregister callbacks (i.e. for dynamic widgets).

see #23
2016-12-10 10:26:07 +01:00
Tobi-wan Kenobi
761b81970d [modules/cpu] Pad to 3 digits before comma to fix width
I cannot get the min_width property to work right now, so in order to
fix the width of the CPU widget, pad the utilization to 3 digits (so
that even 100% aligns nicely).

see #23
2016-12-10 09:04:12 +01:00
Tobi-wan Kenobi
38a42e4a77 [tests/cmus] Add tests for cmus mouse interaction
see #23
2016-12-10 08:37:04 +01:00
Tobi-wan Kenobi
b1ec41f905 [modules/cmus] Add mouse controls
Enable play/pause, repeat/shuffle toggle, next/prev song by clicking on
the various elements in the bar.

see #23
2016-12-10 08:19:24 +01:00
Tobi-wan Kenobi
1a3217bb5f [modules/cmus] Add status callback
Inform the theme about the current playback status (start, stop, repeat,
shuffle).

see #23
2016-12-10 08:16:27 +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
59fb47ae3b [all] pylint cleanup 2016-12-09 11:57:13 +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
0c7884d170 [all] pylint refinements
Improve code by bringing up the pylint score a bit.

see #23
2016-12-09 08:43:14 +01:00
Tobi-wan Kenobi
252260c249 [modules/datetime] Use parameter functionality to get format
Make the format string of the datetime module configurable using the new
parameter() method in the module.

Also, restructured the setting of the config information a bit so that
the parameter() method can be used in the constructor of a module.

see #23
2016-12-09 08:23:53 +01:00
Tobi-wan Kenobi
f33711f49f [core] Pass configuration parameters to modules
User can now use -p <key>=<value> to pass configuration parameters to
modules. For this, the module gets a "parameter()" method. Parameter
keys are in the format <name>.<key> where <name> is the name of the
loaded module. This is either the name of the module itself (e.g. "cpu")
or its alias, if the user specified it, for example:

bumblebee-status -m cpu -p cpu.warning=90

vs.

bumblebee-status -m cpu:test -p test.warning=90

see #23
2016-12-09 08:00:26 +01:00
Tobi-wan Kenobi
c8a51b416f [core] Add "Store" interface
Add an interface that allows arbitrary objects to store/retrieve
arbitrary key/value pairs. This will be used for different purposes in
the future:

* Config class(es) can store user-defined parameters for modules
* Widgets can store state
* ???

see #23
2016-12-09 07:41:07 +01:00
Tobi-wan Kenobi
a7e756e015 [tests] Generic module tests
Add a helper function that lists all existing modules and modify the CPU
module test so that it now generically iterates all available modules
and tests their widgets.

see #23
2016-12-09 07:27:01 +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
562fd85ca2 [core/theme] Add support for icon themes
Allow sub-themes ("iconsets") to be merged into the "main" theme. That
way, effectively, it's possible to define colors and icons in separate
JSON files.

see #23
2016-12-08 12:09:21 +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
2399cf9af1 [core/themes] Add theme loading
Load a theme from a JSON file.
2016-12-08 09:44:05 +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
60ae92c8e3 [core/themes] Prepare adding of themeing support
* Add framework JSON definition for themes
* Add framework test module
* Add framework module

see #23
2016-12-04 18:10:04 +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
8855f1155b [core/errors] Add custom exceptions
Add custom exceptions and add error handling to the engine's module
loading logic. I.e. when a non-existent module is loaded, an exception
is thrown now.

see #23
2016-12-04 16:23:44 +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
a2c6214baa [core/engine] Add module loading logic
Allow the engine to load modules from the bumblebee/modules/ directory.

see #23
2016-12-04 11:09:10 +01:00
Tobi-wan Kenobi
cf1693548b [engine] Add initial version of event loop engine
Re-add the engine that is responsible for tying together input, output,
etc.

see #23
2016-12-04 08:37:56 +01:00
Tobi-wan Kenobi
a7eff64294 [lint] Add tool to run pylint on all files
pylint all *.py files and fix the errors reported so far.
2016-12-04 08:02:40 +01:00
Tobi-wan Kenobi
9a5a6d354a [core/config] Add module aliases
Allow the user to provide aliases when loading a module multiple times
so that the modules can be differentiated (e.g. for passing parameters
to a module).

see #23
2016-12-03 20:54:57 +01:00
Tobi-wan Kenobi
a720baf407 [tests] Add Python3 test run
Add testrun to also verify Python3 functionality.

+ Immediately fix a Python3 incompatibility.

see #23
2016-12-03 20:45:52 +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
20858991b9 [theme] Fix cycling through widget styles
Cycled widget styles (such as the battery charging style) were broken
until now. The reason for this: They maintain state that represents the
current cycle position (i.e. what is the current icon that is being
displayed), but that is done in a way that uses repr() on the widget
object.

Since the widget objects are re-created each time the bar is drawn, this
is a deeply flawed design.

Instead, use the instance() of the widget for now.
2016-12-02 22:35:28 +01:00
Tobi-wan Kenobi
31067159d6 [modules/nic] Minor refactoring
Remove impractical cache.
2016-12-02 19:06:47 +01:00
Tobi-wan Kenobi
2f3f171ca5 [core] Remove alias from module
Hide alias concept for modules in the engine. That way, the individual
modules never get to know about whether a module has been aliased or
not.

see #23
2016-12-02 18:53:34 +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
a93fa4aa5c Merge branch 'master' into icon-themes
* separate color themes from icons
* each theme can now use one or more icon themes
* icons are chosen in a "first match" fashion

fixes #17
2016-12-02 17:18:01 +01:00
Tobi-wan Kenobi
f4b114bd6e [modules/nic] Add list of excluded interface prefixes as parameter
"nic.exclude" is now a parameter that can be used to have a custom list
of excluded interface prefixes. Multiple prefixes should be separated by
a comma.

fixes #26
2016-11-30 18:11:32 +01:00
hubertst
e9731b1063 Update nic.py
Exclude veth* interfaces created by minimesos
2016-11-30 11:07:27 +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
Tobi-wan Kenobi
4819147410 [modules/layout] Add autodetection and auto-adding of languages
Whenever the language is changed outside the bar, update the bar
accordingly. Also, when a new language is used, automatically append it
to the list of available languages.
2016-11-27 19:48:12 +01:00
Tobi-wan Kenobi
ca64851687 [modules/disk] Fix multi-instance disk 2016-11-27 18:36:45 +01:00
Tobi-wan Kenobi
28a4f4ab9d [core] Fix import error for Python3
Import exceptions module only for Python2.

fixes #22
2016-11-27 18:33:37 +01:00
Tobi-wan Kenobi
60d96506e8 [modules/layout] Add rotation logic and language parameter
User can now specify a list of languages as parameter (pipe-separated
list). Variants can also be specified by separating language and variant
with a :

For instance: -p layout.lang="us|rs:latin"

Left click moves on to the next language, right click to the previous.

Right now, there are the following caveats:
* The first entry in the list must be the language used when the bar
  starts
* kxbd changes outside the bar are not picked up automatically
2016-11-27 18:08:22 +01:00
tobi-wan-kenobi
1f1e7748a3 Merge pull request #21 from Pseudonick47/master
Keyboard layout module
2016-11-27 17:33:40 +01:00
Milos Miljanic
488c17ea58 [modules]Keyboard layout 2016-11-27 16:24:11 +01:00
Tobi-wan Kenobi
e8b3dfb4ef [modules/xrandr] Add display on/off toggling
This one is a bit tricky:
* Clicking on an active xrandr output will disable it
* Clicking on a disabled xrandr output will enable it -> if
  it is a left-click, it will put it as the left-most display
  if it is a right-click, as the right-most display

Also, it will reload the i3 bars (using a script that allows
you to write custom pieces of an i3 configuration that is applied
conditionally depending on the screens you have).

It goes like this:
* Base config is in ~/.i3/config.template
* Output-specific config is in ~/.i3/config.<screen name>
* Output-specific config when other screens are also active is in
  ~/.i3/config.<screen>-<other-screens-in-alphabetic-order>

For instance:
$ ls ~/.i3
config.template
config.eDP1 -> will be applied to eDP1 (always)
config.VGA1-eDP1 -> will be applied to VGA1, if eDP1 is also active
config.VGA1 -> will be applied to VGA1 (if eDP1 is inactive)

fixes #19
2016-11-26 13:57:33 +01:00
Milos Miljanic
ce6133acd4 Merge branch 'master' of https://github.com/tobi-wan-kenobi/bumblebee-status 2016-11-26 12:36:40 +01:00
Milos Miljanic
59c0083fc4 Change keyboard layout (not done yet) 2016-11-26 12:33:42 +01:00
Tobi-wan Kenobi
3cc34d36a5 [documentation] Updated all screenshots to be more uniform
Also, added xrandr screenshots
2016-11-26 09:09:11 +01:00
Tobi-wan Kenobi
c095b89022 [modules/xrandr] Sort display widgets by position
Show display widgets from left to right according to their relative
xrandr position.

see #19
2016-11-26 08:46:16 +01:00
Tobi-wan Kenobi
4ea0cfae1e [modules/xrandr] Add module to show attached displays
This modules shows attached displays and their states (on or off).
Future versions of this module will order the icons by the relative
order of the screens (left-to-right) and will allow switching monitors
on and off.

see #19
2016-11-26 08:28:19 +01:00
Tobi-wan Kenobi
f31c0e492d [modules] Add initial version of a load module
Add a load module that shows 1/5/15 minute load average and allows the
user to set warning and critical thresholds on the 1 minute average.

fixes #9
2016-11-25 21:45:30 +01:00
Tobi-wan Kenobi
209fa83324 [themes] Make it possible to merge themes to get "icon themes"
Add code that allows themes to be merged (i.e. if certain elements are
not present in a theme, another theme can be "overlaid" to add missing
elements).

Effectively, this is used to create the logical concept of an "icon
theme", which is loaded after the main theme. So, the main theme can
define colors, and the icon theme fills in any missing elements
(practically, all the icons in the form of prefixes and suffixes).

Icon sets are defined in a theme using the "icons" directive, which
should be an array.

see #17
2016-11-25 21:06:24 +01:00
Tobi-wan Kenobi
f6db8b0a85 [themes] Move theme folder out of Python folder
fixes #16
2016-11-25 17:57:41 +01:00
Tobi-wan Kenobi
8d53b2bedd [modules/pacman] Slightly adapt the path calculation logic 2016-11-25 17:10:02 +01:00
Tobi-wan Kenobi
8ceeac84c0 [customupdates] move bin/ directory to a different location 2016-11-25 17:05:49 +01:00
Milos Miljanic
64c6a307c8 [modules] Show updates for pacman. 2016-11-24 19:01:48 +01:00
Tobi-wan Kenobi
027541126d [modules/caffeine] Enable status change notifications
Now that multi-command callbacks work, enable caffeine status change
notifications via "notify".
2016-11-23 18:29:05 +01:00
tobi-wan-kenobi
f967eafe99 Merge pull request #14 from paxy97/master
Add caffeine module
2016-11-23 18:26:36 +01:00
Tobi-wan Kenobi
c1123fa083 [output] Accept lists of commands in add_callback
Add the possibility to specify a list of commands to be added as
callbacks. Commands will be executed one after the other, waiting for
the previous command to finish execution.
2016-11-23 18:24:02 +01:00
Pavle Portic
d2e3a19269 [modules/caffeine] Fix times for screen on time 2016-11-23 14:08:34 +01:00
Pavle Portic
5faba39643 [themes] Add caffeine module support 2016-11-23 14:04:33 +01:00
Pavle Portic
be6559a251 [modules/caffeine] Add caffeine module to prevent sleep 2016-11-23 13:57:29 +01:00
Tobi-wan Kenobi
d66087a768 [themes] Add "ac" state for battery to all themes
Except for gruvbox-powerline, all themes were missing the new "ac" state
of the battery.
2016-11-19 07:14:12 +01:00
tobi-wan-kenobi
5149991ff3 Merge pull request #13 from paxy97/master
Missing battery fix and gruvbox theme
2016-11-18 20:03:34 +01:00
Tobi-wan Kenobi
0c9177cb79 [modules/ping] Allow recovery from unreachable
Due to a bug, when the destination was unreachable, the checking thread
would terminate, effectively keeping the widget stuck in "unreachable"
mode.

Now, enable recovery by keeping the thread running even if the target is
not reachable for some time.
2016-11-18 19:47:28 +01:00
Pavle Portic
9cf2a092da [themes/gruvbox] Fix cmus icons 2016-11-17 23:21:05 +01:00
Pavle Portic
a14483ec37 [themes] Add gruvbox theme 2016-11-17 23:02:57 +01:00
Pavle Portic
3293cbaac4 [modules/battery] Display AC when no battery is present 2016-11-17 23:02:49 +01:00
Tobi-wan Kenobi
d37068b442 [modules/cmus] Always initialize variables
Initialize shuffle and repeat status variables even if cmus is not
running at all.
2016-11-15 20:35:35 +01:00
Tobi-wan Kenobi
36d723e7e6 [modules/memory] Adapt limits
Limits are now actually against the amount of memory used, instead of
memory still free (more intuitive).

fixes #12
2016-11-15 20:34:14 +01:00
Tobi-wan Kenobi
8b78b20d11 [themes] Remove default.yaml
Maintaining 2 separate theme files for the same theme is a bit
redundant, so for consistency's sake, stay with JSON only.
2016-11-12 12:12:47 +01:00
Tobi-wan Kenobi
dead54ed1f [modules/cmus] Add controls for cmus (next/prev/shuffle/repeat)
Add controls that allow the user to switch to the next and previous song
in cmus, toggle shuffle and repeat. Pause/play is toggled by clicking on
the song title itself.

fixes #5
2016-11-12 12:11:42 +01:00
Tobi-wan Kenobi
a33cb1d7cb [output] remove unused line of code 2016-11-12 08:42:39 +01:00
Tobi-wan Kenobi
418dc1be86 [modules/cmus] Make displayed string configurable
Allow the user to use all tags read by cmus (cmus-remote -Q|grep ^tag)
as part of the displayed data (plus the special 'tags' "duration" and
"position").
2016-11-12 08:34:21 +01:00
Tobi-wan Kenobi
e4ff22f1e0 [themes] Add brightness and cmus module support
Add themeing for brightness and cmus
2016-11-09 19:39:12 +01:00
Tobi-wan Kenobi
a43938b1c8 [modules/cmus] Add vim line + change default text
Slightly adapt default text to indicate that cmus is not running.
2016-11-09 19:38:32 +01:00
Tobi-wan Kenobi
ba466d5179 [modules/brightness] Add callbacks for increasing/decreasing brightness
Use xbacklight to increase or decrease brightness when the user uses the
mouse wheel over the brightness widget.
2016-11-09 19:37:09 +01:00
Tobi-wan Kenobi
f164aee5c9 [modules/brightness] Add missing integer casting for calculation
To display a nice percentage-based brightness, round it to int in all
circumstances.
2016-11-09 19:32:26 +01:00
Pavle Portic
56524ce54b Add Cmus player module 2016-11-07 22:14:46 +01:00
Pavle Portic
3a19be09c3 Add brightness module 2016-11-07 22:00:02 +01:00
Tobias Witek
af6055bd83 [modules/nic] Interfaces were always up
Wrong initialization of the status variable led to interfaces that were
always in up state.
2016-11-06 10:59:25 +01:00
Tobias Witek
b6c430a8da [themes] Update battery themes
Names of discharging states have changed.
2016-11-06 10:57:42 +01:00
Tobias Witek
89f49856d9 [modules/nic] Too many addresses per interface
Addresses were not cleared correctly, resulting in too many IPs being
displayed for the second, third, etc. interface.
2016-11-06 08:21:33 +01:00
Tobias Witek
749a9761b2 [modules/dnf] Fix for python2
This usage of split actually broke python2.... Wonder why I never
noticed that before.
2016-11-05 20:04:04 +01:00
Tobias Witek
6de18f831d [modules] Add module to measure the RTT of an address
The module simply calls the external tool "ping" to retriev RTT
information and displays the average RTT in the widget.

Addresses issue #6
2016-11-05 19:55:43 +01:00
Tobias Witek
e2a6d41389 [theme] Add YAML as optional format for themes
This addresses issue #4
2016-11-05 16:53:34 +01:00
Tobias Witek
6eea8da1af [output] bugfix: enable scroll-wheeling again
The callback registration/lookup logic was flawed, so that callbacks
without module name were never executed.
2016-11-05 16:39:46 +01:00
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
caceb6f20f [help] Update and beautify the commandline help output 2016-11-05 16:18:53 +01:00
Tobias Witek
3af8ee771d [general] Refactoring
* remove (hopefully) unnecessary import statements
* make some code a bit more compact
* remove dead code ... again: hopefully so
2016-11-05 15:54:34 +01:00
Tobias Witek
e889098c77 [modules/disk] Remove "custom" instance callback
This callback just makes it really hard to see for the user what is
going on. The alias the user provides should *always* match the
instance, so that it can be used in a meaningful way in the click
action, for example (otherwise, something like "nautilus {instance}"
gets really hard to interpret.
2016-11-05 15:45:33 +01:00
Tobias Witek
67142d642b [module/output] Re-enable user configurable mouse click events
This is now much nicer implemented to address issue #3. A user can now
have a configuration parameter mapped to a module instance (via the
module name or the instance name) with the value "left-click",
"right-click", etc., like this:

-m disk:home -p home.left-click="nautilus {instance}"
2016-11-05 15:39:21 +01:00
Tobias Witek
26f5fd3064 [modules] Re-enable preconfigured on-click actions 2016-11-05 15:28:33 +01:00
Tobias Witek
c821deec1c [modules/time] bugfix: Use module instance format 2016-11-05 14:43:03 +01:00
Tobias Witek
2d873387ea [modules] Re-enable DNF module 2016-11-05 14:37:07 +01:00
Tobias Witek
4e648cf009 [modules] Add module-specific configuration
Big oversight in my previous commits: Widgets need to be able to have
specific configurations (i.e. the path for different instances of the
"disk" module has to be different).

To account for that, it is now possible to assign an "alias" to a module
instance using ":" (for example: -m "disk:home"). This alias is then
used for the configuration parameter resolution automatically, for
example:

-m disk:home -p home.path=/home

As a consequence, parameter names in the module code are now relative to
the module, which means: shorter!
2016-11-05 14:26:02 +01:00
Tobias Witek
9f9b27ad7a [modules] Re-enable spacer 2016-11-05 13:53:08 +01:00
Tobias Witek
fb466bfd91 [modules] Re-enable pulseaudio modules 2016-11-05 13:50:51 +01:00
Tobias Witek
db8737a6aa [modules/nic] Add interface type cache to avoid too many open files
Repeatedly querying the interface type the way I'm doing right now
results in "too many files open" pretty quickly. Obviously, it's a bit
of a concern that I am leaking a file descriptor somewhere, but for now,
the quickfix is to cache the type (it shouldn't change, anyhow).
2016-11-05 13:47:27 +01:00
Tobias Witek
a9a62a738d [modules] Re-enable nic module + allow widget states
All callback from a widget into a module (e.g. for retrieving the status
or the criticality state) now get a widget passed. This has the purpose
of allowing a module to store state/widget specific data somewhere. This
way, for instance, it is possible to store the interface name as part of
the widget, thus making it possible to show the status of the correct
interface.
2016-11-05 13:42:26 +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
2cfb0997a0 [modules] Re-enable battery module
Enable battery module with new states:
* discharging-[10,25,50,80,100]
* charging
* charged
2016-11-05 13:09:28 +01:00
Tobias Witek
18d7e1befb [config] Allow parameter passing via commandline
Allow the user to specify arbitrary configuration parameters from the
commandline and evaluate those in the modules (and elsewhere). Re-enable
the CPU module as a first showcase of this functionality.
2016-11-05 12:28:05 +01:00
Tobias Witek
353c47d76e [general] Very minor refactoring 2016-11-05 12:18:30 +01:00
Tobias Witek
73d62d7ded [widgets] Pass through some information to the underlying module object
For determining status, critical/warning state, etc. simply let the
widget pass through a call to the underlying object.
2016-11-05 12:14:33 +01:00
Tobias Witek
2f0cc30c38 [config] Write custom action for printing theme/module details 2016-11-05 12:07:54 +01:00
Tobias Witek
998db40a2d [theme] Re-implement rotation of values for theme entries
Allow theme entries to be lists that are then iterated. For this
purpose, extend the Config class so that it can serve as generic store
for data items. That makes it easy to centralize code used for rotation
etc. in a single place.
2016-11-05 11:57:09 +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
7f91b8298f [modules] Refactor module initialization
Modules now get an output and a complete config object. This should make
customization much easier in the future.
2016-11-05 08:11:08 +01:00
Tobias Witek
c2adf38b92 [engine] Remove obsolete Argument class 2016-11-05 08:00:47 +01:00
Tobias Witek
a8b29ed22e [config] Beautify help output a bit 2016-11-05 07:59:58 +01:00
Tobias Witek
a58610f3ee [config] Start refactoring by creating separate config class
Add a class that will hold all configuration and argument information
and serve as central repository for this kind of information.
2016-11-05 07:54:36 +01:00
Tobias Witek
9da9fdaaa5 [engine] Add missing import 2016-11-05 06:47:22 +01:00
Tobias Witek
55474aadc3 [general] Minor refactoring
Shuffled some code around in an attempt to make it easier to read and
understand.
2016-11-04 21:41:22 +01:00