Commit Graph

63 Commits

Author SHA1 Message Date
Paymon
3da3732cc9 network: detect if link is p2p and use local addr
without this we endup with peer's addr

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
2023-04-26 13:52:17 -04:00
Viktar Lukashonak
61a6c00c02
Happy clang 2023-03-02 16:57:32 +03:00
Simon Plakolb
5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01:00
Simon Plakolb
b8322c4b4b button: Add AButton class
The AButton class is designed as full a substitute to ALabel. The
GtkButton attribute 'button_' is initialized with a label. This
label can the be referenced by the subsequent inheritors of AButton
instead of the GtkLabel attribute 'label_' of ALabel.
For convenience a GtkLabel* 'label_' attribute is added to AButton.

If the button cannot be clicked it is disabled, effectively acting
like its label predecessor.

GtkButton seems to catch one-click mouse events regardless of the
flags set on it. Therefore, 'signal_pressed' is connected to a
function creating a fake GdkEventButton* and calling 'handleToggle'
(for details on this possible bug in GTK see:
https://stackoverflow.com/questions/45334911 )

In accordance with other GtkButtons (i.e. the sway/workspace ones)
set_relief(Gtk::RELIEF_NONE) is called on the 'button_' instance.
2022-10-12 10:25:29 +02:00
Alex
2e12ea6a81 fix: add missing include 2022-04-06 08:43:31 +02:00
Alex
f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Brent George
13d25d403e add to network module - signalStrengthApp shows what applications can run at current signal strength 2021-12-14 11:37:39 -07:00
Brent George
3218612d3b change frequency to GHz 2021-12-14 11:36:46 -07:00
Alex
331dfa87da
Merge pull request #1230 from ciarand/if-changes-isolate
Switch network module to read /proc/net/dev
2021-11-22 08:00:54 +01:00
Rolf Vidar Mazunki Hoksaas
2c380a53ca added support for the {gwaddr} variable 2021-09-09 20:05:18 +02:00
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