Commit Graph

187 Commits

Author SHA1 Message Date
Anthony PERARD 0bb436f949 network: Rework interface auto detection, handle route change events
Last part of the rework of handleEvents(), this time we take the
getExternalInterface() function and add it to the handleEvents()
function. That way, waybar can react immediately when a new "external
interface" is available and doesn't need to probe. Also that avoid to
have two different functions consuming from the same socket and we
don't need to recode some of the functions that are already available
via libnl (to send and receive messages).
2021-05-15 16:38:00 +01:00
Anthony PERARD 0fc7ef6685 network: Rework address lookup to use only events
In order to get the IP address of an interface, we can get the
information out of NEWADDR events without needed to call getifaddrs().
And when now events are expected, we can requests a dump of all
addresses and handle addresses changes the same way via handleEvents()
only.
2021-05-15 16:38:00 +01:00
Anthony PERARD c9bbaa7241 network: Rework initial interface search by using a dump
Instead of using an alternative way to list all links in order to
choose one when an "interface" is in the configuration, we can ask for
a dump of all interface an reuse the handleEvents() function.

This patch also start to rework the handleEvents() function to grab
more information out of each event, like the interface name.
2021-05-15 16:38:00 +01:00
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
Alex 67593b8c0f
Merge pull request #332 from Organic-Code/enhancement/spdlog
Adding spdlog
2019-05-20 12:07:58 +02:00
Alex 03e43fb31d refactor: remove wlroots dependency 2019-05-20 09:49:54 +02:00
Lucas Lazare 51be97f9aa Adding spdlog 2019-05-18 19:44:45 -04:00
Alex 67786c32a8 fix(merge): re-add missing code 2019-05-18 15:45:18 +02:00
Alex 93a644eec4
Merge branch 'master' into master 2019-05-18 15:42:27 +02:00
Alex aa385e28b6 refactor: execute update on idle 2019-05-18 15:32:40 +02:00
Lucas Lazare 2c1a3d0430 Adding logging 2019-05-18 09:27:47 -04:00
Lucas Lazare b31a64ad00 Displaying in ko/s and kb/s instead of interval dependant unit 2019-05-18 09:13:00 -04:00
Alex 4865a9ad6c fix(network): reset frequency 2019-05-18 13:57:50 +02:00
Alex d34c3a801c fix(Network): less updates 2019-05-18 12:27:10 +02:00
Lucas Lazare 794fb12e8c Adding bandwidth support for network module [linux only] 2019-05-17 23:39:51 -04:00
Alex cb2d6e1997 feat(Network): frequency 2019-05-17 11:27:38 +02:00
Alex e12766a656 fix: compilation on some os 2019-05-16 17:09:25 +02:00
Alex 0a14e7f3ab feat: ipv6 family 2019-05-16 12:22:08 +02:00
Alex 31416ffae6 fix: bar removed 2019-05-16 12:19:47 +02:00
Alex fbe19d886a fix: drop memberships 2019-05-16 12:16:44 +02:00
Alex 9c67150884 refactor: prepare ipv6 2019-05-16 12:14:12 +02:00
Alex f3c467cc46 refactor: remove non wanted headers 2019-05-16 11:27:22 +02:00
Alex 45ebee52a6 fix: typo 2019-05-16 11:26:06 +02:00
Alex 841576497a refactor: cleaner events 2019-05-16 11:22:22 +02:00
Alex 22bf0b161a fix(Network): do not stop thread 2019-05-15 10:24:35 +02:00
Dan 5f0a3063d1 feat(states): add getState to other percent based modules 2019-05-02 22:24:29 -04:00
Alex 311c34ecbc feat(Bar): handle widget size changes 2019-04-24 12:37:24 +02:00
Alex bb1cf7570e refactor(IPC): use sigc signal 2019-04-19 11:09:06 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 807ef32357 refactor: format && better output management 2019-04-18 17:47:40 +02:00
Alex 8351dea292 refactor(network): process all messages 2019-04-04 11:58:27 +02:00
Alex 1f6f443c48 Revert "refactor(network): fix skipped messages"
This reverts commit 1ccf372f8e.
2019-04-01 11:41:43 +02:00
Alex 7fac483530 fix: don't bind RTMGRP_IPV(4|6)_ROUTE 2019-03-31 16:33:01 +02:00
Alex 3a8cd91cc0 Revert "refactor: partial revert of 1ccf372f8e9d74cb18e92220c18a0729832fe69e"
This reverts commit 949a4ecf2e.
2019-03-30 09:20:28 +01:00
Alex 949a4ecf2e refactor: partial revert of 1ccf372f8e 2019-03-30 09:03:31 +01:00
José Ribeiro 3eb901f800 Escape ESSID text before interpreting as pango
Fixes #240.
2019-03-24 03:11:54 +00:00
Alex 22cddc5e26 refactor(workspaces): scroll output aware 2019-03-18 14:44:07 +01:00
Alex 1ccf372f8e refactor(network): fix skipped messages 2019-03-18 11:07:36 +01:00
Jonas a9f680b06e Add custom tooltip format for network module 2019-03-03 21:35:35 +01:00
Alex d0370acb21 refactor(network): better network disconnection 2019-02-11 19:06:39 +01:00
Alex dc9fe04d11 refactor: add retry to get external interface 2019-02-06 10:33:12 +01:00
Alex 0ddcf26a45 feat: output configuration 2019-02-01 21:45:59 +01:00
Alexis eace8c549f fix(Network): format-alt 2019-01-13 22:36:37 +01:00
Alexis 171e0e5ae3 revert: don't disable seq check 2019-01-13 22:22:22 +01:00
Alexis 30781757e3 revert: prefer nl_send_sync 2019-01-13 22:22:22 +01:00
Alexis 800d2f388e refactor(network): proper signal strength type 2019-01-13 22:22:22 +01:00
Alexis 1647e31b48 refactor: free netlink message 2019-01-13 22:22:22 +01:00
Alexis 399f61df98 refactor: proper modules destruction 2019-01-13 22:22:22 +01:00
Robinhuett ad638357b5 feat(network): Use Signal Strength for format-icons 2018-12-25 14:17:34 +01:00
Alexis 3b8bfb08a4 fix(network): typo 2018-12-22 14:00:56 +01:00
Alexis b554094c7e feat: args && class id 2018-12-18 17:30:54 +01:00