Commit Graph

53 Commits

Author SHA1 Message Date
Ciaran Downey
9d9f959769 Switch network module to read /proc/net/dev
This fixes issue #610 by reading bandwidth usage per-interface from
/proc/net/dev instead of globally via /proc/net/netstat. It supports the
same matching logic as elsewhere, so setting interface to '*' should
display the same sum-total bandwidth usage as the previous
implementation.
2021-08-25 15:00:05 -07:00
Anthony PERARD
efaac20d82 network: Handle ip route priority
When there's a new default route with higher priority, switch to it.
2021-06-05 16:51:54 +01:00
Anthony PERARD
c1427ff807 network: Handle carrier information
IFLA_CARRIER allows to know when a cable is plugged to the Ethernet
card or when the WiFi is connected. If there's no carrier, the
interface will be considered disconnected.
2021-05-15 16:38:00 +01:00
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
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
Alex
95f505a457 revert: restore eventfd 2020-09-21 10:56:40 +02:00
wjoe
4565f7f8b9 only compile rfkill into the network module if the feature is enabled. 2020-08-14 20:58:48 +02:00
Alex
6e7f22ac3a fix: cancel thread and fix window close 2020-05-27 09:10:38 +02: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
f0dbd8b78d properly structure rfkill util 2020-01-21 17:48:45 +01:00
Marc
2dc4ae78fc distinguish between wifi disabled and disconnected 2020-01-20 00:35:37 +01:00
Alex
211b1c2785 fix: no need to wait on start 2019-09-25 09:32:22 +01:00
Alex
fcf2d18a01 refactor: destroy threads first 2019-05-29 17:53:22 +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
6e73c6db61 refactor(network): remove last_ext_iface_ 2019-05-26 23:16:09 +02:00
Alex
ecec02c8be refactor(network): better events handler 2019-05-26 22:36:26 +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
48a58cd979 fix(network): switch between ifaces upon disconnection 2019-05-21 17:38:47 +02:00
Alex
93a644eec4
Merge branch 'master' into master 2019-05-18 15:42:27 +02:00
Alex
4865a9ad6c fix(network): reset frequency 2019-05-18 13:57:50 +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
841576497a refactor: cleaner events 2019-05-16 11:22:22 +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
1f6f443c48 Revert "refactor(network): fix skipped messages"
This reverts commit 1ccf372f8e.
2019-04-01 11:41:43 +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
Alex
1ccf372f8e refactor(network): fix skipped messages 2019-03-18 11:07:36 +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
Alexis
800d2f388e refactor(network): proper signal strength type 2019-01-13 22:22:22 +01:00
Alexis
399f61df98 refactor: proper modules destruction 2019-01-13 22:22:22 +01:00
Alexis
b554094c7e feat: args && class id 2018-12-18 17:30:54 +01:00
Alexis
e42fae32ab feat(network): network info interval 2018-11-16 10:02:12 +01:00
Robinhuett
5c66b1a770 feat(network): display ip address and subnetmask 2018-11-13 21:31:26 +01:00
Alexis
0abaaf2f7f
style: fix 2018-09-10 11:16:57 +02:00
Alexis
0ad2bc7516 refactor(Network): clean nl socket 2018-08-24 15:32:06 +02:00
Alex
49232eed8d
Clean (#31) 2018-08-20 14:50:45 +02:00
Alex
6705134034
Handle screens disconnection (#29) 2018-08-19 13:39:57 +02:00
Alexis
b1fd4d7b82 feat(modules): generic label module to allow max-length on all labels 2018-08-18 11:43:48 +02:00
Alex
d280f5e8bd
Network detect (#26) 2018-08-17 14:24:00 +02:00
Alex
6635548d3e
Style code (#25) 2018-08-16 14:29:41 +02:00
Alexis
01894f18cd chore: clean headers 2018-08-12 20:25:19 +02:00
Alexis
2512d51564 fix(gtk): use idle to avoid mutex 2018-08-10 23:21:21 +02:00
Alexis
c52b0c5f03 feat(network): add signal strength percentage 2018-08-10 10:45:13 +02:00