Commit graph

93 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
8d53b2bedd [modules/pacman] Slightly adapt the path calculation logic 2016-11-25 17:10:02 +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
Pavle Portic
d2e3a19269 [modules/caffeine] Fix times for screen on time 2016-11-23 14:08:34 +01:00
Pavle Portic
be6559a251 [modules/caffeine] Add caffeine module to prevent sleep 2016-11-23 13:57:29 +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
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
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
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
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
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
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
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
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