Commit graph

2511 commits

Author SHA1 Message Date
Tobias Witek
5d971267db [core/theme] Add preparatory work for themes
Add two new parameters: theme and iconset

Add a placeholder class core.theme.Theme, an instance of which is passed
in to the i3 output object (which is the only object that should ever
have need of the theme, hopefully).
2020-02-09 13:46:56 +01:00
Tobias Witek
b157aa9fb5 [core/output] Minor refactoring - widget assembly 2020-02-09 13:30:40 +01:00
Tobias Witek
4e2a645bd3 [core/input] Separate module/widget update and retrieval
To make it easier to update individual modules, separate the call to
update() and the call to actually drawing the status.

Additionally, this avoids the "side effect" of updating when drawing the
status line.
2020-02-09 13:25:34 +01:00
tobi-wan-kenobi
75cf28a1ea
Merge pull request #545 from somospocos/refactor-draw
Refactor draw
2020-02-09 13:08:31 +01:00
Tobias Witek
5810a12944 [core/output] Start implementation of a partial update
Add a "patch()" method that eventually will only update affected
modules.
2020-02-08 14:22:43 +01:00
Tobias Witek
cc0139e517 [tests/input] Add test for non-callable callback 2020-02-08 14:09:14 +01:00
Tobias Witek
468e30ce66 [main] Add input thread logic and logging
To the main application, add an input thread that "simply" reads
sys.stdin events and transmits them via core.input.

Additionally, set up some initial logging (yeah, for threading, this is
needed immediately)
2020-02-08 13:56:52 +01:00
Tobias Witek
fca364554e [core/output] Add id of widget and module to output
In the process of that, fix a bug in how the parent class constructors
were invoked.
2020-02-08 13:45:52 +01:00
Tobias Witek
4d34fa9261 [core/input] Use util.cli to execute commands
If the registered callback is not callable (i.e. no Python method),
assume it's a command that should be invoked via a shell.
2020-02-08 13:40:51 +01:00
Tobias Witek
9d4936b596 [util/cli] Add new CLI utilities
For now, this just allows executing commands
2020-02-08 13:39:35 +01:00
Tobias Witek
d2240b4ed9 [README] Add nord-powerline 2020-02-08 12:56:15 +01:00
tobi-wan-kenobi
f952eb33bc Merge pull request #544 from uselessthird/nord-powerline-theme
Add nord-powerline theme
2020-02-08 12:53:18 +01:00
John Young
56a482001e Add nord-powerline theme 2020-02-08 11:23:53 +00:00
Tobias Witek
f9267f2131 [core/widget] fix small bug (wrong indentation) 2020-02-07 21:32:20 +01:00
Tobias Witek
e0df8b84e5 [core] Add input handling
Add a (half-finished) input library, that for now simply allows
registration and triggering of events.

As next steps, the trigger will happen as part of a separate thread that
reads input events.

Additionally, invoking commands via a execute() will be supported.

Thirdly, there is need of a way to selectively update the affected
modules (widgets), which should be possible given that the event
contains both the instance (widget ID) and name (module name).
2020-02-07 21:28:29 +01:00
tobi-wan-kenobi
6cce69ff93
Merge pull request #540 from ginsburgnm/use_resources
using pkg_resources
2020-02-07 21:08:23 +01:00
Tobias Witek
1ddcbc454b [modules/pulseaudio] Only start daemon if not running
Before starting the pulseaudio daemon, ensure that it is not running by
using pulseaudio --check.

fixes #542
2020-02-07 21:05:15 +01:00
nginsburg
a19484289e reversing symlinks 2020-02-07 13:33:22 -05:00
nginsburg
dcc42036e8 using pkg_resources 2020-02-04 19:06:26 -05:00
Tobias Witek
a70c82dc4c [modules] Add date, time, datetime
Add modules to show date, time and date and time. Instead of introducing
a "fancy" aliasing mechanism, simply implement time and date in terms of
datetime, by inheriting and overwriting selectively.
2020-02-04 21:10:05 +01:00
Tobias Witek
6adc497f68 [core] Add support for module parameters
Parse '-p' parameters and make them accessible via 'parameter()' from
within a module (basically, restore the previous configuration
facility).

Still TODO: Add support for configuration files.
2020-02-04 21:09:11 +01:00
Tobias Witek
3a531c359f [core/module] Add config to module
Add access for all modules to the commandline parameters (called
"config" in bumblebee-status)
2020-02-03 21:30:06 +01:00
Tobias Witek
74e74bb78b [core/output] Make bar actually work (flush output)
Seems adding a \n isn't sufficient for flushing, instead explicitly
flush stdout to produce a result reliably in the i3bar.
2020-02-02 21:21:24 +01:00
Tobias Witek
eb38e1ce96 [travis] Exclude codeclimate
doesn't run on development branches anyhow, and for some reason produces
errors on python 3.8
2020-02-02 14:42:32 +01:00
Tobias Witek
1801e83322 [tests] Do not show stdout/stderr by default 2020-02-02 14:41:45 +01:00
Tobias Witek
854d7dc470 [modules] Add first "real" module: kernel
Since 'kernel' is small and shows static information, have this be the
very first module added.
2020-02-02 14:41:22 +01:00
Tobias Witek
445c5a65f1 [core/output] Move widget/module handling inside output
The core.output module now manages the list of modules and retrieves the
widgets inside draw() itself. That way, details of drawing/updating
widgets are not visible from the outside anymore.
2020-02-02 14:18:13 +01:00
Tobias Witek
96c7b762b2 [travis] switch to coverage instead of nosetest 2020-02-02 14:06:44 +01:00
Tobias Witek
69eb1ada0d [tests] Move from nosetests to unittest
Since coverage doc says nosetests hasn't been maintained for a while,
switch to unittest.
2020-02-02 13:27:03 +01:00
Tobias Witek
66537fbe05 [core/output] Rewrite to hide sys.stout
Add generic "draw()" method that redirects internally to the actual
calls. These can now produce JSON, which is nicer because:

1. Easier to use during testing
2. More flexible
3. Centralizes printing (somewhat)

Still, the "suffix" concept isn't really nice, but so far, I have no
better approach.
2020-02-01 21:37:38 +01:00
Tobias Witek
3431129536 [doc] Add note where binary for PIP install is found 2020-02-01 14:33:19 +01:00
Tobias Witek
e32f2abfad [setup.cfg] Hopefully fix syntax error 2020-02-01 14:27:45 +01:00
Tobias Witek
cb1b0d7708 [setup] Remove download URL
Wrong format, and I cannot figure out how to get the correct format
(including tgz)
2020-02-01 14:11:32 +01:00
Tobias Witek
3f38f0c3ab [pip] Add themes & icons and make lookup work
Really ugly hack (extending the lookup logic in theme.py) to make pip
themes work, but for now, I am unable to come up with anything better.
2020-02-01 14:04:34 +01:00
tobi-wan-kenobi
7ebf32fcc9
Merge pull request #539 from ginsburgnm/setup_config_bin
python packaging and allowing for pip install usage
2020-02-01 13:27:27 +01:00
nginsburg
7a935790e8 python packaging and allowing for pip install usage 2020-01-31 18:19:50 -05:00
me
ed256a960d extract add_prefix_colors() method 2020-01-31 12:31:38 +02:00
me
64c675150e extract escape_amp() method 2020-01-31 12:27:39 +02:00
me
beff99888b extract add_suffix() method 2020-01-31 12:11:51 +02:00
me
4855b1aa0a extract add_prefix() method 2020-01-31 12:09:45 +02:00
me
2166a26967 make full_text an instance variable
it will be used in more than one method
2020-01-31 12:04:44 +02:00
me
1f0f1c1722 make markup an instance variable
it will be used in more than one method
2020-01-31 12:00:15 +02:00
me
ea1c0b7043 query config for markup before processing prefix/suffix 2020-01-31 11:56:07 +02:00
me
333a1f9907 only query config for markup value once 2020-01-31 11:53:25 +02:00
me
a3cfe0abbe create variable just before using it 2020-01-31 11:47:21 +02:00
me
4a7a26456d make prefix/suffix instance variables
they will be used in more than one method
2020-01-31 11:44:07 +02:00
me
9d8c1f910e when there's nothing to return, do it ASAP 2020-01-31 11:37:42 +02:00
me
289a40ff72 add JSON separator block at the beginning of draw() 2020-01-31 11:34:17 +02:00
me
8a16d3cb3a extract method 2020-01-31 11:30:48 +02:00
me
e2bc263520 [fix] always return a list, even empty 2020-01-31 11:19:59 +02:00