-
Notifications
You must be signed in to change notification settings - Fork 88
feat: rework networkmanager module #1233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Rodrigodd
wants to merge
23
commits into
JakeStanger:master
Choose a base branch
from
Rodrigodd:feat-network-manager-rework
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
db03af3
feat: reword networkmanager module
Rodrigodd cded882
refactor: rename 'IconsConfig' to 'Icons'
Rodrigodd c517617
refactor: update DeviceType documentation
Rodrigodd 152e907
refactor: replace mutually exclusive bools with enum
Rodrigodd d1fb624
refactor: move module_impl! to top of impl
Rodrigodd f07439b
docs(network-manager): update docs
Rodrigodd 0d476fc
fix(networkmanager): fix panic when number of wifi levels is 0 or 1
Rodrigodd b376f3f
refactor: simplify use of `#[serder(default)]`
Rodrigodd d632b81
docs: fix typo
Rodrigodd 5822a86
style: move comments of unmapped dbus properties
Rodrigodd 15d7f82
chore: remove futures-signals
Rodrigodd 11bccfd
docs: add list of device types to documentation.
Rodrigodd f15f523
fix: fix typos in docs
Rodrigodd 99c3c3f
style: add space and header for unmapped properties comment
Rodrigodd 657f2af
refactor: break up unwieldy expression
Rodrigodd 978f86f
refactor: replace unwrap with expect
Rodrigodd 5ddf6c4
fix: fix todo in strenght_to_level
Rodrigodd 849d620
fix: keep `module_impl!("network_manager");`
Rodrigodd b45ddb5
refactor: alias tokio::sync::RwLock to AsyncRwLock
Rodrigodd c6ed09a
fix: fix example in docs
Rodrigodd 842aa82
style: don't prefix used variable with underscore
Rodrigodd bcd32ca
fix: fix typo in log
Rodrigodd 9bb55cf
doc: replace `networkmanager` with `network_manager`
Rodrigodd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,80 +1,113 @@ | ||
| Displays the current network connection state of NetworkManager. | ||
| Supports wired ethernet, wifi, cellular data and VPN connections among others. | ||
|
|
||
| > [!NOTE] | ||
| > This module is currently a basic skeleton implementation and only offers the most basic functionality currently. | ||
| > It uses NetworkManager's so-called primary connection, | ||
| > and therefore inherits its limitation of only being able to display the "top-level" connection. | ||
| > For example, if we have a VPN connection over a wifi connection it will only display the former, | ||
| > until it is disconnected, at which point it will display the latter. | ||
| > A solution to this is currently in the works. | ||
| Displays the state of each network device managed by NetworkManager. Each device | ||
| type will show an icon representing its current state (connected, acquiring, | ||
| disconnected). | ||
|
|
||
| ## Configuration | ||
|
|
||
| > Type: `network_manager` | ||
| | Name | Type | Default | Description | | ||
| |-------------|-----------|---------|-------------------------| | ||
| | `icon_size` | `integer` | `24` | Size to render icon at. | | ||
|
|
||
| > [!NOTE] | ||
| > This module does not support module-level [layout options](module-level-options#layout). | ||
| > Type: `networkmanager` | ||
| | Name | Type | Default | Description | | ||
| | ----------------------------- | ---------- | ------------------------------------------ | ----------------------------------------------------------------------------------- | | ||
| | `icon_size` | `integer` | `24` | Size to render icon at. | | ||
| | `types_blacklist` | `string[]` | `[]` | Any device with a type in this list will not be shown. | | ||
| | `types_whitelist` | `string[]` | `[]` | If not empty, only devices with a type in this list will be shown. | | ||
| | `interface_blacklist` | `string[]` | `[]` | Any device whose interface name is in this list will not be shown. | | ||
| | `interface_whitelist` | `string[]` | `[]` | If not empty, only devices whose interface name is in this list will be shown. | | ||
| | `icons.wired.connected` | `string` | `icon:network-wired-symbolic` | Icon for connected wired device. | | ||
| | `icons.wired.acquiring` | `string` | `icon:network-wired-acquiring-symbolic` | Icon for acquiring wired device. | | ||
| | `icons.wired.disconnected` | `string` | `""` | Icon for disconnected wired device. | | ||
| | `icons.wifi.levels` | `string[]` | See below | Icon for each strengh level of a connected wifi connection, from lowest to highest. | | ||
| | `icons.wifi.acquiring` | `string` | `icon:network-wireless-acquiring-symbolic` | Icon for acquiring wifi device. | | ||
| | `icons.wifi.disconnected` | `string` | `""` | Icon for disconnected wifi connection. | | ||
| | `icons.cellular.connected` | `string` | `icon:network-cellular-connected-symbolic` | Icon for connected cellular device. | | ||
| | `icons.cellular.acquiring` | `string` | `icon:network-cellular-acquiring-symbolic` | Icon for acquiring cellular device. | | ||
| | `icons.cellular.disconnected` | `string` | `""` | Icon for disconnected cellular device. | | ||
| | `icons.vpn.connected` | `string` | `icon:network-vpn-symbolic` | Icon for connected VPN device. | | ||
| | `icons.vpn.acquiring` | `string` | `icon:network-vpn-acquiring-symbolic` | Icon for acquiring VPN device. | | ||
| | `icons.vpn.disconnected` | `string` | `""` | Icon for disconnected VPN device. | | ||
| | `unkown` | `string` | `icon:dialog-question-symbolic` | Icon for device in unkown state. | | ||
|
|
||
| **Device Types:** The device types used in `types_whitelist` and | ||
| `types_blacklists` are the same as those used by NetworkManager. You can find | ||
| the type of the devices on your system by running `nmcli device status` in a | ||
| terminal. The possible device types are: `unknown`, `ethernet`, `wifi`, `bt`, | ||
| `olpc_mesh`, `wimax`, `modem`, `infiniband`, `bond`, `vlan`, `adsl`, `bridge`, | ||
| `generic`, `team`, `tun`, `ip_tunnel`, `macvlan`, `vxlan`, `veth`, `macsec`, | ||
| `dummy`, `ppp`, `ovs_interface`, `ovs_port`, `ovs_bridge`, `wpan`, `six_lowpan`, | ||
| `wireguard`, `wifi_p2p`, `vrf`, `loopback`, `hsr` and `ipvlan`. | ||
|
|
||
| **Default `icons.wifi.levels`:** they contain the 5 GTK symbolic icons for wireless signal strength: | ||
Rodrigodd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `"icon:network-wireless-signal-none-symbolic"` | ||
| - `"icon:network-wireless-signal-weak-symbolic"` | ||
| - `"icon:network-wireless-signal-ok-symbolic"` | ||
| - `"icon:network-wireless-signal-good-symbolic"` | ||
| - `"icon:network-wireless-signal-excellent-symbolic"` | ||
|
|
||
| <details> | ||
| <summary>JSON</summary> | ||
|
|
||
| ```json | ||
| { | ||
| "end": [ | ||
| { | ||
| "type": "network_manager", | ||
| "icon_size": 32 | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
| <summary>JSON</summary> | ||
|
|
||
| ```json | ||
| { | ||
| "end": [ | ||
| { | ||
| "type": "networkmanager", | ||
| "icon_size": 24 | ||
| types_blacklist: ["loopback", "bridge"] | ||
Rodrigodd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>TOML</summary> | ||
| <summary>TOML</summary> | ||
|
|
||
| ```toml | ||
| [[end]] | ||
| type = "networkmanager" | ||
| icon_size = 24 | ||
| types_blacklist = ["loopback", "bridge"] | ||
| ``` | ||
|
|
||
| ```toml | ||
| [[end]] | ||
| type = "network_manager" | ||
| icon_size = 32 | ||
| ``` | ||
| </details> | ||
|
|
||
| <details> | ||
| <summary>YAML</summary> | ||
| <summary>YAML</summary> | ||
|
|
||
| ```yaml | ||
| end: | ||
| - type: "networkmanager" | ||
| icon_size: 24 | ||
| types_blacklist: | ||
| - loopback | ||
| - bridge | ||
| ``` | ||
| ```yaml | ||
| end: | ||
| - type: "network_manager" | ||
| icon_size: 32 | ||
| ``` | ||
| </details> | ||
| <details> | ||
| <summary>Corn</summary> | ||
| ```corn | ||
| { | ||
| end = [ | ||
| { | ||
| type = "network_manager" | ||
| icon_size = 32 | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
| <summary>Corn</summary> | ||
| ```corn | ||
| { | ||
| end = [ | ||
| { | ||
| type = "networkmanager" | ||
| icon_size = 24 | ||
| types_blacklist = ["loopback", "bridge"] | ||
Rodrigodd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| ## Styling | ||
|
|
||
| | Selector | Description | | ||
| |--------------------------|----------------------------------| | ||
| | `.network_manager` | NetworkManager widget container. | | ||
| | `.network_manager .icon` | NetworkManager widget icon. | | ||
| | Selector | Description | | ||
| | ---------------------- | -------------------------------- | | ||
| | `.networkmanager` | NetworkManager widget container. | | ||
| | `.networkmanger .icon` | NetworkManager widget icons. | | ||
Rodrigodd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| For more information on styling, please see the [styling guide](styling-guide). | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.