Commit Graph

134 Commits

Author SHA1 Message Date
Anthony PERARD 63fdf66ad6 network: Read all available messages on ev_sock_
When more than one message is available to read on the ev_sock_
socket, only the first one is read.

Make some changes to be able to read all the messages available by
setting the socket to non-blocking. This way we can detect when
there's nothing left to read and loop back to wait with epoll.
2021-05-15 16:38:00 +01:00
Anthony PERARD 9357a6cb88 network: Start the module with some text in the label_
Fix modules starting with no text, but not hidding.

Start with some "text" in the module's label_, update() will then
update it. Since the text should be different, update() will be able
to show or hide the event_box_. This is to work around the case where
the module start with no text, but the the event_box_ is shown.
2021-05-15 16:38:00 +01:00
Anthony PERARD dbc06abf18 network: Initialise cidr_ like clearIface() does 2021-05-15 16:38:00 +01:00
Aleksei Bavshin 6d5afdaa5f
fix(network): don't block the main thread on rfkill update
Moving rfkill to the main event loop had unexpected side-effects.
Notably, the network module mutex can block all the main thread events
for several seconds while the network worker thread is sleeping.

Instead of waiting for the mutex let's hope that the worker thread
succeeds and schedule timer thread wakeup just in case.
2021-02-09 21:27:22 -08:00
Aleksei Bavshin 38c29fc242
refactor(rfkill): poll rfkill events from Glib main loop
Open rfkill device only once per module.
Remove rfkill threads and use `Glib::signal_io` as a more efficient way
to poll the rfkill device.
Handle runtime errors from rfkill and stop polling of the device instead
of crashing waybar.
2021-02-09 21:27:19 -08:00
Aleksei Bavshin 2695985da0
fix: compilation error with gcc 11
../src/modules/network.cpp:22:6: error: ‘optional’ in namespace ‘std’ does not name a template type
   22 | std::optional<unsigned long long> read_netstat(std::string_view category, std::string_view key) {
      |      ^~~~~~~~
../src/modules/network.cpp:7:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
    6 | #include "util/format.hpp"
  +++ |+#include <optional>
    7 | #ifdef WANT_RFKILL
2020-11-26 15:42:44 -08:00
Alex 95f505a457 revert: restore eventfd 2020-09-21 10:56:40 +02:00
Marek Černoch d263607b27 network: fix typo - update tooltip only when it changes 2020-08-18 23:09:35 +02:00
Alex 033f0b01b7
Fix rfkill condition 2020-08-15 10:36:15 +02:00
wjoe 4565f7f8b9 only compile rfkill into the network module if the feature is enabled. 2020-08-14 20:58:48 +02:00
Eivind Uggedal fb8cda9d90 network: make missing nl80211 non-fatal
This will enable the networking module to be used for ethernet
interfaces on kernels without nl80211 support.

It should be reasonable to allow desktop systems without
wireless interfaces to run custom kenrel configs
without nl80211 compiled in.
2020-07-31 08:15:16 +02:00
Alex 6e7f22ac3a fix: cancel thread and fix window close 2020-05-27 09:10:38 +02:00
Marc Radau 2d02ae5e97
Merge branch 'master' into master 2020-04-16 14:43:10 +02:00
Alex 4a7dd400fe
Merge branch 'master' into on-update 2020-04-12 18:32:19 +02:00
Alex b40cdcb5bd refactor: call parent update 2020-04-12 18:30:21 +02:00
Marc dd7d78cd60 changes requested 2020-02-23 23:09:05 +01:00
Marc Radau 9abe1e2790
Merge branch 'master' into master 2020-02-23 23:00:09 +01:00
Jordan Leppert 4f8a396692 Fix for 'Network label text not updated properly when formats contain Unicode characters' (#588) 2020-02-15 16:51:18 +00:00
Marc c045288ce4 add man page for bluetooth, fix bluetooth race-condition 2020-01-26 05:34:31 +01:00
Marc e3bf6b968c bluetooth module handles rfkill events instantly 2020-01-23 17:17:29 +01:00
Marc Radau d85f0e1060
Merge pull request #3 from marcplustwo/addbluetoothmodule
Add bluetooth module
2020-01-22 11:44:25 +01:00
Marc 89cb9673d4 bluetooth module working 2020-01-22 11:37:47 +01:00
Marc f0dbd8b78d properly structure rfkill util 2020-01-21 17:48:45 +01:00
Marc Radau b8aeda794c
Merge pull request #2 from marcplustwo/airplane_mode
distinguish between wifi disabled and disconnected
2020-01-20 10:46:59 +01:00
Marc 2dc4ae78fc distinguish between wifi disabled and disconnected 2020-01-20 00:35:37 +01:00
Luca Weiss 129713fe1b
fix(network): add missing include
Fixes:
../src/modules/network.cpp:68:3: error: 'assert' was not declared in this scope
   68 |   assert(starts_with(read, category));
      |   ^~~~~~
../src/modules/network.cpp:6:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    5 | #include "util/format.hpp"
  +++ |+#include <cassert>
    6 |
2020-01-07 20:27:31 +01:00
Moritz Jordan 1145788ab3
fix(network): display of IPv6 address 2020-01-06 13:15:28 +01:00
Alex c885be369e feat(Network): hide on empty format 2019-12-30 13:46:12 +01:00
Jordi Pakey-Rodriguez 0f0765e517 feat(modules): call user on-update if configured 2019-12-05 14:42:36 -08:00
Alex b3f9425d70 fix: ci 2019-09-25 09:59:07 +01:00
Alex 211b1c2785 fix: no need to wait on start 2019-09-25 09:32:22 +01:00
Guillaume Maudoux 1d39ef5c8e Add a disk module 2019-09-25 08:47:33 +02:00
Alex bae83ee4e3 fix: static_cast clamp 2019-09-19 22:07:38 +01:00
Alex 334bc1e52a fix(Network): clamp signal strength 2019-09-19 21:59:28 +01:00
Aleksei Bavshin 8f9e6c132d
fix(network): stack-use-after-return found by address sanitizer
Fixes compilation with clang.
2019-08-27 00:11:40 -07:00
Alex c916fe258e fix(network): no need to check family here 2019-06-25 07:55:55 +02:00
Alex b05d4cd413 fix(network): retry around all getExternalInterface 2019-05-29 16:17:40 +02:00
Alex c06725aa69 fix(network): better disconnect handler 2019-05-28 11:21:59 +02:00
Alex 5ae5821929 refactor(network): re-add MAX_RETRY in order to detect external interface 2019-05-28 11:08:48 +02:00
Alex 74e40432e5 fix(network): linked state 2019-05-28 09:58:48 +02:00
Alex 6e73c6db61 refactor(network): remove last_ext_iface_ 2019-05-26 23:16:09 +02:00
Alex 253366baf4 refactor(network): remove useless assignment 2019-05-26 22:40:29 +02:00
Alex ecec02c8be refactor(network): better events handler 2019-05-26 22:36:26 +02:00
Alex d4ace4b4d8 fix(network): subscribe only wanted family 2019-05-26 20:06:27 +02:00
Alex 5fd92b3c28 fix(network): don't check IFF_UP 2019-05-26 19:53:10 +02:00
Alex c0a39f34cd refactor(network): don't clear ipaddr 2019-05-25 18:02:36 +02:00
Alex 07147878a9 refactor(network): code cleaning 2019-05-24 09:49:56 +02:00
Alex 85d60f95c4 refactor(network): const methods 2019-05-22 22:20:50 +02:00
Alex d24d85bebf refactor: move label name and id to label contructor 2019-05-22 12:06:24 +02:00
Alex 48a58cd979 fix(network): switch between ifaces upon disconnection 2019-05-21 17:38:47 +02:00