feat(wallpaper): use dropdown and image button widgets

This commit is contained in:
Michael Aaron Murphy 2023-11-13 12:26:38 +01:00 • committed by Michael Murphy
parent 8175e8df97
commit dc9db64592
5 changed files with 184 additions and 117 deletions

171
Cargo.lock generated
View file

@ -22,7 +22,7 @@ source = "git+https://github.com/wash2/accesskit.git?tag=winit-0.28#db6f2587f663
dependencies = [ dependencies = [
"accesskit", "accesskit",
"accesskit_consumer", "accesskit_consumer",
"async-channel", "async-channel 1.9.0",
"atspi", "atspi",
"futures-lite 1.13.0", "futures-lite 1.13.0",
"log", "log",
@ -213,16 +213,29 @@ dependencies = [
] ]
[[package]] [[package]]
name = "async-executor" name = "async-channel"
version = "1.6.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" checksum = "d37875bd9915b7d67c2f117ea2c30a0989874d0b2cb694fe25403c85763c0c9e"
dependencies = [ dependencies = [
"async-lock 2.8.0", "concurrent-queue",
"event-listener 3.1.0",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-executor"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de517d5a758a65a16d18d8f605e7a6beed477444cca270116af40fd3cd59d27"
dependencies = [
"async-lock 3.1.0",
"async-task", "async-task",
"concurrent-queue", "concurrent-queue",
"fastrand 2.0.1", "fastrand 2.0.1",
"futures-lite 1.13.0", "futures-lite 2.0.1",
"slab", "slab",
] ]
@ -244,7 +257,7 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776"
dependencies = [ dependencies = [
"async-channel", "async-channel 1.9.0",
"async-executor", "async-executor",
"async-io 1.13.0", "async-io 1.13.0",
"async-lock 2.8.0", "async-lock 2.8.0",
@ -279,7 +292,7 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997"
dependencies = [ dependencies = [
"async-lock 3.0.0", "async-lock 3.1.0",
"cfg-if", "cfg-if",
"concurrent-queue", "concurrent-queue",
"futures-io", "futures-io",
@ -304,11 +317,11 @@ dependencies = [
[[package]] [[package]]
name = "async-lock" name = "async-lock"
version = "3.0.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45e900cdcd39bb94a14487d3f7ef92ca222162e6c7c3fe7cb3550ea75fb486ed" checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7"
dependencies = [ dependencies = [
"event-listener 3.0.1", "event-listener 3.1.0",
"event-listener-strategy", "event-listener-strategy",
"pin-project-lite", "pin-project-lite",
] ]
@ -324,7 +337,7 @@ dependencies = [
"async-signal", "async-signal",
"blocking", "blocking",
"cfg-if", "cfg-if",
"event-listener 3.0.1", "event-listener 3.1.0",
"futures-lite 1.13.0", "futures-lite 1.13.0",
"rustix 0.38.21", "rustix 0.38.21",
"windows-sys 0.48.0", "windows-sys 0.48.0",
@ -365,7 +378,7 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d"
dependencies = [ dependencies = [
"async-channel", "async-channel 1.9.0",
"async-global-executor", "async-global-executor",
"async-io 1.13.0", "async-io 1.13.0",
"async-lock 2.8.0", "async-lock 2.8.0",
@ -526,16 +539,16 @@ dependencies = [
[[package]] [[package]]
name = "blocking" name = "blocking"
version = "1.4.1" version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118"
dependencies = [ dependencies = [
"async-channel", "async-channel 2.1.0",
"async-lock 2.8.0", "async-lock 3.1.0",
"async-task", "async-task",
"fastrand 2.0.1", "fastrand 2.0.1",
"futures-io", "futures-io",
"futures-lite 1.13.0", "futures-lite 2.0.1",
"piper", "piper",
"tracing", "tracing",
] ]
@ -625,9 +638,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.83" version = "1.0.84"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@ -833,7 +846,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-comp-config" name = "cosmic-comp-config"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/cosmic-comp#f3a8ff8600d2825de945e2130008f9b2c6d64990" source = "git+https://github.com/pop-os/cosmic-comp#9a04fa2abdd53cbe4798dcaaf42bea89d8d073d1"
dependencies = [ dependencies = [
"input", "input",
"serde", "serde",
@ -842,7 +855,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-config" name = "cosmic-config"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"atomicwrites", "atomicwrites",
"calloop", "calloop",
@ -857,7 +870,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-config-derive" name = "cosmic-config-derive"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"quote", "quote",
"syn 1.0.109", "syn 1.0.109",
@ -884,7 +897,7 @@ dependencies = [
"anyhow", "anyhow",
"apply", "apply",
"ashpd 0.6.7", "ashpd 0.6.7",
"async-channel", "async-channel 1.9.0",
"color-eyre", "color-eyre",
"cosmic-comp-config", "cosmic-comp-config",
"cosmic-panel-config", "cosmic-panel-config",
@ -912,6 +925,7 @@ dependencies = [
"rust-embed", "rust-embed",
"serde", "serde",
"slotmap", "slotmap",
"static_init",
"tokio", "tokio",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
@ -993,7 +1007,7 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-theme" name = "cosmic-theme"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"almost", "almost",
"cosmic-config", "cosmic-config",
@ -1323,9 +1337,9 @@ dependencies = [
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.10.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
dependencies = [ dependencies = [
"humantime", "humantime",
"is-terminal", "is-terminal",
@ -1342,9 +1356,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]] [[package]]
name = "errno" name = "errno"
version = "0.3.5" version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.48.0", "windows-sys 0.48.0",
@ -1352,9 +1366,9 @@ dependencies = [
[[package]] [[package]]
name = "etagere" name = "etagere"
version = "0.2.9" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bf70b9ea3a235a7432b4f481854815e2d4fb2fe824c1f5fb09b8985dd06b3e9" checksum = "fcf22f748754352918e082e0039335ee92454a5d62bcaf69b5e8daf5907d9644"
dependencies = [ dependencies = [
"euclid", "euclid",
"svg_fmt", "svg_fmt",
@ -1377,9 +1391,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]] [[package]]
name = "event-listener" name = "event-listener"
version = "3.0.1" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01cec0252c2afff729ee6f00e903d479fba81784c8e2bd77447673471fdfaea1" checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2"
dependencies = [ dependencies = [
"concurrent-queue", "concurrent-queue",
"parking", "parking",
@ -1392,7 +1406,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160"
dependencies = [ dependencies = [
"event-listener 3.0.1", "event-listener 3.1.0",
"pin-project-lite", "pin-project-lite",
] ]
@ -1519,7 +1533,7 @@ dependencies = [
"intl-memoizer", "intl-memoizer",
"intl_pluralrules", "intl_pluralrules",
"rustc-hash", "rustc-hash",
"self_cell", "self_cell 0.10.3",
"smallvec", "smallvec",
"unic-langid", "unic-langid",
] ]
@ -1803,9 +1817,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.10" version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@ -2107,7 +2121,7 @@ dependencies = [
[[package]] [[package]]
name = "iced" name = "iced"
version = "0.10.0" version = "0.10.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"iced_accessibility", "iced_accessibility",
"iced_core", "iced_core",
@ -2122,7 +2136,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_accessibility" name = "iced_accessibility"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"accesskit_unix", "accesskit_unix",
@ -2131,7 +2145,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_core" name = "iced_core"
version = "0.10.0" version = "0.10.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"iced_accessibility", "iced_accessibility",
@ -2146,7 +2160,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_futures" name = "iced_futures"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"futures", "futures",
"iced_core", "iced_core",
@ -2159,7 +2173,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_graphics" name = "iced_graphics"
version = "0.9.0" version = "0.9.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"bytemuck", "bytemuck",
@ -2177,7 +2191,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_renderer" name = "iced_renderer"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"iced_graphics", "iced_graphics",
"iced_tiny_skia", "iced_tiny_skia",
@ -2190,7 +2204,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_runtime" name = "iced_runtime"
version = "0.1.1" version = "0.1.1"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"iced_accessibility", "iced_accessibility",
"iced_core", "iced_core",
@ -2202,7 +2216,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_sctk" name = "iced_sctk"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"enum-repr", "enum-repr",
"float-cmp", "float-cmp",
@ -2226,7 +2240,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_style" name = "iced_style"
version = "0.9.0" version = "0.9.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"iced_core", "iced_core",
"once_cell", "once_cell",
@ -2236,7 +2250,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_tiny_skia" name = "iced_tiny_skia"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"cosmic-text", "cosmic-text",
@ -2254,7 +2268,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_wgpu" name = "iced_wgpu"
version = "0.11.1" version = "0.11.1"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"bytemuck", "bytemuck",
@ -2276,7 +2290,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_widget" name = "iced_widget"
version = "0.1.3" version = "0.1.3"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"iced_renderer", "iced_renderer",
"iced_runtime", "iced_runtime",
@ -2675,7 +2689,7 @@ checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]] [[package]]
name = "libcosmic" name = "libcosmic"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic#484417787a4d7ebf7c3db9473729563ee917e546" source = "git+https://github.com/pop-os/libcosmic#405aaf134d00a6aef223aef3799b3904b1050b0c"
dependencies = [ dependencies = [
"apply", "apply",
"ashpd 0.5.0", "ashpd 0.5.0",
@ -2761,9 +2775,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.4.10" version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]] [[package]]
name = "litemap" name = "litemap"
@ -3896,7 +3910,7 @@ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.1",
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.4.10", "linux-raw-sys 0.4.11",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
@ -3962,9 +3976,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]] [[package]]
name = "self_cell" name = "self_cell"
version = "0.10.2" version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af" checksum = "e14e4d63b804dc0c7ec4a1e52bcb63f02c7ac94476755aa579edac21e01f915d"
dependencies = [
"self_cell 1.0.2",
]
[[package]]
name = "self_cell"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6"
[[package]] [[package]]
name = "serde" name = "serde"
@ -4087,9 +4110,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.11.1" version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]] [[package]]
name = "smithay-client-toolkit" name = "smithay-client-toolkit"
@ -4224,6 +4247,34 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "static_init"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6"
dependencies = [
"bitflags 1.3.2",
"cfg_aliases",
"libc",
"parking_lot 0.11.2",
"parking_lot_core 0.8.6",
"static_init_macro",
"winapi",
]
[[package]]
name = "static_init_macro"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70a2595fc3aa78f2d0e45dd425b22282dd863273761cc77780914b2cf3003acf"
dependencies = [
"cfg_aliases",
"memchr",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "strict-num" name = "strict-num"
version = "0.1.1" version = "0.1.1"
@ -4465,9 +4516,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.33.0" version = "1.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@ -5598,7 +5649,7 @@ dependencies = [
[[package]] [[package]]
name = "xdg-shell-wrapper-config" name = "xdg-shell-wrapper-config"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/xdg-shell-wrapper#fa62a8c865cc5ba391a48fe4753a8687d8ab8ded" source = "git+https://github.com/pop-os/xdg-shell-wrapper#f2ca1c3dee8f66c40bdc91cb39de69a62aaaf22f"
dependencies = [ dependencies = [
"serde", "serde",
"wayland-protocols-wlr", "wayland-protocols-wlr",

View file

@ -41,6 +41,7 @@ image = "0.24.6"
serde = { version = "1.0.180", features = ["derive"] } serde = { version = "1.0.180", features = ["derive"] }
ashpd = "0.6.2" ashpd = "0.6.2"
ron = "0.8" ron = "0.8"
static_init = "1.0.3"
[dependencies.i18n-embed] [dependencies.i18n-embed]
version = "0.13.9" version = "0.13.9"

View file

@ -6,7 +6,6 @@ mod widgets;
use std::{ use std::{
collections::HashMap, collections::HashMap,
path::{Path, PathBuf}, path::{Path, PathBuf},
time::Instant,
}; };
use apply::Apply; use apply::Apply;
@ -22,6 +21,7 @@ use cosmic_settings_page::Section;
use cosmic_settings_page::{self as page, section}; use cosmic_settings_page::{self as page, section};
use image::imageops::FilterType::Lanczos3; use image::imageops::FilterType::Lanczos3;
use slotmap::{DefaultKey, SecondaryMap, SlotMap}; use slotmap::{DefaultKey, SecondaryMap, SlotMap};
use static_init::dynamic;
const SYSTEM_WALLPAPER_DIR: &str = "/usr/share/backgrounds/pop/"; const SYSTEM_WALLPAPER_DIR: &str = "/usr/share/backgrounds/pop/";
@ -46,7 +46,7 @@ const HOUR_2: usize = 5;
pub enum Message { pub enum Message {
ChangeCategory(usize), ChangeCategory(usize),
ColorSelect(wallpaper::Color), ColorSelect(wallpaper::Color),
Fit(String), Fit(usize),
Output(segmented_button::Entity), Output(segmented_button::Entity),
RotationFrequency(usize), RotationFrequency(usize),
SameBackground(bool), SameBackground(bool),
@ -364,11 +364,11 @@ impl Page {
#[must_use] #[must_use]
pub fn display_image_view(&self) -> cosmic::Element<Message> { pub fn display_image_view(&self) -> cosmic::Element<Message> {
match self.cached_display_handle { match self.cached_display_handle {
Some(ref handle) => cosmic::iced::widget::image(handle.clone()) Some(ref handle) => cosmic::widget::image(handle.clone())
.width(Length::Fixed(SIMULATED_WIDTH as f32)) .width(Length::Fixed(SIMULATED_WIDTH as f32))
.into(), .into(),
None => cosmic::iced::widget::Space::new(SIMULATED_WIDTH, SIMULATED_HEIGHT).into(), None => cosmic::widget::Space::new(SIMULATED_WIDTH, SIMULATED_HEIGHT).into(),
} }
} }
@ -382,14 +382,8 @@ impl Page {
self.cached_display_handle = None; self.cached_display_handle = None;
} }
Message::Fit(option) => { Message::Fit(selection) => {
self.selected_fit = self self.selected_fit = selection;
.fit_options
.iter()
.enumerate()
.find(|(_, key)| **key == option)
.map_or(0, |(indice, _)| indice);
self.cache_display_image(); self.cache_display_image();
} }
@ -512,8 +506,6 @@ impl page::Page<crate::pages::Message> for Page {
fn load(&self, _page: page::Entity) -> Option<page::Task<crate::pages::Message>> { fn load(&self, _page: page::Entity) -> Option<page::Task<crate::pages::Message>> {
Some(Box::pin(async move { Some(Box::pin(async move {
let start = Instant::now();
let (config, outputs) = wallpaper::config(); let (config, outputs) = wallpaper::config();
let mut backgrounds = wallpaper::load_each_from_path(SYSTEM_WALLPAPER_DIR.into()); let mut backgrounds = wallpaper::load_each_from_path(SYSTEM_WALLPAPER_DIR.into());
@ -533,11 +525,6 @@ impl page::Page<crate::pages::Message> for Page {
update.selection_handles.insert(id, selection_handle); update.selection_handles.insert(id, selection_handle);
} }
tracing::debug!(
"loaded wallpapers in {:?}",
Instant::now().duration_since(start)
);
crate::pages::Message::DesktopWallpaper(Message::Update(Box::new(( crate::pages::Message::DesktopWallpaper(Message::Update(Box::new((
config, outputs, update, config, outputs, update,
)))) ))))
@ -547,18 +534,28 @@ impl page::Page<crate::pages::Message> for Page {
impl page::AutoBind<crate::pages::Message> for Page {} impl page::AutoBind<crate::pages::Message> for Page {}
#[dynamic]
static WALLPAPER_SAME: String = fl!("wallpaper", "same");
#[dynamic]
static WALLPAPER_FIT: String = fl!("wallpaper", "fit");
#[dynamic]
static WALLPAPER_SLIDE: String = fl!("wallpaper", "slide");
#[dynamic]
static WALLPAPER_CHANGE: String = fl!("wallpaper", "change");
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
pub fn settings() -> Section<crate::pages::Message> { pub fn settings() -> Section<crate::pages::Message> {
Section::default() Section::default()
.descriptions(vec![ .descriptions(vec![
fl!("wallpaper", "same"), WALLPAPER_SAME.clone(),
fl!("wallpaper", "fit"), WALLPAPER_FIT.clone(),
fl!("wallpaper", "slide"), WALLPAPER_SLIDE.clone(),
fl!("wallpaper", "change"), WALLPAPER_CHANGE.clone(),
]) ])
.view::<Page>(|_binder, page, section| { .view::<Page>(|_binder, page, _section| {
let descriptions = &section.descriptions;
let mut children = Vec::with_capacity(3); let mut children = Vec::with_capacity(3);
let mut show_slideshow_toggle = true; let mut show_slideshow_toggle = true;
@ -590,7 +587,7 @@ pub fn settings() -> Section<crate::pages::Message> {
.vertical_alignment(alignment::Vertical::Center) .vertical_alignment(alignment::Vertical::Center)
.width(Length::Fill) .width(Length::Fill)
.height(Length::Fill) .height(Length::Fill)
.apply(cosmic::iced::widget::container) .apply(cosmic::widget::container)
.width(Length::Fill) .width(Length::Fill)
.height(Length::Fixed(32.0)) .height(Length::Fixed(32.0))
.into() .into()
@ -600,32 +597,29 @@ pub fn settings() -> Section<crate::pages::Message> {
.into() .into()
}); });
let background_fit = cosmic::iced::widget::pick_list( let background_fit =
&page.fit_options, cosmic::widget::dropdown(&page.fit_options, Some(page.selected_fit), Message::Fit);
page.fit_options.get(page.selected_fit).cloned(),
Message::Fit,
);
children.push({ children.push({
let mut column = list_column() let mut column = list_column()
.add(settings::item( .add(settings::item(
&descriptions[0], &*WALLPAPER_SAME,
toggler(None, page.config.same_on_all, Message::SameBackground), toggler(None, page.config.same_on_all, Message::SameBackground),
)) ))
.add(settings::item(&descriptions[1], background_fit)); .add(settings::item(&*WALLPAPER_FIT, background_fit));
if show_slideshow_toggle { if show_slideshow_toggle {
column = column.add(settings::item( column = column.add(settings::item(
&descriptions[2], &*WALLPAPER_SLIDE,
toggler(None, slideshow_enabled, Message::Slideshow), toggler(None, slideshow_enabled, Message::Slideshow),
)); ));
} }
// The rotation frequency pick list should only be shown when the slideshow is enabled. // The rotation frequency dropdown should only be shown when the slideshow is enabled.
if slideshow_enabled { if slideshow_enabled {
column column
.add(settings::item( .add(settings::item(
&descriptions[3], &*WALLPAPER_CHANGE,
dropdown( dropdown(
&page.rotation_options, &page.rotation_options,
Some(page.selected_rotation), Some(page.selected_rotation),
@ -649,18 +643,31 @@ pub fn settings() -> Section<crate::pages::Message> {
match page.active_category { match page.active_category {
// Displays system wallpapers that are available to select from // Displays system wallpapers that are available to select from
CATEGORY_SYSTEM_WALLPAPERS => { CATEGORY_SYSTEM_WALLPAPERS => {
children.push(widgets::wallpaper_select_options(page)); children.push(widgets::wallpaper_select_options(
page,
if let Choice::Background(selection) = page.selection.active {
Some(selection)
} else {
None
},
));
} }
// Displays colors and gradients that are available to select from // Displays colors and gradients that are available to select from
CATEGORY_COLOR => { CATEGORY_COLOR => {
children.push(widgets::color_select_options()); children.push(widgets::color_select_options(
if let Choice::Color(ref color) = page.selection.active {
Some(color)
} else {
None
},
));
} }
_ => (), _ => (),
} }
cosmic::iced::widget::column(children) cosmic::widget::column::with_children(children)
.spacing(22) .spacing(22)
.apply(Element::from) .apply(Element::from)
.map(crate::pages::Message::DesktopWallpaper) .map(crate::pages::Message::DesktopWallpaper)

View file

@ -5,7 +5,7 @@ use super::Message;
use cosmic::iced_core::{self, gradient::Linear, Background, BorderRadius, Color, Degrees, Length}; use cosmic::iced_core::{self, gradient::Linear, Background, BorderRadius, Color, Degrees, Length};
use cosmic::iced_runtime::core::image::Handle as ImageHandle; use cosmic::iced_runtime::core::image::Handle as ImageHandle;
use cosmic::prelude::*; use cosmic::prelude::*;
use cosmic::widget::{button, container, image, space}; use cosmic::widget::{button, container, space};
use cosmic::{iced, Element}; use cosmic::{iced, Element};
use cosmic_settings_desktop::wallpaper; use cosmic_settings_desktop::wallpaper;
use slotmap::DefaultKey; use slotmap::DefaultKey;
@ -15,10 +15,11 @@ const COLUMN_SPACING: u16 = 12;
const ROW_SPACING: u16 = 16; const ROW_SPACING: u16 = 16;
/// A button for selecting a color or gradient. /// A button for selecting a color or gradient.
pub fn color_button(color: wallpaper::Color) -> Element<'static, Message> { pub fn color_button(color: wallpaper::Color, selected: bool) -> Element<'static, Message> {
button(color_image(color.clone(), COLOR_WIDTH, COLOR_WIDTH, 8.0)) button(color_image(color.clone(), COLOR_WIDTH, COLOR_WIDTH, 8.0))
.padding(0) .padding(0)
.style(button::Style::IconVertical) .selected(selected)
.style(button::Style::Image)
.on_press(Message::ColorSelect(color)) .on_press(Message::ColorSelect(color))
.into() .into()
} }
@ -64,22 +65,32 @@ pub fn color_image(
} }
/// Color selection list /// Color selection list
pub fn color_select_options() -> Element<'static, Message> { pub fn color_select_options(selected: Option<&wallpaper::Color>) -> Element<'static, Message> {
let mut vec = Vec::with_capacity(wallpaper::DEFAULT_COLORS.len()); let mut vec = Vec::with_capacity(wallpaper::DEFAULT_COLORS.len());
for color in wallpaper::DEFAULT_COLORS { for color in wallpaper::DEFAULT_COLORS {
vec.push(color_button(color.clone())); vec.push(color_button(
color.clone(),
selected.map_or(false, |selection| selection == color),
));
} }
flex_select_row(vec) flex_select_row(vec)
} }
/// Background selection list /// Background selection list
pub fn wallpaper_select_options(page: &super::Page) -> Element<Message> { pub fn wallpaper_select_options(
page: &super::Page,
selected: Option<DefaultKey>,
) -> Element<Message> {
let mut vec = Vec::with_capacity(page.selection.selection_handles.len()); let mut vec = Vec::with_capacity(page.selection.selection_handles.len());
for (id, handle) in &page.selection.selection_handles { for (id, handle) in &page.selection.selection_handles {
vec.push(wallpaper_button(handle, id)); vec.push(wallpaper_button(
handle,
id,
selected.map_or(false, |selection| id == selection),
));
} }
flex_select_row(vec) flex_select_row(vec)
@ -95,12 +106,9 @@ fn flex_select_row(elements: Vec<Element<Message>>) -> Element<Message> {
.into() .into()
} }
fn wallpaper_button(handle: &ImageHandle, id: DefaultKey) -> Element<Message> { fn wallpaper_button(handle: &ImageHandle, id: DefaultKey, selected: bool) -> Element<Message> {
let image = image(handle.clone()).apply(iced::Element::from); cosmic::widget::button::image(handle.clone())
.selected(selected)
button(image)
.padding(0)
.style(cosmic::theme::Button::Transparent)
.on_press(Message::Select(id)) .on_press(Message::Select(id))
.into() .into()
} }

View file

@ -79,7 +79,7 @@ install: (install-bin bin-src bin-dest) (install-file desktop-src desktop-dest)
# Run the application for testing purposes # Run the application for testing purposes
run *args: run *args:
env RUST_LOG=debug RUST_BACKTRACE=full cargo run --release {{args}} env RUST_LOG=debug RUST_BACKTRACE=full cargo run --release {{args}}
@just resources/icons/install
# Run `cargo test` # Run `cargo test`
test: test:
cargo test cargo test