1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 19:34:24 +02:00

Merge branch 'master' into feat/networkmanager-multi-icon

This commit is contained in:
Reinout Meliesie 2024-08-04 21:56:02 +02:00
commit f5f81da12c
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
16 changed files with 412 additions and 144 deletions

View file

@ -1,4 +1,4 @@
name: update-nix-flake-lock
name: Update Nix Flake lock
on:
workflow_dispatch: # allows manual triggering
schedule:
@ -19,7 +19,7 @@ jobs:
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v15
uses: DeterminateSystems/update-flake-lock@v23
with:
pr-title: "Update flake.lock" # Title of PR to be created
pr-labels: | # Labels to be set on the PR

143
Cargo.lock generated
View file

@ -435,6 +435,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
@ -456,9 +462,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.7"
version = "4.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f"
checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc"
dependencies = [
"clap_builder",
"clap_derive",
@ -466,9 +472,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.7"
version = "4.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f"
checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99"
dependencies = [
"anstream",
"anstyle",
@ -478,9 +484,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.5"
version = "4.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@ -616,11 +622,11 @@ dependencies = [
[[package]]
name = "ctrlc"
version = "3.4.2"
version = "3.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b467862cc8610ca6fc9a1532d7777cee0804e678ab45410897b9396495994a0b"
checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
dependencies = [
"nix 0.27.1",
"nix 0.28.0",
"windows-sys 0.52.0",
]
@ -676,6 +682,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "deranged"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
[[package]]
name = "derivative"
version = "2.2.0"
@ -1268,9 +1283,9 @@ dependencies = [
[[package]]
name = "gtk-layer-shell"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19fd93acba7b8ea8918fc564843a22cd1eeffe234b85a8c7d5732c611a425bb0"
checksum = "adb41643070b55cdda5a4a10a338520cff4345395e342b754c02f341e4107383"
dependencies = [
"bitflags 2.4.0",
"gdk",
@ -1382,9 +1397,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.3.1"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "hex"
@ -1581,9 +1596,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
[[package]]
name = "indexmap"
version = "2.2.6"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0"
dependencies = [
"equivalent",
"hashbrown",
@ -1625,7 +1640,7 @@ version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
dependencies = [
"hermit-abi 0.3.1",
"hermit-abi 0.3.9",
"libc",
"windows-sys 0.48.0",
]
@ -1672,6 +1687,7 @@ dependencies = [
"swayipc-async",
"sysinfo",
"system-tray",
"time",
"tokio",
"tracing",
"tracing-appender",
@ -1815,9 +1831,9 @@ dependencies = [
[[package]]
name = "lua-src"
version = "546.0.2"
version = "547.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da0daa7eee611a4c30c8f5ee31af55266e26e573971ba9336d2993e2da129b2"
checksum = "1edaf29e3517b49b8b746701e5648ccb5785cde1c119062cbabbc5d5cd115e42"
dependencies = [
"cc",
]
@ -1897,6 +1913,18 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "mio"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4"
dependencies = [
"hermit-abi 0.3.9",
"libc",
"wasi",
"windows-sys 0.52.0",
]
[[package]]
name = "mlua"
version = "0.9.9"
@ -2004,12 +2032,13 @@ dependencies = [
[[package]]
name = "nix"
version = "0.27.1"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
"bitflags 2.4.0",
"cfg-if",
"cfg_aliases 0.1.1",
"libc",
]
@ -2021,7 +2050,7 @@ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags 2.4.0",
"cfg-if",
"cfg_aliases",
"cfg_aliases 0.2.1",
"libc",
]
@ -2047,7 +2076,7 @@ dependencies = [
"kqueue",
"libc",
"log",
"mio",
"mio 0.8.11",
"walkdir",
"windows-sys 0.48.0",
]
@ -2071,6 +2100,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-derive"
version = "0.3.3"
@ -2118,9 +2153,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "openssl"
version = "0.10.64"
version = "0.10.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f"
checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1"
dependencies = [
"bitflags 2.4.0",
"cfg-if",
@ -2150,9 +2185,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.101"
version = "0.9.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff"
checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6"
dependencies = [
"cc",
"libc",
@ -2343,6 +2378,12 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@ -2514,9 +2555,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.10.5"
version = "1.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
dependencies = [
"aho-corasick",
"memchr",
@ -2802,18 +2843,18 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
[[package]]
name = "serde"
version = "1.0.203"
version = "1.0.204"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.203"
version = "1.0.204"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
dependencies = [
"proc-macro2",
"quote 1.0.35",
@ -2833,11 +2874,12 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.117"
version = "1.0.122"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
@ -3195,11 +3237,14 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.20"
version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
"num-conv",
"powerfmt",
"serde",
"time-core",
"time-macros",
@ -3207,16 +3252,17 @@ dependencies = [
[[package]]
name = "time-core"
version = "0.1.0"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
version = "0.2.8"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
"num-conv",
"time-core",
]
@ -3237,28 +3283,27 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.38.0"
version = "1.39.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
"num_cpus",
"mio 1.0.1",
"pin-project-lite",
"signal-hook-registry",
"socket2 0.5.5",
"tokio-macros",
"tracing",
"windows-sys 0.48.0",
"windows-sys 0.52.0",
]
[[package]]
name = "tokio-macros"
version = "2.3.0"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote 1.0.35",
@ -3602,9 +3647,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "uuid"
version = "1.9.1"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439"
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
dependencies = [
"getrandom",
]

View file

@ -20,7 +20,7 @@ default = [
"ipc",
"launcher",
"music+all",
"networkmanager",
"network_manager",
"notifications",
"sys_info",
"tray",
@ -62,7 +62,7 @@ music = ["regex"]
"music+mpris" = ["music", "mpris"]
"music+mpd" = ["music", "mpd-utils"]
networkmanager = ["futures-lite", "futures-signals", "zbus"]
network_manager = ["futures-lite", "futures-signals", "zbus"]
notifications = ["zbus"]
@ -84,9 +84,9 @@ schema = ["dep:schemars"]
[dependencies]
# core
gtk = "0.18.1"
gtk-layer-shell = "0.8.0"
gtk-layer-shell = "0.8.1"
glib = "0.18.5"
tokio = { version = "1.38.0", features = [
tokio = { version = "1.39.2", features = [
"macros",
"rt-multi-thread",
"time",
@ -101,8 +101,8 @@ tracing-error = { version = "0.2.0" , default-features = false }
tracing-appender = "0.2.3"
strip-ansi-escapes = "0.2.0"
color-eyre = "0.6.3"
serde = { version = "1.0.203", features = ["derive"] }
indexmap = "2.2.6"
serde = { version = "1.0.204", features = ["derive"] }
indexmap = "2.3.0"
dirs = "5.0.1"
walkdir = "2.5.0"
notify = { version = "6.1.1", default-features = false }
@ -112,20 +112,20 @@ smithay-client-toolkit = { version = "0.18.1", default-features = false, feature
"calloop",
] }
universal-config = { version = "0.5.0", default-features = false }
ctrlc = "3.4.2"
ctrlc = "3.4.4"
cfg-if = "1.0.0"
# cli
clap = { version = "4.5.7", optional = true, features = ["derive"] }
clap = { version = "4.5.13", optional = true, features = ["derive"] }
# ipc
serde_json = { version = "1.0.117", optional = true }
serde_json = { version = "1.0.122", optional = true }
# http
reqwest = { version = "0.12.5", default-features = false, features = ["default-tls", "http2"], optional = true }
# cairo
lua-src = { version = "546.0.2", optional = true }
lua-src = { version = "547.0.0", optional = true }
mlua = { version = "0.9.9", optional = true, features = ["luajit"] }
cairo-rs = { version = "0.18.5", optional = true, features = ["png"] }
@ -139,7 +139,7 @@ chrono = { version = "0.4.38", optional = true, default-features = false, featur
mpd-utils = { version = "0.2.1", optional = true }
mpris = { version = "2.0.1", optional = true }
# networkmanager
# network_manager
futures-signals = { version = "0.3.33", optional = true }
# sys_info
@ -160,11 +160,15 @@ hyprland = { version = "0.4.0-alpha.2", features = ["silent"], optional = true }
futures-util = { version = "0.3.30", optional = true }
# shared
futures-lite = { version = "2.3.0", optional = true } # networkmanager, upower, workspaces
regex = { version = "1.10.5", default-features = false, features = [
futures-lite = { version = "2.3.0", optional = true } # network_manager, upower, workspaces
regex = { version = "1.10.6", default-features = false, features = [
"std",
], optional = true } # music, sys_info
zbus = { version = "3.15.2", default-features = false, features = ["tokio"], optional = true } # networkmanager, notifications, upower
zbus = { version = "3.15.2", default-features = false, features = ["tokio"], optional = true } # network_manager, notifications, upower
# schema
schemars = { version = "0.8.21", optional = true }
# -- PATCH --
# temp fix for tracing-appender/time
time = "0.3.36"

View file

@ -93,6 +93,7 @@ cargo build --release --no-default-features \
| music+all | Enables the `music` module with support for all player types. |
| music+mpris | Enables the `music` module with MPRIS support. |
| music+mpd | Enables the `music` module with MPD support. |
| network_manager | Enables the `network_manager` module. |
| notifications | Enables the `notiications` module. |
| sys_info | Enables the `sys_info` module. |
| tray | Enables the `tray` module. |

View file

@ -32,6 +32,7 @@
- [Label](label)
- [Launcher](launcher)
- [Music](music)
- [Network Manager](network-manager)
- [Notifications](notifications)
- [Script](script)
- [Sys_Info](sys-info)

View file

@ -0,0 +1,77 @@
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.
## Configuration
> Type: `network_manager`
| Name | Type | Default | Description |
|-------------|-----------|---------|-------------------------|
| `icon_size` | `integer` | `24` | Size to render icon at. |
<details>
<summary>JSON</summary>
```json
{
"end": [
{
"type": "network_manager",
"icon_size": 32
}
]
}
```
</details>
<details>
<summary>TOML</summary>
```toml
[[end]]
type = "network_manager"
icon_size = 32
```
</details>
<details>
<summary>YAML</summary>
```yaml
end:
- type: "network_manager"
icon_size: 32
```
</details>
<details>
<summary>Corn</summary>
```corn
{
end = [
{
type = "network_manager"
icon_size = 32
}
]
}
```
</details>
## Styling
| Selector | Description |
|--------------------------|----------------------------------|
| `.network_manager` | NetworkManager widget container. |
| `.network_manager .icon` | NetworkManager widget icon. |
For more information on styling, please see the [styling guide](styling-guide).

64
flake.lock generated
View file

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1717025063,
"narHash": "sha256-dIubLa56W9sNNz0e8jGxrX3CAkPXsq7snuFA/Ie6dn8=",
"lastModified": 1722704454,
"narHash": "sha256-lcut8uZMSa80z+aWpxg+9nM8BKWtpU59rtcpMXtHd1Q=",
"owner": "ipetkov",
"repo": "crane",
"rev": "480dff0be03dac0e51a8dfc26e882b0d123a450e",
"rev": "852a59f9672c3413d75bca2b3e9cb4c661cacfc3",
"type": "github"
},
"original": {
@ -20,34 +20,16 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1717067539,
"narHash": "sha256-oIs5EF+6VpHJRvvpVWuqCYJMMVW/6h59aYUv9lABLtY=",
"lastModified": 1721727458,
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
"owner": "nix-community",
"repo": "naersk",
"rev": "fa19d8c135e776dc97f4dcca08656a0eeb28d5c0",
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
"type": "github"
},
"original": {
@ -58,11 +40,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1717112898,
"narHash": "sha256-7R2ZvOnvd9h8fDd65p0JnB7wXfUvreox3xFdYWd1BnY=",
"lastModified": 1722640603,
"narHash": "sha256-TcXjLVNd3VeH1qKPH335Tc4RbFDbZQX+d7rqnDUoRaY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6132b0f6e344ce2fe34fc051b72fb46e34f668e0",
"rev": "81610abc161d4021b29199aa464d6a1a521e0cc9",
"type": "github"
},
"original": {
@ -72,11 +54,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1716948383,
"narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
"lastModified": 1722630782,
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ad57eef4ef0659193044870c731987a6df5cf56b",
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
"type": "github"
},
"original": {
@ -96,17 +78,16 @@
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1717121863,
"narHash": "sha256-/3sxIe7MZqF/jw1RTQCSmgTjwVod43mmrk84m50MJQ4=",
"lastModified": 1722738111,
"narHash": "sha256-cWD5pCs9AYb+512/yCx9D0Pl5KcmyuXHeJpsDw/D1vs=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "2a7b53172ed08f856b8382d7dcfd36a4e0cbd866",
"rev": "27ec296d93cb4b2d03e8cbd019b1b4cde8c34280",
"type": "github"
},
"original": {
@ -114,21 +95,6 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View file

@ -162,7 +162,7 @@
};
style = lib.mkOption {
type = lib.types.lines;
type = lib.types.either (lib.types.lines) (lib.types.path);
default = "";
description = "The stylesheet to apply to ironbar.";
};
@ -189,8 +189,12 @@
source = jsonFormat.generate "ironbar-config" cfg.config;
};
"ironbar/style.css" =
lib.mkIf (cfg.style != "") { text = cfg.style; };
"ironbar/style.css" = lib.mkIf (cfg.style != "") (
if builtins.isPath cfg.style || lib.isStorePath cfg.style then
{ source = cfg.style; }
else
{ text = cfg.style; }
);
};
systemd.user.services.ironbar = lib.mkIf cfg.systemd {

View file

@ -78,10 +78,6 @@ impl Bar {
let center = create_container("center", orientation);
let end = create_container("end", orientation);
content.add(&start);
content.set_center_widget(Some(&center));
content.pack_end(&end, false, false, 0);
window.add(&content);
window.connect_destroy_event(|_, _| {
@ -273,16 +269,22 @@ impl Bar {
let popup = Rc::new(popup);
if let Some(modules) = config.start {
self.content.add(&self.start);
let info = info!(ModuleLocation::Left);
add_modules(&self.start, modules, &info, &self.ironbar, &popup)?;
}
if let Some(modules) = config.center {
self.content.set_center_widget(Some(&self.center));
let info = info!(ModuleLocation::Center);
add_modules(&self.center, modules, &info, &self.ironbar, &popup)?;
}
if let Some(modules) = config.end {
self.content.pack_end(&self.end, false, true, 0);
let info = info!(ModuleLocation::Right);
add_modules(&self.end, modules, &info, &self.ironbar, &popup)?;
}

View file

@ -12,7 +12,7 @@ pub mod compositor;
pub mod lua;
#[cfg(feature = "music")]
pub mod music;
#[cfg(feature = "networkmanager")]
#[cfg(feature = "network_manager")]
pub mod networkmanager;
#[cfg(feature = "notifications")]
pub mod swaync;
@ -37,8 +37,8 @@ pub struct Clients {
lua: Option<Rc<lua::LuaEngine>>,
#[cfg(feature = "music")]
music: std::collections::HashMap<music::ClientType, Arc<dyn music::MusicClient>>,
#[cfg(feature = "networkmanager")]
networkmanager: Option<Arc<networkmanager::Client>>,
#[cfg(feature = "network_manager")]
network_manager: Option<Arc<networkmanager::Client>>,
#[cfg(feature = "notifications")]
notifications: Option<Arc<swaync::Client>>,
#[cfg(feature = "tray")]
@ -100,13 +100,13 @@ impl Clients {
.clone()
}
#[cfg(feature = "networkmanager")]
pub fn networkmanager(&mut self) -> ClientResult<networkmanager::Client> {
match &self.networkmanager {
#[cfg(feature = "network_manager")]
pub fn network_manager(&mut self) -> ClientResult<networkmanager::Client> {
match &self.network_manager {
Some(client) => Ok(client.clone()),
None => {
let client = networkmanager::create_client()?;
self.networkmanager = Some(client.clone());
self.network_manager = Some(client.clone());
Ok(client)
}
}

View file

@ -0,0 +1,169 @@
use std::sync::Arc;
use color_eyre::Result;
use futures_signals::signal::{Mutable, MutableSignalCloned};
use tracing::error;
use zbus::blocking::fdo::PropertiesProxy;
use zbus::blocking::Connection;
use zbus::{
dbus_proxy,
names::InterfaceName,
zvariant::{ObjectPath, Str},
};
use crate::{register_fallible_client, spawn_blocking};
const DBUS_BUS: &str = "org.freedesktop.NetworkManager";
const DBUS_PATH: &str = "/org/freedesktop/NetworkManager";
const DBUS_INTERFACE: &str = "org.freedesktop.NetworkManager";
#[derive(Debug)]
pub struct Client {
client_state: Mutable<ClientState>,
interface_name: InterfaceName<'static>,
dbus_connection: Connection,
props_proxy: PropertiesProxy<'static>,
}
#[derive(Clone, Debug)]
pub enum ClientState {
WiredConnected,
WifiConnected,
CellularConnected,
VpnConnected,
WifiDisconnected,
Offline,
Unknown,
}
#[dbus_proxy(
default_service = "org.freedesktop.NetworkManager",
interface = "org.freedesktop.NetworkManager",
default_path = "/org/freedesktop/NetworkManager"
)]
trait NetworkManagerDbus {
#[dbus_proxy(property)]
fn active_connections(&self) -> Result<Vec<ObjectPath>>;
#[dbus_proxy(property)]
fn devices(&self) -> Result<Vec<ObjectPath>>;
#[dbus_proxy(property)]
fn networking_enabled(&self) -> Result<bool>;
#[dbus_proxy(property)]
fn primary_connection(&self) -> Result<ObjectPath>;
#[dbus_proxy(property)]
fn primary_connection_type(&self) -> Result<Str>;
#[dbus_proxy(property)]
fn wireless_enabled(&self) -> Result<bool>;
}
impl Client {
fn new() -> Result<Self> {
let client_state = Mutable::new(ClientState::Unknown);
let dbus_connection = Connection::system()?;
let interface_name = InterfaceName::from_static_str(DBUS_INTERFACE)?;
let props_proxy = PropertiesProxy::builder(&dbus_connection)
.destination(DBUS_BUS)?
.path(DBUS_PATH)?
.build()?;
Ok(Self {
client_state,
interface_name,
dbus_connection,
props_proxy,
})
}
fn run(&self) -> Result<()> {
let proxy = NetworkManagerDbusProxyBlocking::new(&self.dbus_connection)?;
let mut primary_connection = proxy.primary_connection()?;
let mut primary_connection_type = proxy.primary_connection_type()?;
let mut wireless_enabled = proxy.wireless_enabled()?;
self.client_state.set(determine_state(
&primary_connection,
&primary_connection_type,
wireless_enabled,
));
for change in self.props_proxy.receive_properties_changed()? {
let args = change.args()?;
if args.interface_name != self.interface_name {
continue;
}
let changed_props = args.changed_properties;
let mut relevant_prop_changed = false;
if changed_props.contains_key("PrimaryConnection") {
primary_connection = proxy.primary_connection()?;
relevant_prop_changed = true;
}
if changed_props.contains_key("PrimaryConnectionType") {
primary_connection_type = proxy.primary_connection_type()?;
relevant_prop_changed = true;
}
if changed_props.contains_key("WirelessEnabled") {
wireless_enabled = proxy.wireless_enabled()?;
relevant_prop_changed = true;
}
if relevant_prop_changed {
self.client_state.set(determine_state(
&primary_connection,
&primary_connection_type,
wireless_enabled,
));
}
}
Ok(())
}
pub fn subscribe(&self) -> MutableSignalCloned<ClientState> {
self.client_state.signal_cloned()
}
}
pub fn create_client() -> Result<Arc<Client>> {
let client = Arc::new(Client::new()?);
{
let client = client.clone();
spawn_blocking(move || {
if let Err(error) = client.run() {
error!("{}", error);
};
});
}
Ok(client)
}
fn determine_state(
primary_connection: &str,
primary_connection_type: &str,
wireless_enabled: bool,
) -> ClientState {
if primary_connection == "/" {
if wireless_enabled {
ClientState::WifiDisconnected
} else {
ClientState::Offline
}
} else {
match primary_connection_type {
"802-3-ethernet" | "adsl" | "pppoe" => ClientState::WiredConnected,
"802-11-olpc-mesh" | "802-11-wireless" | "wifi-p2p" => ClientState::WifiConnected,
"cdma" | "gsm" | "wimax" => ClientState::CellularConnected,
"vpn" | "wireguard" => ClientState::VpnConnected,
_ => ClientState::Unknown,
}
}
}
register_fallible_client!(Client, network_manager);

View file

@ -10,11 +10,12 @@ use zbus::export::ordered_stream::OrderedStreamExt;
use zbus::zvariant::Type;
#[derive(Debug, Clone, Copy, Type, Deserialize)]
#[allow(dead_code)]
pub struct Event {
pub count: u32,
pub dnd: bool,
pub cc_open: bool,
// pub inhibited: bool,
pub inhibited: bool,
}
type GetSubscribeData = (bool, bool, u32, bool);
@ -22,12 +23,12 @@ type GetSubscribeData = (bool, bool, u32, bool);
/// Converts the data returned from
/// `get_subscribe_data` into an event for convenience.
impl From<GetSubscribeData> for Event {
fn from((dnd, cc_open, count, _inhibited): (bool, bool, u32, bool)) -> Self {
fn from((dnd, cc_open, count, inhibited): (bool, bool, u32, bool)) -> Self {
Self {
count,
dnd,
cc_open,
// inhibited,
inhibited,
}
}
}

View file

@ -1,13 +1,13 @@
use super::manager::DataControlDeviceManagerState;
use crate::lock;
use nix::fcntl::OFlag;
use nix::unistd::{close, pipe2};
use nix::unistd::pipe2;
use smithay_client_toolkit::data_device_manager::data_offer::DataOfferError;
use smithay_client_toolkit::data_device_manager::ReadPipe;
use std::ops::DerefMut;
use std::os::fd::{AsFd, AsRawFd};
use std::os::fd::AsFd;
use std::sync::{Arc, Mutex};
use tracing::{trace, warn};
use tracing::trace;
use wayland_client::{Connection, Dispatch, Proxy, QueueHandle};
use wayland_protocols_wlr::data_control::v1::client::zwlr_data_control_offer_v1::{
Event, ZwlrDataControlOfferV1,
@ -178,9 +178,5 @@ pub unsafe fn receive(
offer.receive(mime_type, writefd.as_fd());
if let Err(err) = close(writefd.as_raw_fd()) {
warn!("Failed to close write pipe: {}", err);
}
Ok(ReadPipe::from(readfd))
}

View file

@ -16,7 +16,7 @@ use crate::modules::label::LabelModule;
use crate::modules::launcher::LauncherModule;
#[cfg(feature = "music")]
use crate::modules::music::MusicModule;
#[cfg(feature = "networkmanager")]
#[cfg(feature = "network_manager")]
use crate::modules::networkmanager::NetworkManagerModule;
#[cfg(feature = "notifications")]
use crate::modules::notifications::NotificationsModule;
@ -62,7 +62,7 @@ pub enum ModuleConfig {
Launcher(Box<LauncherModule>),
#[cfg(feature = "music")]
Music(Box<MusicModule>),
#[cfg(feature = "networkmanager")]
#[cfg(feature = "network_manager")]
NetworkManager(Box<NetworkManagerModule>),
#[cfg(feature = "notifications")]
Notifications(Box<NotificationsModule>),
@ -107,7 +107,7 @@ impl ModuleConfig {
Self::Launcher(module) => create!(module),
#[cfg(feature = "music")]
Self::Music(module) => create!(module),
#[cfg(feature = "networkmanager")]
#[cfg(feature = "network_manager")]
Self::NetworkManager(module) => create!(module),
#[cfg(feature = "notifications")]
Self::Notifications(module) => create!(module),

View file

@ -36,7 +36,7 @@ pub mod label;
pub mod launcher;
#[cfg(feature = "music")]
pub mod music;
#[cfg(feature = "networkmanager")]
#[cfg(feature = "network_manager")]
pub mod networkmanager;
#[cfg(feature = "notifications")]
pub mod notifications;
@ -287,6 +287,8 @@ pub trait ModuleFactory {
let id = Ironbar::unique_id();
let common = module.take_common();
debug!("adding module {} (id: {})", TModule::name(), id);
let (ui_tx, ui_rx) = mpsc::channel::<ModuleUpdateEvent<TSend>>(64);
let (controller_tx, controller_rx) = mpsc::channel::<TRev>(64);

View file

@ -34,6 +34,8 @@ impl Module<GtkBox> for NetworkManagerModule {
type SendMessage = State;
type ReceiveMessage = ();
module_impl!("network_manager");
fn spawn_controller(
&self,
_: &ModuleInfo,
@ -130,6 +132,4 @@ impl Module<GtkBox> for NetworkManagerModule {
Ok(ModuleParts::new(container, None))
}
module_impl!("networkmanager");
}