Commit Graph

221 Commits

Author SHA1 Message Date
Facetoe
3dd5065c89 Add toggle to enable keep_alive feature. (#610)
Not all users execute i3pystatus directly, and this can cause issues
when i3bar sends the SIGUSR2 signal. This commit places the keep_alive
feature behind a flag in the Status module to be selectivly enabled by
those that want to use it.

Solves #609.
2017-09-24 14:36:57 +08:00
Facetoe
c044d1ff67 Add module "keep_alive" feature. (#601)
By default, i3bar sends SIGSTOP to all children when it is not visible (for example, the screen
sleeps or you enter full screen mode), stopping the i3pystatus process and all threads within it.
For some modules, this is not desirable. This commit makes it possible for modules to define the
"keep_alive" flag to indicate that they would like to continue executing regardless of the state of
i3bar.
2017-08-10 10:41:48 +08:00
Facetoe
fc2ae2a387 Fix regression introduced in #595. (#597)
Whenever the connecting to the remote server fails, query DNS and cache the result. This
should reduce the number of DNS requests the internet predicate
generates without changing the behaviour.
2017-07-28 19:06:22 +08:00
Facetoe
351738f33d Reduce overhead of internet predicate. (#595)
* Reduce overhead of internet predicate.

* Use 8.8.8.8 instead of google-public-dns-a.google.com save a DNS lookup.

* Use time.perf_counter instead of time.time().

Allow user to configure check frequency.
2017-07-19 13:52:27 +08:00
Matti Niemenmaa
c6f9202380 core/desktop: don't crash if gi exists but is empty (#314)
Many packages install something into gi/overrides. If the gobject
package itself is not installed, the import of gi succeeds but
require_version is not contained within, resulting in an AttributeError.
2017-06-26 17:36:19 +02:00
Facetoe
1db757a2e2 Fix bug that prevented module errors being displayed in bar (#586)
* Fix bug that prevented errors being shown in bar.

* Add tests to ensure errors are visible in the bar.
2017-06-16 14:34:24 +07:00
Facetoe
4ec39cacb0 Prevent battery module spamming notifications. (#581)
* Prevent battery module spamming notifications.

Raised in #578.

* Fix pep8 issues.
2017-06-15 08:48:52 +07:00
Jo De Boeck
a62282f0f2 Add group module which allows cycling trough other modules (#568)
Highly inspired by: https://py3status.readthedocs.io/en/3.5/modules.html#group

Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2017-05-01 10:23:18 +07:00
Johannes Löthberg
96936946fa core/desktop: Use default server timeout
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-02-23 13:51:35 +01:00
Facetoe
328eb92864 Catch all exceptions. 2016-11-03 21:54:02 +08:00
Facetoe
458e05cae8 Catch exceptions thrown in init().
Possible solution for #490
2016-11-01 20:01:27 +08:00
enkore
10416e8ed0 Merge pull request #471 from hobarrera/online-dont-fail-when-offline
online module: Don't fail when offline
2016-10-18 01:18:32 +02:00
Hugo Osvaldo Barrera
aeec2e86f3 online module: Don't fail when offline
If the system is offline, socket.gaierror is raised, the module crashes,
and shows `offline` indefinitely.

Catch that exception, and return False.
2016-10-17 20:05:05 -03:00
Erik Johnson
bafc492c45 Always log exception for DesktopNotification failure
Also remove unused ``exc`` variable.
2016-09-20 12:53:06 -05:00
Erik Johnson
429c5d4865 Fix traceback when notification daemon not running
When a desktop notification is displayed but there is no notification
daemon running, an exception is raised.

This fixes the traceback by adding a logger to the DesktopNotification
class, and logging an error when the exception is caught.

Fixes #453.
2016-09-18 20:45:40 -05:00
Matthieu Coudron
33764e349e "logfile" accepts environment variables 2016-08-29 14:54:07 +02:00
Facetoe
8d8c0b6812 Update comment 2016-08-09 18:33:28 +08:00
Facetoe
c30365338b Refactor conditional to pass required setting tests.
If a setting is defined in a subclass and is not None do not raise
config error.
2016-08-09 18:20:40 +08:00
Facetoe
5bb40926b8 Ensure required settings are defined correctly.
Possible fix for #424. If a setting has not been overidden in a subclass
or set in the user's config then raise an exception.
2016-08-07 01:16:27 +08:00
Jay Cornwall
1dabaf1c2e Pulseaudio: Update status immediately when volume changes
Volume changes may occur externally (e.g. through pactl bound to media
keys) or through mouse interaction. The new volume is received
asynchronously but can only be outputted at the next status poll,
causing a small delay.

Introduce Module.send_output() to allow a module to send its output
without delay. Invoke this method in the Pulseaudio sink info callback.
2016-07-17 18:12:38 -05:00
Erik Johnson
8e9b6dfba3 Remove leading newline from exception logging
The new log formatting makes this unnecessary.
2016-04-10 21:16:23 -05:00
Erik Johnson
c6b2077263 Add support for logformat parameter to i3pystatus.Status()
This improves the usefulness of log messages, especially when it comes
to debug logging added for the purpose of future troubleshooting.
2016-04-10 21:16:23 -05:00
Mathis FELARDOS
f26a9f9d1d core: Improve the support of other button
* This commit fix #259
* Change 'unhandled' callback by 'other'
* Add the an optional parameter 'button_id' for all callbacks

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-25 22:27:33 +01:00
Mathis FELARDOS
95f625cd6b core: Add the middle click support and unhandled button support
* This commit fix #259
* Support of middle click button
* Add an unhandled click events for all button that will not be handled
* Remove the return type of on_click: it became useless now
* Fix the unique call of on_click in CommandEndpoint

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-25 04:32:29 +01:00
Mathis FELARDOS
98e8a1cc04 core: handle callbacks that are not functions on Python 3.3
* Fix inspect.getargspec issue for non functions callbacks by creating
  an empty ArgSpec. There for we ignore all kwargs parameters.

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-23 10:14:20 +01:00
Mathis FELARDOS
d15b3173f1 core: Change command_endpoint and on_click for supporting i3bar mouse positions
* command_endpoint: get the position from the mouse when the click
  occured. Parameters names are set here: pos_x pos_y.
  Positions are passed to on_click through keyword arguments.
* Module:
  - change __log_button_event, __button_callback_handler and on_click
    methods for handling keyword arguments.
  - "Member", "Method" and "Python" callbacks are handled by detecting
    if they have pos_x or pos_y as parameters, or if they have a
    keyword arguments. The special case of wrapped callbacks (made with
    get_module decorator for example) is handled in a similar way.
  - "External command" is handled by considering the position as a
    format dictionary. Actually no distinctions are made of how
    self.data and the new keyword argument are treated on this.
  - the parameter kwargs as been added to the doc string of on_click.
* MultiClickHandler: now handle keyword arguments.

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-23 08:36:11 +01:00
Kenny Keslar
693d2ebdb7 Catch exceptions in button handlers 2016-03-02 15:57:57 -05:00
enkore
7117df6fb2 Display exception class name (in-line exception display)
cf #322
2016-02-16 13:40:30 +01:00
enkore
58ca67109c Change default mode to standalone=True 2016-02-12 14:12:43 +01:00
enkore
2890f942f3 configuration.rst: update example callbacks 2016-02-02 16:01:28 +01:00
enkore
dcda1bb3a4 Fix initialization error if standalone is False
Does anybody even use this scenario anymore? We could remove quite some
code if we only supported standalone operation.
2016-02-02 15:47:00 +01:00
enkore
9759d6eea5 Revert "Lift restriction that "run" cannot be used as a callback"
This reverts commit d018be872a.
2016-02-01 17:09:47 +01:00
enkore
d018be872a Lift restriction that "run" cannot be used as a callback 2016-02-01 12:18:03 +01:00
enkore
739c595ef0 Fix is_method_of (cf #310), add regression test case 2016-01-28 20:34:53 +01:00
enkore
2aeda9c5e3 Fix single string case & docs 2016-01-27 20:15:59 +01:00
enkore
dec534ce81 Fix errorneous recursive replace mishap 2016-01-27 20:02:51 +01:00
enkore
612b8b07eb Update modules to a7583a9
Not updated for various reasons:
clock,
dpms,
gpu_temp,
load,
mail,
mem_bar,
modsde,
net_speed,
pianobar,
pulseaudio,
regex [no named formatters],
runwatch,
shell,
solaar,
temp,
text,
updates,
weather,
whosonlocation,
xkblayout,
zabbix


This might break something: I can't test all these modules. If it does,
file a bug / open a PR / send me a note.
2016-01-27 19:53:33 +01:00
enkore
a7583a9786 Implement #300 2016-01-27 19:31:12 +01:00
enkore
aed169de4d Implement decided resolution of #304
- Remove self for normal callables
- Retain self for methods (of course)
- Add decorator to retrieve self for special callbacks that need it
  (Yes, the example is kinda stupid and would be unnecessary with #300)
2016-01-27 19:07:59 +01:00
Maxi Padulo
f12d1f9d48 Fix handler not executing external cmd (#301)
Wrong name on function call was raising AttributeError
exception disrutping the code execution.
2016-01-12 13:03:50 +01:00
Nuno Cardoso
87c01278f7 Added double click support 2016-01-03 16:43:29 +01:00
Lukáš Mandák
6d211f823c Added options to change logfile and internet check server. 2015-11-28 15:42:26 +01:00
Jan Oliver Oelerich
e78501a0cc Update desktop.py
Fixed syntax error.
2015-10-25 20:41:42 +01:00
enkore
4d24b17e2b Fix crash on import with desktop notifications when python-gobject is available, but no notification daemon is running. 2015-10-25 20:30:36 +01:00
Lukáš Mandák
b0e914d4e9 Module: Updated docstring for on_click method. 2015-10-03 11:20:16 +02:00
Lukáš Mandák
081bd329f9 Changed checks for command attribute in run_through_shell and execute. 2015-10-03 10:14:29 +02:00
Lukáš Mandák
2ef74ded79 Replace regular 'split' to 'shlex.split'. 2015-09-29 12:47:32 +02:00
Lukáš Mandák
68d11b2f81 Module: Log first then let bad things happen. :) 2015-09-25 19:37:53 +02:00
Lukáš Mandák
6d3c7eddc8 Module: More detailed logs for clickevents as suggested by @teto in #231. 2015-09-25 19:12:05 +02:00
Lukáš Mandák
4aa6b2a73c Docs: Updated docstring of run_through_shell. 2015-09-25 18:47:54 +02:00