Commit graph

2618 commits

Author SHA1 Message Date
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
df27355977 [tests] Add framework for unittests 2016-11-05 07:54:16 +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
Tobias Witek
47935942f0 [engine] Reformat a bit (line breaking)
Break some extensively long lines
2016-11-04 21:18:07 +01:00
Tobias Witek
ea27ccb2c1 [output] Add waiting capability to output
Engine now calls wait on output for further data, is interrupted
on new data.
2016-11-04 21:10:21 +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
a6bdd0557c [doc] rename i3bumblebee -> bumblebee-status
As the prefix i3* is reserved for official i3 packages, rename
i3bumblebee to bumblebee-status.
2016-11-04 20:20:46 +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
89b97d7283 [modules/dnf] Only do update check every 'interval'
Yet another bug in the DNF module - really a troublesome one. Only call
the dnf updateinfo every interval, not every second. That significantly
reduces CPU load.
2016-11-04 19:01:19 +01:00
Tobias Witek
1f440673a8 [main] Small refactoring
Put some functionality into separate methods for better legibility.
2016-11-04 18:56:45 +01:00
Tobias Witek
fb6337c625 [modules/dnf] DNF module was not updating properly
Due to name-clashing of the datetime module's "time" alias, time.sleep
didn't work (as it was looked up from the i3bumblebee module),
consequently, the DNF poll thread exited.

While at it, "beautify" the thread cancelling a bit by waiting until
the main thread is not running anymore.
2016-11-04 18:50:38 +01:00
Tobias Witek
6e8acc2765 [modules/memory] Show used instead of free RAM 2016-11-03 19:45:48 +01:00
Tobias Witek
29131e2f65 [modules/nic] Exclude docker and vbox interfaces
Until I have a clue on how to correctly handle them, exclude
docker and vbox network interfaces.
2016-11-03 19:45:12 +01:00
Tobias Witek
5532526595 [modules/dnf] Fix a bug wrt. counter extraction
Bugfixes and enhancements were wrongly extracted.
2016-11-03 19:44:34 +01:00
Tobias Witek
6fa7f9d789 [modules/disk] Show used instead of free disk 2016-11-03 19:44:11 +01:00
Tobias Witek
329f546879 [modules/battery] Cap capacity at 100%
Seems like my laptop at work is overly enthusiastic when it comes to
charging. I don't believe in 105% capacity.
2016-11-03 19:43:30 +01:00
Tobias Witek
7b62aeb67c [output/i3] Restrict workspace rotation to current output 2016-11-01 08:31:59 +01:00
Tobias Witek
4c34cd37d4 [modules] Add default click events to various modules
* cpu+memory: Open "gnome-system-monitor"
* disk: Open nautilus
* pulseaudio: Mute/unmute, open "pavucontrol" on right-click, raise/lower
  volume on mouse wheel up/down
2016-11-01 08:18:46 +01:00
Tobias Witek
fca3171556 [modules] Allow modules to provide default click actions
Pass the "output" object to the modules' constructor to allow them to
define their own callbacks.
Any user-provided callbacks take precedence and override those of the
module.
2016-11-01 08:09:10 +01:00
Tobias Witek
63e041259f [main] Add commandline parameter for specifying events
Allow a user to specify click events with the following format:

-e "<module name><splitter><button ID><splitter><command to execute>"

for example:

-e "disk::1::nautilus {instance}"
2016-11-01 07:59:39 +01:00
Tobias Witek
a63094af47 [output] Using "instance" for callback registration doesn't make sense
"instance" is actually better suited to be an argument to the callback
(which it already is) than part of the key for callback lookup.
2016-11-01 07:58:50 +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
36ff727165 [doc] More linebreaks 2016-10-31 20:02:04 +01:00
Tobias Witek
35c14da6ef [doc] Add small thank-you note to README 2016-10-31 19:57:37 +01:00
Tobias Witek
8c4720d425 [doc] Add sample screenshots for individual modules 2016-10-31 19:36:15 +01:00
Tobias Witek
9cbb3c67bd [doc] Add some more info to the README 2016-10-31 18:28:44 +01:00
Tobias Witek
d28a608fa7 [doc] Add some README.md 2016-10-31 18:27:39 +01:00
Tobias Witek
ceeb4b2136 [doc] Updated screenshots for better visibility
Shorter, but bigger font size
2016-10-31 18:13:54 +01:00
Tobias Witek
43fcbd9306 [doc] Add updated themes and screenshots 2016-10-31 17:58:50 +01:00
Tobias Witek
9b17cf619e [main] Fix a small typo in the help text 2016-10-31 17:29:32 +01:00
Tobias Witek
a0f6b193ca [main] Make module/argument splitter string configurable
It's still hacky, but not as bad: The user can now configure the
separator between module and arguments.
2016-10-31 16:51:34 +01:00
Tobias Witek
f02c49286b [main] Add available themes to listing output 2016-10-31 16:47:34 +01:00
Tobias Witek
c0421163d4 [doc] Add description, usage and notes to all modules 2016-10-31 16:08:03 +01:00
Tobias Witek
598f3e70e9 [main] Initial support for "-l" parameter
List all available modules and query their description, notes and usage.
2016-10-31 15:49:15 +01:00
Tobias Witek
b2e9515861 [themes/solarized-powerline] switch default colors 2016-10-31 15:31:07 +01:00
Tobias Witek
f72d905d97 [modules] Add "spacer"
Add a very, very basic module that simply adds a spacer (and empty
element) to the bar.
2016-10-31 15:23:59 +01:00
Tobias Witek
bcf0264f99 [modules] Add DNF supervision module
Add a module that periodically (by default, once every 30min) calls
"dnf updateinfo" and evaluates the results to report the number of
bugfixes, enhancements, etc.

If there's either too many pending updates, or at least one security
update, the module goes critical.
2016-10-31 15:17:51 +01:00
Tobias Witek
b3e17d4899 [modules/date] Combine to datetime module with date and time aliases
Move module "date" to "datetime" (display both date and time), and
create new aliases "time" and "date" (which only show date and time,
respectively).
2016-10-31 14:39:52 +01:00
Tobias Witek
b0608c7054 [modules] Add pulseaudio control modules
Add a module that retrieve mute status and volume (left, right, mono)
from pulseaudio. Unfortunately, this module is really, really hacky. It
invokes "pactl" multiple times to get the status and does some ugly
parsing on the output.

Overall, this is pretty brittle and prone to failure, but as I was not
able to find a decent pulseaudio library for Python... Probably, I
haven't searched hard enough, cannot believe such a thing does not
exist.
2016-10-31 14:27:51 +01:00
Tobias Witek
bb6ca556c7 [modules] Add support for disk utilization
Add a new module "disk" that takes an optional parameter (the path) and
displays free & total disk space, along with the usage percentage.

Also, added Tunnel/VPN support to the themeing of the "net" module.
2016-10-31 13:34:48 +01:00
Tobias Witek
b235ae88a4 [gitignore] ignore vim swap files 2016-10-31 13:34:20 +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
dbd8ccb83f [themes] Add a solarized powerline theme 2016-10-31 12:20:39 +01:00
Tobias Witek
2f38aad0e7 [main] Make update interval configurable
Commandline switch "-i|--interval" to specify the update interval.
2016-10-31 12:18:18 +01:00
Tobias Witek
9e89e35d10 [modules] Add module for measuring CPU utilization
Add module "cpu", which uses psutil to measure CPU utilization between
two consecutive calls.
2016-10-31 12:16:23 +01:00
Tobias Witek
36333c275f [modules] Add module for displaying RAM usage
Shows free RAM, total RAM, free RAM percentage
2016-10-31 12:11:39 +01:00