Commit Graph

41 Commits

Author SHA1 Message Date
ab915fb724 feat(net): %netspeed% token to show combined up+download speed (#2590)
Closes #1083 

* Add netspeed parameter (#1083)

* Update net.cpp

* Update net.hpp

* Update network.cpp

* Update CHANGELOG.md
2022-02-06 21:12:38 +01:00
8a9cad2792 net: prefer running interface for auto-detection (#2557)
Improve the find_interface() to return a interface name
that is currently running if any interface of given type
is currently running, else just return the first one found.

This will allow the interface-type to work with multiple net interface
of the same type, and prefer to one that is currently connect to
a network. This works great HW with multiple ethernet port and user
expect to occasonally swap between the two.
2022-01-18 19:53:19 +01:00
195a0d94df feat(network): Add mac address token (#2569)
* Add mac address option

* Add error handling

* Address changes

* Move outside of for loop

* Update changelog
2022-01-16 02:39:55 +01:00
6e34265d7b Replace system_clock with steady_clock (#2559)
This fixes #857 and #1932. Also replaces PR #1725, since we don't need
our own implementation of condition_variable anymore since people who
update their polybar should have GCC 10 by now.

The m_updated_at field of the mpd module was removed instead of having
its clock change because it became unused in commit 645a3142a1.
2022-01-12 23:06:29 +01:00
4d90ac2f4c fix(net): Use canonical interface name (#2540)
One can define an 'altname' for an interface. That name is valid of
if_nametoindex but it doesn't appear in `/sys/class/net`:

```
sudo ip link property add dev enp0s31f6 altname eno
```

This creates an altname eno for the existing interface enp0s31f6

Before, using eno, would lead to an error in `realpath`.

Ref: https://www.reddit.com/r/Polybar/comments/q8f0ye/error_disabling_module_network_reason_realpath/hgqpq1m/?context=3
2021-10-15 17:36:32 +02:00
560065540b Fix wrong assertion on network interface 2021-09-21 21:43:27 +02:00
5011e66346 fix(net): Check if interface is valid first. (#2497)
Fixes #2496
2021-09-09 21:47:23 +02:00
f7c2d83ef2 feat(net): interface discovery (#2025) 2021-01-03 11:48:15 +01:00
9f2459be8c net: increase speedrate precision (#2054)
more granular units need lower precision, while less granular need
higher precision. assume sane default of:

unit | precision
KB   | 0
MB   | 1
GB   | 2

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-12-01 17:54:54 +01:00
50d8a1ba06 feat(network): Ability to change speed unit text (B/s) (#2068)
New config option `speed-unit = B/s` will be used to suffix the upload and download speeds.

* mod::network: udspeed-unit to set network speed unit suffix

* Changed udspeed-unit to speed-unit
2020-11-29 14:15:27 +01:00
e309253fc8 clang-format 2020-10-19 10:32:41 +02:00
4944a5179c fix(net): Float interval for network speed
Before the time difference between two measurements was always an
integer number, so for intervals < 1, you would always get 0 and for any
other non-integer interval you would get skewed results.
2020-10-19 10:32:41 +02:00
5e5d8faf04 fix(command): broken pipe when ignoring output. 2020-05-08 23:24:29 +02:00
61dfe739d5 net: allow shortening of linespeed to Gbit/s 2020-04-14 01:32:21 +02:00
0dbcb28a2c fix(net): Query IP addresses for tun/ tap devices
Before tuntap devices would never call the generic `network::query`
method and just return true.

Fixes #1986
2020-01-12 15:03:18 +01:00
3e83fb9fb2 net: Don't disable when linkspeed not detected (#1772)
Shows "N/A" instead.

Fixes #1211
2019-09-27 17:01:45 +02:00
b03f14400a fix(net): buffer overflow when gathering ipv6 addr 2019-01-20 15:12:22 +01:00
014606294c fix(net): Display N/A when no ipv4 address 2019-01-17 08:35:49 +01:00
22af69545a feat(net): Support bridge interfaces (#1528)
Bridge interfaces don't provide linkspeed via ethtool but everything else works the same as with ethernet links.

Fixes #1522
2018-11-28 16:09:00 +01:00
3c504bb913 fix(build): remove side-effects of iwlib.h
wireless_tools 29 redefines inline in iwlib.h as:
    #define inline inline __attribute__((always_inline))

which conflicts with POLYBAR_NS, which is defined as:

    #define POLYBAR_NS    \
      namespace polybar { \
        inline namespace APP_VERSION_NAMESPACE {

In version 30.pre9 this #define is moved into a source file and thus
cannot conflict.

The error only occurs when building with clang, so it seems gcc and
clang handle this differently

Fixes #1492
2018-10-31 17:00:13 -07:00
654c667698 fix(build): replace caddr_t with char* (#1454)
caddr_t isn't defined on all systems

Fixes #1447
2018-10-03 16:35:31 +02:00
3afc341c7b feat(net): Add nl80211 support (#1009)
This patch enables support for nl80211. In case the libnl-genl-3.0
library isn't found, it will fall back to Wext instead.
The library to use can also be manually set with the CMake option
WITH_LIBNL.

The Wireless-Extensions (WE or Wext) are deprecated and long replaced
by cfg80211.

Although Wext isn't used by WiFi drivers anymore, CFG80211_WEXT allows
old tools to communicate with modern drivers by providing a wrapper
API.
2018-06-18 20:16:09 -07:00
d1d307d500 feat(net): Add local_ip6 token (#1239)
It's queried the same way ipv4 addresses are queried, but here it displays globally routable addresses. If there are multiple such addresses, it picks one (same as with ipv4). It's possible that an address discovered this way is not in fact globally reachable but still marked as global.
2018-06-10 22:51:43 +02:00
8173a6473e fix(gcc): Fix -Wstringop-truncation warning
As mentioned in #1215, gcc >=8 will complain, if strncpy truncates the
source string or gcc can prove there is no NUL terminating byte.

This also updates the i3ipcpp submodule where there was a similar error

Fixes #1215
2018-05-06 14:17:10 -07:00
0a8a326730 feat(net): Add unknown-as-up option
Fixes #457
2018-03-04 23:09:18 +01:00
dceb3606b1 refactor(stringstream): Shorten to sstream 2017-01-14 06:11:51 +01:00
e1dbd98c40 feat(string_util): Custom stringstream 2017-01-13 13:01:22 +01:00
385572ec64 feat(xrandr): Support for monitors
Refs #280
2017-01-13 03:52:57 +01:00
8cc885c316 refactor: Cleanup 2017-01-11 03:07:28 +01:00
9c191cb025 fix(net): Always close socket handle
Refs #283
2017-01-01 15:10:58 +01:00
ad0af86a7b refactor(battery): Abstract value readers
Refs #263, #245
2016-12-31 04:20:48 +01:00
7ecd132610 fix(net): Convert dBm to percentage
Fixes #249
2016-12-23 08:13:40 +01:00
a0d485f79d refactor: Initialize data 2016-12-15 09:30:31 +01:00
1b00993cb9 fix(net): Initialize request struct 2016-12-13 14:33:06 +01:00
ff9be848c7 refactor(clang-tidy): Apply fixes 2016-11-25 21:58:49 +01:00
8db3e79919 refactor(clang-format): Apply fixes 2016-11-25 14:17:41 +01:00
fd57ab0f3d fix: project rename 2016-11-19 06:26:07 +01:00
e22ec91101 fix(network): Check for TUN/TAP devices
Ref #159
2016-11-14 17:55:35 +01:00
7b293a42cd fix(network): Check for nullptr values
Ref #159
2016-11-14 14:54:49 +01:00
983963d4e4 feat(network): Accumulate stats from all interfaces
Add config setting that will display accumulated
values for up-/downspeed (accumulate-stats = true)

Closes #144
2016-11-14 12:42:59 +01:00
e7cb345cec wip: Separate source from definitions 2016-11-03 12:54:32 +01:00