Merge pull request #36 from pop-os/workspaces-client-toolkit_jammy
Use `cosmic-client-toolkit` helpers in workspace applet
This commit is contained in:
commit
a38b216924
8 changed files with 192 additions and 366 deletions
122
Cargo.lock
generated
122
Cargo.lock
generated
|
|
@ -103,9 +103,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "1.5.1"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164"
|
||||
checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
|
|
@ -136,9 +136,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "async-broadcast"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d26004fe83b2d1cd3a97609b21e39f9a31535822210fe83205d2ce48866ea61"
|
||||
checksum = "1b19760fa2b7301cf235360ffd6d3558b1ed4249edd16d6cca8d690cee265b95"
|
||||
dependencies = [
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
|
|
@ -624,6 +624,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"calloop",
|
||||
"cosmic-client-toolkit",
|
||||
"cosmic-protocols",
|
||||
"futures",
|
||||
"i18n-embed",
|
||||
|
|
@ -634,7 +635,6 @@ dependencies = [
|
|||
"once_cell",
|
||||
"pretty_env_logger",
|
||||
"rust-embed",
|
||||
"smithay-client-toolkit",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"xdg",
|
||||
|
|
@ -643,7 +643,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-client-toolkit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols#7d49ce0af1b38c3f2fa24288f5b9275a95440058"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols#1615d9048198d3beac93184259046cf546d63657"
|
||||
dependencies = [
|
||||
"cosmic-protocols",
|
||||
"gl_generator",
|
||||
|
|
@ -668,7 +668,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-panel-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel?branch=master_jammy#d522b75e2eeff5b2f32a8e47c6ee6a06369b7f9e"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel#9502913468dc7bf1cc17da6c1fcf1e274f43a769"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ron",
|
||||
|
|
@ -682,7 +682,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-protocols"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols#7d49ce0af1b38c3f2fa24288f5b9275a95440058"
|
||||
source = "git+https://github.com/pop-os/cosmic-protocols#1615d9048198d3beac93184259046cf546d63657"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wayland-backend",
|
||||
|
|
@ -1839,9 +1839,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.1.0"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad6a9459c9c30b177b925162351f97e7d967c7ea8bab3b8352805327daf45554"
|
||||
checksum = "6c467d36af040b7b2681f5fddd27427f6da8d3d072f575a265e181d2f8e8d157"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
]
|
||||
|
|
@ -1996,7 +1996,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
|
|
@ -2013,7 +2013,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.6.2"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"palette",
|
||||
|
|
@ -2023,7 +2023,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"log",
|
||||
|
|
@ -2035,7 +2035,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_glow"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"euclid",
|
||||
|
|
@ -2050,7 +2050,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_graphics"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytemuck",
|
||||
|
|
@ -2070,7 +2070,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_lazy"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"iced_native",
|
||||
"ouroboros 0.13.0",
|
||||
|
|
@ -2079,7 +2079,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_native"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
|
|
@ -2093,7 +2093,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_sctk"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"enum-repr",
|
||||
"futures",
|
||||
|
|
@ -2112,7 +2112,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_style"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"once_cell",
|
||||
|
|
@ -2122,7 +2122,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_swbuf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"cosmic-text",
|
||||
"iced_graphics",
|
||||
|
|
@ -2137,7 +2137,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_wgpu"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytemuck",
|
||||
|
|
@ -2327,7 +2327,7 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
|||
[[package]]
|
||||
name = "libcosmic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#f84410608b7a62335f197f96125d27d7df5f8a59"
|
||||
source = "git+https://github.com/pop-os/libcosmic/?branch=master#444e389496bb92a928b7731175f00f51ec4f0caa"
|
||||
dependencies = [
|
||||
"apply",
|
||||
"cosmic-panel-config",
|
||||
|
|
@ -2660,9 +2660,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.1"
|
||||
version = "7.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
|
||||
checksum = "e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
|
|
@ -2760,9 +2760,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.16.0"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
||||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
|
|
@ -2785,9 +2785,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ordered-stream"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01ca8c99d73c6e92ac1358f9f692c22c0bfd9c4701fa086f5d365c0d4ea818ea"
|
||||
checksum = "d4eb9ba3f3e42dbdd3b7b122de5ca169c81e93d561eb900da3a8c99bcfcf381a"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
|
|
@ -3181,9 +3181,9 @@ checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6"
|
|||
|
||||
[[package]]
|
||||
name = "rangemap"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fa20df61fa7daf0ecf0735b9841ced4a0d25962d1b1eb2dd28dcdd37bb688f2"
|
||||
checksum = "8b9283c6b06096b47afc7109834fdedab891175bb5241ee5d4f7d2546549f263"
|
||||
|
||||
[[package]]
|
||||
name = "raqote"
|
||||
|
|
@ -3629,7 +3629,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/Smithay/smithay?rev=bcc4ee38b8936f57907c844a5e92cf6c0d7325e3#bcc4ee38b8936f57907c844a5e92cf6c0d7325e3"
|
||||
source = "git+https://github.com/Smithay/smithay?rev=c85e1e5#c85e1e520d14aaaadff1369bcbf88ea8204c0827"
|
||||
dependencies = [
|
||||
"appendlist",
|
||||
"bitflags",
|
||||
|
|
@ -3659,7 +3659,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
version = "0.16.0"
|
||||
source = "git+https://github.com/Smithay/client-toolkit?rev=73346019952f82ec7e4d4d15f5d66841b54e8b61#73346019952f82ec7e4d4d15f5d66841b54e8b61"
|
||||
source = "git+https://github.com/Smithay/client-toolkit?rev=3776d4a#3776d4aecf5bf94bbe0dc3bae3e64d5a07db7fd6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"calloop",
|
||||
|
|
@ -4329,14 +4329,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
version = "0.1.0-beta.14"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50598bd298e1e01de02ad3cdcfcfcdb961189e40fea41d9325bc07ba81f8740d"
|
||||
checksum = "fb23bfea266c92bb051ea36cce0eb1a52b743dc1c5f168021947eda79764656d"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"downcast-rs",
|
||||
"io-lifetimes",
|
||||
"nix 0.25.1",
|
||||
"nix 0.26.1",
|
||||
"scoped-tls",
|
||||
"smallvec",
|
||||
"wayland-sys",
|
||||
|
|
@ -4344,35 +4344,32 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.30.0-beta.14"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae06ffbf163db5cc6b40f9aa0ec66e7e1c22b979a327daf209814277f18834e1"
|
||||
checksum = "1a925bd68c8b652af4e6f11a32410bd31bf84061c5ef279ed081520c60f203b4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"nix 0.25.1",
|
||||
"thiserror",
|
||||
"nix 0.26.1",
|
||||
"wayland-backend",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-cursor"
|
||||
version = "0.30.0-beta.14"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0ca2f99754a70feaddd3cb14acb152186db32841b7ac312487788ea33a78b1"
|
||||
checksum = "2d0c3a0d5b4b688b07b0442362d3ed6bf04724fcc16cd69ab6285b90dbc487aa"
|
||||
dependencies = [
|
||||
"nix 0.25.1",
|
||||
"nix 0.26.1",
|
||||
"wayland-client",
|
||||
"xcursor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols"
|
||||
version = "0.30.0-beta.14"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8491945e2705791d58695ae166bb05bfb1f01f2b7b848faa73966e3462269a2f"
|
||||
checksum = "7fefbeb8a360abe67ab7c2efe1d297a1a50ee011f5460791bc18870c26bb84e2"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wayland-backend",
|
||||
|
|
@ -4383,9 +4380,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-protocols-misc"
|
||||
version = "0.1.0-beta.14"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3065c2e2b1a945d5f1afd549e098b6245cd3409317ef1e35a271dddd5ef4ab3"
|
||||
checksum = "897d4e99645e1ed9245e9e6b5efa78828d2b23b661016d63d55251243d812f8b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wayland-backend",
|
||||
|
|
@ -4396,9 +4393,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-protocols-wlr"
|
||||
version = "0.1.0-beta.14"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90968fc47879437fa8519182e07e25eb8173e866767728f2936cd28153f3444c"
|
||||
checksum = "fce991093320e4a6a525876e6b629ab24da25f9baef0c2e0080ad173ec89588a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wayland-backend",
|
||||
|
|
@ -4410,26 +4407,25 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-scanner"
|
||||
version = "0.30.0-beta.14"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28407261ad2bab693652acd84e8abcf1d2bef7270b5cc840ec8c6bed7c715838"
|
||||
checksum = "4834c14b3edf1d9986c83ca79b1e7e3afbe9874c7c144702f6467063259ce45d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quick-xml",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-server"
|
||||
version = "0.30.0-beta.14"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "246d94f203cd9b2993f130255e608639a335e57ec59a2e1ff40164ae4ed6ae40"
|
||||
checksum = "9062def387c1b1d80e366d8243c2b3bd6d9e4f343032a3e5da8d4aa03866cf89"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"downcast-rs",
|
||||
"nix 0.25.1",
|
||||
"thiserror",
|
||||
"io-lifetimes",
|
||||
"nix 0.26.1",
|
||||
"wayland-backend",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
|
@ -4740,7 +4736,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "xdg-shell-wrapper-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/xdg-shell-wrapper?branch=master#1bf60b8eff599ef2ee68d5ce8d46f05b7807ffc6"
|
||||
source = "git+https://github.com/pop-os/xdg-shell-wrapper#82ce268c9c560be3728190a2255c849d3bae77e7"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"wayland-protocols-wlr",
|
||||
|
|
@ -4789,7 +4785,7 @@ checksum = "c03b3e19c937b5b9bd8e52b1c88f30cce5c0d33d676cf174866175bb794ff658"
|
|||
[[package]]
|
||||
name = "zbus"
|
||||
version = "3.6.2"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#9a8617bb8f2d92ef0a0104525f989fff0da4279b"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#0b623738048395cdf398c18be24c9f00d8fdab58"
|
||||
dependencies = [
|
||||
"async-broadcast",
|
||||
"async-executor",
|
||||
|
|
@ -4826,7 +4822,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zbus_macros"
|
||||
version = "3.6.2"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#9a8617bb8f2d92ef0a0104525f989fff0da4279b"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#0b623738048395cdf398c18be24c9f00d8fdab58"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
|
|
@ -4838,7 +4834,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zbus_names"
|
||||
version = "2.5.0"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#9a8617bb8f2d92ef0a0104525f989fff0da4279b"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#0b623738048395cdf398c18be24c9f00d8fdab58"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"static_assertions",
|
||||
|
|
@ -4867,7 +4863,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zvariant"
|
||||
version = "3.10.0"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#9a8617bb8f2d92ef0a0104525f989fff0da4279b"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#0b623738048395cdf398c18be24c9f00d8fdab58"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"enumflags2",
|
||||
|
|
@ -4892,7 +4888,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "zvariant_derive"
|
||||
version = "3.10.0"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#9a8617bb8f2d92ef0a0104525f989fff0da4279b"
|
||||
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#0b623738048395cdf398c18be24c9f00d8fdab58"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ libpulse-binding = "2.26.0"
|
|||
libpulse-glib-binding = "2.25.0"
|
||||
tokio = { version = "1.20.1", features=["full"] }
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "73346019952f82ec7e4d4d15f5d66841b54e8b61" }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "3776d4a" }
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
once_cell = "1.16.0"
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "73346019952f82ec7e4d4d15f5d66841b54e8b61" }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "3776d4a" }
|
||||
futures = "0.3"
|
||||
zbus = { version = "3.5", no-default-features = true }
|
||||
log = "0.4"
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ edition = "2021"
|
|||
[dependencies]
|
||||
zbus = "3.4"
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "73346019952f82ec7e4d4d15f5d66841b54e8b61" }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "3776d4a" }
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ once_cell = "1.16.0"
|
|||
cosmic-dbus-networkmanager = { git = "https://github.com/pop-os/dbus-settings-bindings", branch = "deps" }
|
||||
futures-util = "0.3.21"
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "73346019952f82ec7e4d4d15f5d66841b54e8b61" }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "3776d4a" }
|
||||
futures = "0.3"
|
||||
zbus = { version = "3.6.2", no-default-features = true }
|
||||
log = "0.4"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ libpulse-binding = "2.26.0"
|
|||
libpulse-glib-binding = "2.25.0"
|
||||
tokio = { version = "1.20.1", features=["full"] }
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "73346019952f82ec7e4d4d15f5d66841b54e8b61" }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "3776d4a" }
|
||||
nix = "0.24.1"
|
||||
|
||||
# Until the 3.6.3 release, need the implementation of clone on zbus::Error
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "73346019952f82ec7e4d4d15f5d66841b54e8b61" }
|
||||
cosmic-client-toolkit = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false }
|
||||
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"] }
|
||||
wayland-backend = {version = "0.1.0-beta.14", features = ["client_system"]}
|
||||
wayland-client = {version = "0.30.0-beta.14"}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
use calloop::channel::*;
|
||||
use cosmic::applet::cosmic_panel_config::CosmicPanelOuput;
|
||||
use cosmic_protocols::workspace::v1::client::{
|
||||
zcosmic_workspace_group_handle_v1::{self, ZcosmicWorkspaceGroupHandleV1},
|
||||
zcosmic_workspace_handle_v1::{self, ZcosmicWorkspaceHandleV1},
|
||||
zcosmic_workspace_manager_v1::{self, ZcosmicWorkspaceManagerV1},
|
||||
use cosmic_client_toolkit::{
|
||||
sctk::{
|
||||
self,
|
||||
event_loop::WaylandSource,
|
||||
output::{OutputHandler, OutputState},
|
||||
registry::{ProvidesRegistryState, RegistryState},
|
||||
},
|
||||
workspace::{WorkspaceHandler, WorkspaceState},
|
||||
};
|
||||
use cosmic_protocols::workspace::v1::client::zcosmic_workspace_handle_v1;
|
||||
use futures::{channel::mpsc, executor::block_on, SinkExt};
|
||||
use sctk::event_loop::WaylandSource;
|
||||
use std::{env, os::unix::net::UnixStream, path::PathBuf, str::FromStr, time::Duration};
|
||||
use wayland_backend::client::ObjectId;
|
||||
use wayland_client::{
|
||||
event_created_child,
|
||||
protocol::{
|
||||
wl_output::{self, WlOutput},
|
||||
wl_registry::{self, WlRegistry},
|
||||
},
|
||||
globals::registry_queue_init,
|
||||
protocol::wl_output::{self, WlOutput},
|
||||
ConnectError, Proxy,
|
||||
};
|
||||
use wayland_client::{Connection, Dispatch, QueueHandle};
|
||||
use wayland_client::{Connection, QueueHandle, WEnum};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum WorkspaceEvent {
|
||||
|
|
@ -42,7 +43,7 @@ pub fn spawn_workspaces(tx: mpsc::Sender<WorkspaceList>) -> SyncSender<Workspace
|
|||
.and_then(|s| s.map(|s| Connection::from_socket(s).map_err(anyhow::Error::msg)))
|
||||
{
|
||||
std::thread::spawn(move || {
|
||||
let output = std::env::var("COSMIC_PANEL_OUTPUT")
|
||||
let configured_output = std::env::var("COSMIC_PANEL_OUTPUT")
|
||||
.ok()
|
||||
.map(|output_str| match CosmicPanelOuput::from_str(&output_str) {
|
||||
Ok(CosmicPanelOuput::Name(name)) => name,
|
||||
|
|
@ -51,7 +52,7 @@ pub fn spawn_workspaces(tx: mpsc::Sender<WorkspaceList>) -> SyncSender<Workspace
|
|||
.unwrap_or_default();
|
||||
let mut event_loop = calloop::EventLoop::<State>::try_new().unwrap();
|
||||
let loop_handle = event_loop.handle();
|
||||
let event_queue = conn.new_event_queue::<State>();
|
||||
let (globals, event_queue) = registry_queue_init(&conn).unwrap();
|
||||
let qhandle = event_queue.handle();
|
||||
|
||||
WaylandSource::new(event_queue)
|
||||
|
|
@ -59,43 +60,56 @@ pub fn spawn_workspaces(tx: mpsc::Sender<WorkspaceList>) -> SyncSender<Workspace
|
|||
.insert(loop_handle)
|
||||
.unwrap();
|
||||
|
||||
let display = conn.display();
|
||||
display.get_registry(&qhandle, ());
|
||||
|
||||
let registry_state = RegistryState::new(&globals);
|
||||
let mut state = State {
|
||||
outputs_to_handle: Default::default(),
|
||||
wm_name: None,
|
||||
workspace_manager: None,
|
||||
workspace_groups: Vec::new(),
|
||||
configured_output: output,
|
||||
// Must be before `WorkspaceState`
|
||||
output_state: OutputState::new(&globals, &qhandle),
|
||||
configured_output,
|
||||
workspace_state: WorkspaceState::new(®istry_state, &qhandle),
|
||||
registry_state,
|
||||
expected_output: None,
|
||||
tx,
|
||||
running: true,
|
||||
have_workspaces: false,
|
||||
};
|
||||
let loop_handle = event_loop.handle();
|
||||
loop_handle
|
||||
.insert_source(workspaces_rx, |e, _, state| match e {
|
||||
Event::Msg(WorkspaceEvent::Activate(id)) => {
|
||||
if let Some(w) = state.workspace_groups.iter().find_map(|g| {
|
||||
g.workspaces.iter().find(|w| w.workspace_handle.id() == id)
|
||||
}) {
|
||||
w.workspace_handle.activate();
|
||||
state.workspace_manager.as_ref().unwrap().commit();
|
||||
if let Some(w) = state
|
||||
.workspace_state
|
||||
.workspace_groups()
|
||||
.iter()
|
||||
.find_map(|g| g.workspaces.iter().find(|w| w.handle.id() == id))
|
||||
{
|
||||
w.handle.activate();
|
||||
state
|
||||
.workspace_state
|
||||
.workspace_manager()
|
||||
.get()
|
||||
.unwrap()
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
Event::Msg(WorkspaceEvent::Scroll(v)) => {
|
||||
if let Some((w_g, w_i)) = state.workspace_groups.iter().find_map(|g| {
|
||||
if g.output != state.expected_output {
|
||||
return None;
|
||||
}
|
||||
g.workspaces
|
||||
.iter()
|
||||
.position(|w| {
|
||||
w.states
|
||||
.contains(&zcosmic_workspace_handle_v1::State::Active)
|
||||
})
|
||||
.map(|w_i| (g, w_i))
|
||||
}) {
|
||||
if let Some((w_g, w_i)) = state
|
||||
.workspace_state
|
||||
.workspace_groups()
|
||||
.iter()
|
||||
.find_map(|g| {
|
||||
if g.output != state.expected_output {
|
||||
return None;
|
||||
}
|
||||
g.workspaces
|
||||
.iter()
|
||||
.position(|w| {
|
||||
w.state.contains(&WEnum::Value(
|
||||
zcosmic_workspace_handle_v1::State::Active,
|
||||
))
|
||||
})
|
||||
.map(|w_i| (g, w_i))
|
||||
})
|
||||
{
|
||||
let max_w = w_g.workspaces.len().wrapping_sub(1);
|
||||
let d_i = if v > 0.0 {
|
||||
if w_i == max_w {
|
||||
|
|
@ -111,15 +125,22 @@ pub fn spawn_workspaces(tx: mpsc::Sender<WorkspaceList>) -> SyncSender<Workspace
|
|||
}
|
||||
};
|
||||
if let Some(w) = w_g.workspaces.get(d_i) {
|
||||
w.workspace_handle.activate();
|
||||
state.workspace_manager.as_ref().unwrap().commit();
|
||||
w.handle.activate();
|
||||
state
|
||||
.workspace_state
|
||||
.workspace_manager()
|
||||
.get()
|
||||
.unwrap()
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::Closed => {
|
||||
if let Some(workspace_manager) = &mut state.workspace_manager {
|
||||
for g in &mut state.workspace_groups {
|
||||
g.workspace_group_handle.destroy();
|
||||
if let Ok(workspace_manager) =
|
||||
state.workspace_state.workspace_manager().get()
|
||||
{
|
||||
for g in state.workspace_state.workspace_groups() {
|
||||
g.handle.destroy();
|
||||
}
|
||||
workspace_manager.stop();
|
||||
}
|
||||
|
|
@ -140,44 +161,52 @@ pub fn spawn_workspaces(tx: mpsc::Sender<WorkspaceList>) -> SyncSender<Workspace
|
|||
workspaces_tx
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug)]
|
||||
pub struct State {
|
||||
outputs_to_handle: Option<Vec<WlOutput>>,
|
||||
wm_name: Option<(u32, WlRegistry)>,
|
||||
running: bool,
|
||||
tx: mpsc::Sender<WorkspaceList>,
|
||||
configured_output: String,
|
||||
expected_output: Option<WlOutput>,
|
||||
workspace_manager: Option<ZcosmicWorkspaceManagerV1>,
|
||||
workspace_groups: Vec<WorkspaceGroup>,
|
||||
output_state: OutputState,
|
||||
registry_state: RegistryState,
|
||||
workspace_state: WorkspaceState,
|
||||
have_workspaces: bool,
|
||||
}
|
||||
|
||||
impl State {
|
||||
// XXX
|
||||
pub fn workspace_list(
|
||||
&self,
|
||||
) -> Vec<(String, Option<zcosmic_workspace_handle_v1::State>, ObjectId)> {
|
||||
self.workspace_groups
|
||||
self.workspace_state
|
||||
.workspace_groups()
|
||||
.iter()
|
||||
.filter_map(|g| {
|
||||
// TODO remove none check when workspace groups receive output event
|
||||
if g.output.is_none() || g.output == self.expected_output {
|
||||
if g.output == self.expected_output {
|
||||
Some(g.workspaces.iter().map(|w| {
|
||||
(
|
||||
w.name.clone(),
|
||||
match &w.states {
|
||||
x if x.contains(&zcosmic_workspace_handle_v1::State::Active) => {
|
||||
match &w.state {
|
||||
x if x.contains(&WEnum::Value(
|
||||
zcosmic_workspace_handle_v1::State::Active,
|
||||
)) =>
|
||||
{
|
||||
Some(zcosmic_workspace_handle_v1::State::Active)
|
||||
}
|
||||
x if x.contains(&zcosmic_workspace_handle_v1::State::Urgent) => {
|
||||
x if x.contains(&WEnum::Value(
|
||||
zcosmic_workspace_handle_v1::State::Urgent,
|
||||
)) =>
|
||||
{
|
||||
Some(zcosmic_workspace_handle_v1::State::Urgent)
|
||||
}
|
||||
x if x.contains(&zcosmic_workspace_handle_v1::State::Hidden) => {
|
||||
x if x.contains(&WEnum::Value(
|
||||
zcosmic_workspace_handle_v1::State::Hidden,
|
||||
)) =>
|
||||
{
|
||||
Some(zcosmic_workspace_handle_v1::State::Hidden)
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
w.workspace_handle.id(),
|
||||
w.handle.id(),
|
||||
)
|
||||
}))
|
||||
} else {
|
||||
|
|
@ -189,260 +218,61 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct WorkspaceGroup {
|
||||
workspace_group_handle: ZcosmicWorkspaceGroupHandleV1,
|
||||
output: Option<WlOutput>,
|
||||
workspaces: Vec<Workspace>,
|
||||
impl ProvidesRegistryState for State {
|
||||
fn registry(&mut self) -> &mut RegistryState {
|
||||
&mut self.registry_state
|
||||
}
|
||||
sctk::registry_handlers![OutputState,];
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Workspace {
|
||||
workspace_handle: ZcosmicWorkspaceHandleV1,
|
||||
name: String,
|
||||
coordinates: Vec<u32>,
|
||||
states: Vec<zcosmic_workspace_handle_v1::State>,
|
||||
}
|
||||
impl OutputHandler for State {
|
||||
fn output_state(&mut self) -> &mut OutputState {
|
||||
&mut self.output_state
|
||||
}
|
||||
|
||||
impl Dispatch<wl_registry::WlRegistry, ()> for State {
|
||||
fn event(
|
||||
state: &mut Self,
|
||||
registry: &wl_registry::WlRegistry,
|
||||
event: wl_registry::Event,
|
||||
_: &(),
|
||||
_: &Connection,
|
||||
qh: &QueueHandle<Self>,
|
||||
fn new_output(
|
||||
&mut self,
|
||||
_conn: &Connection,
|
||||
_qh: &QueueHandle<Self>,
|
||||
output: wl_output::WlOutput,
|
||||
) {
|
||||
if let wl_registry::Event::Global {
|
||||
name,
|
||||
interface,
|
||||
version: _version,
|
||||
} = event
|
||||
{
|
||||
match &interface[..] {
|
||||
"zcosmic_workspace_manager_v1" => {
|
||||
if let Some(outputs_to_handle) = state.outputs_to_handle.as_ref() {
|
||||
if outputs_to_handle.is_empty() {
|
||||
let workspace_manager =
|
||||
registry.bind::<ZcosmicWorkspaceManagerV1, _, _>(name, 1, qh, ());
|
||||
state.workspace_manager = Some(workspace_manager);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// will be handled when outputs are done...
|
||||
state.wm_name.replace((name, registry.clone()));
|
||||
}
|
||||
"wl_output" => {
|
||||
let _output = registry.bind::<WlOutput, _, _>(name, 4, qh, ());
|
||||
match state.outputs_to_handle.as_mut() {
|
||||
Some(outputs_to_handle) => outputs_to_handle.push(_output),
|
||||
None => {
|
||||
state.outputs_to_handle.replace(vec![_output]);
|
||||
}
|
||||
};
|
||||
}
|
||||
_ => {}
|
||||
let info = self.output_state.info(&output).unwrap();
|
||||
if info.name.as_deref() == Some(&self.configured_output) {
|
||||
self.expected_output = Some(output);
|
||||
if self.have_workspaces {
|
||||
let _ = block_on(self.tx.send(self.workspace_list()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<ZcosmicWorkspaceManagerV1, ()> for State {
|
||||
fn event(
|
||||
state: &mut Self,
|
||||
_: &ZcosmicWorkspaceManagerV1,
|
||||
event: zcosmic_workspace_manager_v1::Event,
|
||||
_: &(),
|
||||
_: &Connection,
|
||||
_: &QueueHandle<Self>,
|
||||
fn update_output(
|
||||
&mut self,
|
||||
_conn: &Connection,
|
||||
_qh: &QueueHandle<Self>,
|
||||
_output: wl_output::WlOutput,
|
||||
) {
|
||||
match event {
|
||||
zcosmic_workspace_manager_v1::Event::WorkspaceGroup { workspace_group } => {
|
||||
state.workspace_groups.push(WorkspaceGroup {
|
||||
workspace_group_handle: workspace_group,
|
||||
output: None,
|
||||
workspaces: Vec::new(),
|
||||
});
|
||||
}
|
||||
zcosmic_workspace_manager_v1::Event::Done => {
|
||||
for group in &mut state.workspace_groups {
|
||||
group.workspaces.sort_by(|w1, w2| {
|
||||
w1.coordinates
|
||||
.iter()
|
||||
.zip(w2.coordinates.iter())
|
||||
.rev()
|
||||
.skip_while(|(coord1, coord2)| coord1 == coord2)
|
||||
.next()
|
||||
.map(|(coord1, coord2)| coord1.cmp(coord2))
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
});
|
||||
}
|
||||
let _ = block_on(state.tx.send(state.workspace_list()));
|
||||
}
|
||||
zcosmic_workspace_manager_v1::Event::Finished => {
|
||||
state.workspace_manager.take();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
event_created_child!(State, ZcosmicWorkspaceManagerV1, [
|
||||
0 => (ZcosmicWorkspaceGroupHandleV1, ())
|
||||
]);
|
||||
}
|
||||
|
||||
impl Dispatch<ZcosmicWorkspaceGroupHandleV1, ()> for State {
|
||||
fn event(
|
||||
state: &mut Self,
|
||||
group: &ZcosmicWorkspaceGroupHandleV1,
|
||||
event: zcosmic_workspace_group_handle_v1::Event,
|
||||
_: &(),
|
||||
_: &Connection,
|
||||
_: &QueueHandle<Self>,
|
||||
fn output_destroyed(
|
||||
&mut self,
|
||||
_conn: &Connection,
|
||||
_qh: &QueueHandle<Self>,
|
||||
_output: wl_output::WlOutput,
|
||||
) {
|
||||
match event {
|
||||
zcosmic_workspace_group_handle_v1::Event::OutputEnter { output } => {
|
||||
if let Some(group) = state
|
||||
.workspace_groups
|
||||
.iter_mut()
|
||||
.find(|g| &g.workspace_group_handle == group)
|
||||
{
|
||||
group.output = Some(output);
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_group_handle_v1::Event::OutputLeave { output } => {
|
||||
if let Some(group) = state.workspace_groups.iter_mut().find(|g| {
|
||||
&g.workspace_group_handle == group && g.output.as_ref() == Some(&output)
|
||||
}) {
|
||||
group.output = None;
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_group_handle_v1::Event::Workspace { workspace } => {
|
||||
if let Some(group) = state
|
||||
.workspace_groups
|
||||
.iter_mut()
|
||||
.find(|g| &g.workspace_group_handle == group)
|
||||
{
|
||||
group.workspaces.push(Workspace {
|
||||
workspace_handle: workspace,
|
||||
name: String::new(),
|
||||
coordinates: Vec::new(),
|
||||
states: Vec::new(),
|
||||
})
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_group_handle_v1::Event::Remove => {
|
||||
if let Some(group) = state
|
||||
.workspace_groups
|
||||
.iter()
|
||||
.position(|g| &g.workspace_group_handle == group)
|
||||
{
|
||||
state.workspace_groups.remove(group);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
event_created_child!(State, ZcosmicWorkspaceGroupHandleV1, [
|
||||
3 => (ZcosmicWorkspaceHandleV1, ())
|
||||
]);
|
||||
}
|
||||
|
||||
impl Dispatch<ZcosmicWorkspaceHandleV1, ()> for State {
|
||||
fn event(
|
||||
state: &mut Self,
|
||||
workspace: &ZcosmicWorkspaceHandleV1,
|
||||
event: zcosmic_workspace_handle_v1::Event,
|
||||
_: &(),
|
||||
_: &Connection,
|
||||
_: &QueueHandle<Self>,
|
||||
) {
|
||||
match event {
|
||||
zcosmic_workspace_handle_v1::Event::Name { name } => {
|
||||
if let Some(w) = state.workspace_groups.iter_mut().find_map(|g| {
|
||||
g.workspaces
|
||||
.iter_mut()
|
||||
.find(|w| &w.workspace_handle == workspace)
|
||||
}) {
|
||||
w.name = name;
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v1::Event::Coordinates { coordinates } => {
|
||||
if let Some(w) = state.workspace_groups.iter_mut().find_map(|g| {
|
||||
g.workspaces
|
||||
.iter_mut()
|
||||
.find(|w| &w.workspace_handle == workspace)
|
||||
}) {
|
||||
// wayland is host byte order
|
||||
w.coordinates = coordinates
|
||||
.chunks(4)
|
||||
.map(|chunk| u32::from_ne_bytes(chunk.try_into().unwrap()))
|
||||
.collect();
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v1::Event::State {
|
||||
state: workspace_state,
|
||||
} => {
|
||||
if let Some(w) = state.workspace_groups.iter_mut().find_map(|g| {
|
||||
g.workspaces
|
||||
.iter_mut()
|
||||
.find(|w| &w.workspace_handle == workspace)
|
||||
}) {
|
||||
// wayland is host byte order
|
||||
w.states = workspace_state
|
||||
.chunks(4)
|
||||
.map(|chunk| {
|
||||
zcosmic_workspace_handle_v1::State::try_from(u32::from_ne_bytes(
|
||||
chunk.try_into().unwrap(),
|
||||
))
|
||||
.unwrap()
|
||||
})
|
||||
.collect();
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v1::Event::Remove => {
|
||||
if let Some((g, w_i)) = state.workspace_groups.iter_mut().find_map(|g| {
|
||||
g.workspaces
|
||||
.iter_mut()
|
||||
.position(|w| &w.workspace_handle == workspace)
|
||||
.map(|p| (g, p))
|
||||
}) {
|
||||
g.workspaces.remove(w_i);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<WlOutput, ()> for State {
|
||||
fn event(
|
||||
state: &mut Self,
|
||||
o: &WlOutput,
|
||||
e: wl_output::Event,
|
||||
_: &(),
|
||||
_: &Connection,
|
||||
qh: &QueueHandle<Self>,
|
||||
) {
|
||||
match e {
|
||||
wl_output::Event::Name { name } if name == state.configured_output => {
|
||||
state.expected_output.replace(o.clone());
|
||||
// Necessary bc often the output is handled after the workspaces
|
||||
let _ = block_on(state.tx.send(state.workspace_list()));
|
||||
}
|
||||
wl_output::Event::Done => {
|
||||
let outputs_to_handle = state.outputs_to_handle.as_mut().unwrap();
|
||||
outputs_to_handle.retain(|o_to_handle| o != o_to_handle);
|
||||
if outputs_to_handle.is_empty() {
|
||||
if let Some((wm_name, registry)) = state.wm_name.as_ref() {
|
||||
let workspace_manager =
|
||||
registry.bind::<ZcosmicWorkspaceManagerV1, _, _>(*wm_name, 1, qh, ());
|
||||
state.workspace_manager = Some(workspace_manager);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {} // ignored
|
||||
}
|
||||
impl WorkspaceHandler for State {
|
||||
fn workspace_state(&mut self) -> &mut WorkspaceState {
|
||||
&mut self.workspace_state
|
||||
}
|
||||
|
||||
fn done(&mut self) {
|
||||
self.have_workspaces = true;
|
||||
let _ = block_on(self.tx.send(self.workspace_list()));
|
||||
}
|
||||
}
|
||||
|
||||
cosmic_client_toolkit::delegate_workspace!(State);
|
||||
sctk::delegate_output!(State);
|
||||
sctk::delegate_registry!(State);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue