diff --git a/Cargo.lock b/Cargo.lock index 5a082de..c8471fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,17 +4,17 @@ version = 4 [[package]] name = "anyhow" -version = "1.0.95" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "async-broadcast" -version = "0.7.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" dependencies = [ - "event-listener 5.4.0", + "event-listener 5.3.1", "event-listener-strategy", "futures-core", "pin-project-lite", @@ -107,7 +107,7 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 5.4.0", + "event-listener 5.3.1", "event-listener-strategy", "pin-project-lite", ] @@ -125,7 +125,7 @@ dependencies = [ "async-task", "blocking", "cfg-if", - "event-listener 5.4.0", + "event-listener 5.3.1", "futures-lite", "rustix", "tracing", @@ -138,8 +138,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -194,13 +194,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.85" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -223,9 +223,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.8.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blight" @@ -258,11 +258,11 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "cairo-rs" -version = "0.20.7" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae50b5510d86cf96ac2370e66d8dc960882f3df179d6a5a1e52bd94a1416c0f7" +checksum = "d7fa699e1d7ae691001a811dda5ef0e3e42e1d4119b26426352989df9e94e3e6" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.6.0", "cairo-sys-rs", "glib", "libc", @@ -270,9 +270,9 @@ dependencies = [ [[package]] name = "cairo-sys-rs" -version = "0.20.7" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f18b6bb8e43c7eb0f2aac7976afe0c61b6f5fc2ab7bc4c139537ea56c92290df" +checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f" dependencies = [ "glib-sys", "libc", @@ -287,9 +287,9 @@ checksum = "d499b43edbf784dd81e16f0395f5b4350a35b477da8a074251087adefc11cb52" [[package]] name = "cc" -version = "1.2.10" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ "shlex", ] @@ -318,12 +318,12 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "colored" -version = "2.2.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ "lazy_static", - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] @@ -337,9 +337,66 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote 1.0.37", + "strsim", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote 1.0.37", + "syn 1.0.109", +] + +[[package]] +name = "dbus" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" +dependencies = [ + "libc", + "libdbus-sys", + "winapi", +] + +[[package]] +name = "derive_is_enum_variant" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0ac8859845146979953797f03cc5b282fb4396891807cdb3d04929a88418197" +dependencies = [ + "heck 0.3.3", + "quote 0.3.15", + "syn 0.11.11", +] [[package]] name = "either" @@ -353,11 +410,22 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" +[[package]] +name = "enum-kinds" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e40a16955681d469ab3da85aaa6b42ff656b3c67b52e1d8d3dd36afe97fd462" +dependencies = [ + "proc-macro2", + "quote 1.0.37", + "syn 1.0.109", +] + [[package]] name = "enumflags2" -version = "0.7.11" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba2f4b465f5318854c6f8dd686ede6c0a9dc67d4b1ac241cf0eb51521a309147" +checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" dependencies = [ "enumflags2_derive", "serde", @@ -365,13 +433,13 @@ dependencies = [ [[package]] name = "enumflags2_derive" -version = "0.7.11" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79" +checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -421,9 +489,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "5.4.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" dependencies = [ "concurrent-queue", "parking", @@ -436,7 +504,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ - "event-listener 5.4.0", + "event-listener 5.3.1", "pin-project-lite", ] @@ -456,6 +524,33 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "from_variants" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e859c8f2057687618905dbe99fc76e836e0a69738865ef90e46fc214a41bbf2" +dependencies = [ + "from_variants_impl", +] + +[[package]] +name = "from_variants_impl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55a5e644a80e6d96b2b4910fa7993301d7b7926c045b475b62202b20a36ce69e" +dependencies = [ + "darling", + "proc-macro2", + "quote 1.0.37", + "syn 1.0.109", +] + [[package]] name = "fs4" version = "0.6.6" @@ -500,9 +595,9 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.6.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ "fastrand", "futures-core", @@ -518,8 +613,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -546,9 +641,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.20.7" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6efc7705f7863d37b12ad6974cbb310d35d054f5108cdc1e69037742f573c4c" +checksum = "c4c29071a9e92337d8270a85cb0510cda4ac478be26d09ad027cc1d081911b19" dependencies = [ "gdk-pixbuf-sys", "gio", @@ -558,9 +653,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf-sys" -version = "0.20.7" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67f2587c9202bf997476bbba6aaed4f78a11538a2567df002a5f57f5331d0b5c" +checksum = "687343b059b91df5f3fbd87b4307038fa9e647fcc0461d0d3f93e94fee20bf3d" dependencies = [ "gio-sys", "glib-sys", @@ -571,9 +666,9 @@ dependencies = [ [[package]] name = "gdk4" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0196720118f880f71fe7da971eff58cc43a89c9cf73f46076b7cb1e60889b15" +checksum = "75933c4a86e8a2428814d367e22c733304fdfabc87f415750fd2f55409b6ee48" dependencies = [ "cairo-rs", "gdk-pixbuf", @@ -587,9 +682,9 @@ dependencies = [ [[package]] name = "gdk4-sys" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b0e1340bd15e7a78810cf39fed9e5d85f0a8f80b1d999d384ca17dcc452b60" +checksum = "20af0656d543aed3e57ac4120ef76d091c3c42ab1e0507a8febde7cd005640e2" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -602,22 +697,11 @@ dependencies = [ "system-deps", ] -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "gio" -version = "0.20.7" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a517657589a174be9f60c667f1fec8b7ac82ed5db4ebf56cf073a3b5955d8e2e" +checksum = "8826d2a9ad56ce3de1f04bea0bea0daff6f5f1c913cc834996cfea1f9401361c" dependencies = [ "futures-channel", "futures-core", @@ -632,15 +716,15 @@ dependencies = [ [[package]] name = "gio-sys" -version = "0.20.8" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8446d9b475730ebef81802c1738d972db42fde1c5a36a627ebc4d665fc87db04" +checksum = "b965df6f3534c84816b5c1a7d9efcb5671ae790822de5abe8e299797039529bc" dependencies = [ "glib-sys", "gobject-sys", "libc", "system-deps", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -665,11 +749,11 @@ dependencies = [ [[package]] name = "glib" -version = "0.20.7" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f969edf089188d821a30cde713b6f9eb08b20c63fc2e584aba2892a7984a8cc0" +checksum = "86bd3e4ee7998ab5a135d900db56930cc19ad16681adf245daff54f618b9d5e1" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.6.0", "futures-channel", "futures-core", "futures-executor", @@ -686,22 +770,22 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.20.7" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715601f8f02e71baef9c1f94a657a9a77c192aea6097cf9ae7e5e177cd8cde68" +checksum = "e7d21ca27acfc3e91da70456edde144b4ac7c36f78ee77b10189b3eb4901c156" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro-crate", "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] name = "glib-sys" -version = "0.20.7" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b360ff0f90d71de99095f79c526a5888c9c92fc9ee1b19da06c6f5e75f0c2a53" +checksum = "3d0b1827e8621fc42c0dfb228e5d57ff6a71f9699e666ece8113f979ad87c2de" dependencies = [ "libc", "system-deps", @@ -721,9 +805,9 @@ dependencies = [ [[package]] name = "gobject-sys" -version = "0.20.7" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a56235e971a63bfd75abb13ef70064e1346388723422a68580d8a6fbac6423" +checksum = "a4c674d2ff8478cf0ec29d2be730ed779fef54415a2fb4b565c52def62696462" dependencies = [ "glib-sys", "libc", @@ -732,9 +816,9 @@ dependencies = [ [[package]] name = "graphene-rs" -version = "0.20.7" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f39d3bcd2e24fd9c2874a56f277b72c03e728de9bdc95a8d4ef4c962f10ced98" +checksum = "1f53144c7fe78292705ff23935f1477d511366fb2f73c43d63b37be89076d2fe" dependencies = [ "glib", "graphene-sys", @@ -743,9 +827,9 @@ dependencies = [ [[package]] name = "graphene-sys" -version = "0.20.7" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a68d39515bf340e879b72cecd4a25c1332557757ada6e8aba8654b4b81d23a" +checksum = "e741797dc5081e59877a4d72c442c72d61efdd99161a0b1c1b29b6b988934b99" dependencies = [ "glib-sys", "libc", @@ -755,9 +839,9 @@ dependencies = [ [[package]] name = "gsk4" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b9188db0a6219e708b6b6e7225718e459def664023dbddb8395ca1486d8102" +checksum = "b36933c1e79df378aa6e606576e680358a9582ed8c16f33e94899636e6fa6df6" dependencies = [ "cairo-rs", "gdk4", @@ -770,9 +854,9 @@ dependencies = [ [[package]] name = "gsk4-sys" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca10fc65d68528a548efa3d8747934adcbe7058b73695c9a7f43a25352fce14" +checksum = "0877a9d485bd9ba5262b0c9bce39e63750e525e3aebeb359d271ca1f0e111f1d" dependencies = [ "cairo-sys-rs", "gdk4-sys", @@ -786,9 +870,9 @@ dependencies = [ [[package]] name = "gtk4" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b697ff938136625f6acf75f01951220f47a45adcf0060ee55b4671cf734dac44" +checksum = "9376d14d7e33486c54823a42bef296e882b9f25cb4c52b52f4d1d57bbadb5b6d" dependencies = [ "cairo-rs", "field-offset", @@ -811,7 +895,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3e1e1b1516be3d7ca089dfa6a1e688e268c74aef50c0c25fe8c46b1ba8ed1cc" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.6.0", "gdk4", "glib", "glib-sys", @@ -835,21 +919,21 @@ dependencies = [ [[package]] name = "gtk4-macros" -version = "0.9.5" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed1786c4703dd196baf7e103525ce0cf579b3a63a0570fe653b7ee6bac33999" +checksum = "a7c518d5dd41c57385c7cd30af52e261820c897fc1144e558bb88c303d048ae2" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] name = "gtk4-sys" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af4b680cee5d2f786a2f91f1c77e95ecf2254522f0ca4edf3a2dce6cb35cecf" +checksum = "e653b0a9001ba9be1ffddb9373bfe9a111f688222f5aeee2841481300d91b55a" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -870,6 +954,15 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "heck" version = "0.5.0" @@ -894,6 +987,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "indexmap" version = "2.7.0" @@ -946,9 +1045,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ "once_cell", "wasm-bindgen", @@ -977,9 +1076,18 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" + +[[package]] +name = "libdbus-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72" +dependencies = [ + "pkg-config", +] [[package]] name = "libpulse-binding" @@ -1020,15 +1128,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.15" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" -version = "0.4.25" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" dependencies = [ "value-bag", ] @@ -1048,13 +1156,26 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mpris" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cef955a7826b1e00e901a3652e7a895abd221fb4ab61547e7d0e4c235d7feb" +dependencies = [ + "dbus", + "derive_is_enum_variant", + "enum-kinds", + "from_variants", + "thiserror", +] + [[package]] name = "nix" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.6.0", "cfg-if", "cfg_aliases", "libc", @@ -1068,7 +1189,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ "proc-macro2", - "quote", + "quote 1.0.37", "syn 1.0.109", ] @@ -1099,9 +1220,9 @@ dependencies = [ [[package]] name = "pango" -version = "0.20.7" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e89bd74250a03a05cec047b43465469102af803be2bf5e5a1088f8b8455e087" +checksum = "71e34e7ca2c52e3933d7e5251409a82b83725fa9d6d48fbdaacec056b3a0554a" dependencies = [ "gio", "glib", @@ -1111,9 +1232,9 @@ dependencies = [ [[package]] name = "pango-sys" -version = "0.20.7" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71787e0019b499a5eda889279e4adb455a4f3fdd6870cd5ab7f4a5aa25df6699" +checksum = "84fd65917bf12f06544ae2bbc200abf9fc0a513a5a88a0fa81013893aef2b838" dependencies = [ "glib-sys", "gobject-sys", @@ -1129,9 +1250,9 @@ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1182,9 +1303,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -1200,13 +1321,28 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.38" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" + +[[package]] +name = "quote" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] +[[package]] +name = "runtime-format" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09958d5b38bca768ede7928c767c89a08ba568144a7b61992aecae79b03c8c94" +dependencies = [ + "tinyvec", +] + [[package]] name = "rustc_version" version = "0.4.1" @@ -1218,47 +1354,41 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.43" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.59.0", ] -[[package]] -name = "rustversion" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" - [[package]] name = "semver" -version = "1.0.24" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.217" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -1268,8 +1398,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -1296,7 +1426,7 @@ dependencies = [ "bitflags 1.3.2", "itertools", "proc-macro2", - "quote", + "quote 1.0.37", "syn 1.0.109", ] @@ -1330,6 +1460,18 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strfmt" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a8348af2d9fc3258c8733b8d9d8db2e56f54b2363a4b5b81585c7875ed65e65" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "substring" version = "1.4.5" @@ -1355,17 +1497,31 @@ dependencies = [ "lazy_static", "libc", "libpulse-binding", + "mpris", "nix", "pulsectl-rs", + "runtime-format", "serde", "serde_derive", "shrinkwraprs", + "strfmt", "substring", "thiserror", "toml", "zbus", ] +[[package]] +name = "syn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +dependencies = [ + "quote 0.3.15", + "synom", + "unicode-xid", +] + [[package]] name = "syn" version = "1.0.109" @@ -1373,21 +1529,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", - "quote", + "quote 1.0.37", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.96" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", - "quote", + "quote 1.0.37", "unicode-ident", ] +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" +dependencies = [ + "unicode-xid", +] + [[package]] name = "system-deps" version = "7.0.3" @@ -1395,7 +1560,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" dependencies = [ "cfg-expr", - "heck", + "heck 0.5.0", "pkg-config", "toml", "version-compare", @@ -1409,13 +1574,12 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.15.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", - "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", @@ -1437,10 +1601,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "toml" version = "0.8.19" @@ -1493,8 +1672,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -1534,6 +1713,18 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" + [[package]] name = "value-bag" version = "1.10.0" @@ -1546,43 +1737,36 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", - "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.100" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.50" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -1593,41 +1777,38 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ - "quote", + "quote 1.0.37", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "web-sys" -version = "0.3.77" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -1664,6 +1845,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.59.0" @@ -1796,9 +1986,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.24" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -1815,15 +2005,15 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.25" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b940ebc25896e71dd073bad2dbaa2abfe97b0a391415e22ad1326d9c54e3c4" +checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432" [[package]] name = "zbus" -version = "5.3.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "192a0d989036cd60a1e91a54c9851fb9ad5bd96125d41803eed79d2e2ef74bd7" +checksum = "2494e4b3f44d8363eef79a8a75fc0649efb710eef65a66b5e688a5eb4afe678a" dependencies = [ "async-broadcast", "async-executor", @@ -1836,7 +2026,7 @@ dependencies = [ "async-trait", "blocking", "enumflags2", - "event-listener 5.4.0", + "event-listener 5.3.1", "futures-core", "futures-util", "hex", @@ -1857,14 +2047,14 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "5.3.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3685b5c81fce630efc3e143a4ded235b107f1b1cdf186c3f115529e5e5ae4265" +checksum = "445efc01929302aee95e2b25bbb62a301ea8a6369466e4278e58e7d1dfb23631" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", "zbus_names", "zvariant", "zvariant_utils", @@ -1905,8 +2095,8 @@ checksum = "573a8dd76961957108b10f7a45bac6ab1ea3e9b7fe01aff88325dc57bb8f5c8b" dependencies = [ "proc-macro-crate", "proc-macro2", - "quote", - "syn 2.0.96", + "quote 1.0.37", + "syn 2.0.90", "zvariant_utils", ] @@ -1917,9 +2107,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddd46446ea2a1f353bfda53e35f17633afa79f4fe290a611c94645c69fe96a50" dependencies = [ "proc-macro2", - "quote", + "quote 1.0.37", "serde", "static_assertions", - "syn 2.0.96", + "syn 2.0.90", "winnow", ] diff --git a/Cargo.toml b/Cargo.toml index 6ce6ed1..a4e52a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,3 +42,6 @@ blight = "0.7.0" anyhow = "1.0.75" thiserror = "1.0.49" async-channel = "2.3.1" +mpris = "2.0.1" +runtime-format = "0.1.3" +strfmt = "0.2.4" diff --git a/data/config/backend.toml b/data/config/backend.toml new file mode 100644 index 0000000..00fce1a --- /dev/null +++ b/data/config/backend.toml @@ -0,0 +1 @@ +[input] diff --git a/data/config/config.toml b/data/config/config.toml new file mode 100644 index 0000000..5089aa9 --- /dev/null +++ b/data/config/config.toml @@ -0,0 +1,19 @@ +[client] +## style file for the OSD +# style = /etc/xdg/swayosd/style.css + +## on which height to show the OSD +# top_margin = 0.85 + +## The maximum volume that can be reached in % +# max_volume = 150 + +## show percentage on the right of the OSD +# show_percentage = true + +## set format for the media player OSD +# playerctl_format = "{artist} - {title}" +## Available values: +## artist, albumArtist, title, album, trackNumber, discNumber, autoRating + +[server] diff --git a/data/icons/scalable/status/pause-large-symbolic.svg b/data/icons/scalable/status/pause-large-symbolic.svg new file mode 100644 index 0000000..d40c097 --- /dev/null +++ b/data/icons/scalable/status/pause-large-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/scalable/status/play-large-symbolic.svg b/data/icons/scalable/status/play-large-symbolic.svg new file mode 100644 index 0000000..5210a7e --- /dev/null +++ b/data/icons/scalable/status/play-large-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/scalable/status/playlist-consecutive-symbolic.svg b/data/icons/scalable/status/playlist-consecutive-symbolic.svg new file mode 100644 index 0000000..6bd9903 --- /dev/null +++ b/data/icons/scalable/status/playlist-consecutive-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/scalable/status/playlist-shuffle-symbolic.svg b/data/icons/scalable/status/playlist-shuffle-symbolic.svg new file mode 100644 index 0000000..f18cf05 --- /dev/null +++ b/data/icons/scalable/status/playlist-shuffle-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/scalable/status/seek-backward-large-symbolic.svg b/data/icons/scalable/status/seek-backward-large-symbolic.svg new file mode 100644 index 0000000..11fa0c3 --- /dev/null +++ b/data/icons/scalable/status/seek-backward-large-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/scalable/status/seek-forward-large-symbolic.svg b/data/icons/scalable/status/seek-forward-large-symbolic.svg new file mode 100644 index 0000000..72b819e --- /dev/null +++ b/data/icons/scalable/status/seek-forward-large-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/icons/scalable/status/stop-large-symbolic.svg b/data/icons/scalable/status/stop-large-symbolic.svg new file mode 100644 index 0000000..92ce2c6 --- /dev/null +++ b/data/icons/scalable/status/stop-large-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/data/meson.build b/data/meson.build index b3099cf..5224b7f 100644 --- a/data/meson.build +++ b/data/meson.build @@ -70,3 +70,7 @@ style_css = custom_target( ) message(style_css.full_path()) + +install_data(['config/config.toml', 'config/backend.toml'], + install_dir : config_path +) diff --git a/data/swayosd.gresource.xml b/data/swayosd.gresource.xml index ffc363c..2e5a067 100644 --- a/data/swayosd.gresource.xml +++ b/data/swayosd.gresource.xml @@ -18,5 +18,13 @@ icons/scalable/status/source-volume-medium-symbolic.svg icons/scalable/status/source-volume-low-symbolic.svg icons/scalable/status/source-volume-muted-symbolic.svg + + icons/scalable/status/pause-large-symbolic.svg + icons/scalable/status/play-large-symbolic.svg + icons/scalable/status/seek-backward-large-symbolic.svg + icons/scalable/status/seek-forward-large-symbolic.svg + icons/scalable/status/playlist-consecutive-symbolic.svg + icons/scalable/status/playlist-shuffle-symbolic.svg + icons/scalable/status/stop-large-symbolic.svg diff --git a/rustfmt.toml b/rustfmt.toml index 2940225..0a52b15 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -55,7 +55,7 @@ match_block_trailing_comma = false blank_lines_upper_bound = 1 blank_lines_lower_bound = 0 edition = "2015" -version = "One" +style_edition = "2021" inline_attribute_width = 0 format_generated_files = true merge_derives = true diff --git a/src/argtypes.rs b/src/argtypes.rs index 9e8427c..acfa466 100644 --- a/src/argtypes.rs +++ b/src/argtypes.rs @@ -8,6 +8,7 @@ pub enum ArgTypes { TopMargin = isize::MIN + 1, MaxVolume = isize::MIN + 2, CustomIcon = isize::MIN + 3, + Player = isize::MIN + 4, // Other None = 0, CapsLock = 1, @@ -23,6 +24,7 @@ pub enum ArgTypes { NumLock = 10, ScrollLock = 11, CustomMessage = 13, + Playerctl = 14, } impl fmt::Display for ArgTypes { @@ -46,6 +48,8 @@ impl fmt::Display for ArgTypes { ArgTypes::TopMargin => "TOP-MARGIN", ArgTypes::CustomMessage => "CUSTOM-MESSAGE", ArgTypes::CustomIcon => "CUSTOM-ICON", + ArgTypes::Playerctl => "PLAYERCTL", + ArgTypes::Player => "PLAYER", }; return write!(f, "{}", string); } @@ -73,6 +77,8 @@ impl str::FromStr for ArgTypes { "TOP-MARGIN" => ArgTypes::TopMargin, "CUSTOM-MESSAGE" => ArgTypes::CustomMessage, "CUSTOM-ICON" => ArgTypes::CustomIcon, + "PLAYERCTL" => ArgTypes::Playerctl, + "PLAYER" => ArgTypes::Player, other_type => return Err(other_type.to_owned()), }; Ok(result) diff --git a/src/client/main.rs b/src/client/main.rs index 0edda88..6d695a3 100644 --- a/src/client/main.rs +++ b/src/client/main.rs @@ -156,6 +156,16 @@ fn main() -> Result<(), glib::Error> { "Shows brightness osd and raises or loweres all available sources of brightness device", Some("raise|lower|(±)number"), ); + + // Control players cmdline arg + app.add_main_option( + "playerctl", + glib::Char::from(0), + OptionFlags::NONE, + OptionArg::String, + "Shows Playerctl osd and runs the playerctl command", + Some("play-pause|play|pause|stop|next|prev|shuffle"), + ); app.add_main_option( "max-volume", glib::Char::from(0), @@ -172,6 +182,14 @@ fn main() -> Result<(), glib::Error> { "For which device to increase/decrease audio", Some("Pulseaudio device name (pactl list short sinks|sources)"), ); + app.add_main_option( + "player", + glib::Char::from(0), + OptionFlags::NONE, + OptionArg::String, + "For which player to run the playerctl commands", + Some("auto|all|(playerctl -l)"), + ); app.add_main_option( "custom-message", diff --git a/src/config/user.rs b/src/config/user.rs index ab18453..4b88bba 100644 --- a/src/config/user.rs +++ b/src/config/user.rs @@ -9,13 +9,14 @@ use std::path::PathBuf; #[serde(deny_unknown_fields)] pub struct ClientConfig {} -#[derive(Deserialize, Default, Debug)] +#[derive(Deserialize, Default, Debug, Clone)] #[serde(deny_unknown_fields)] pub struct ServerConfig { pub style: Option, pub top_margin: Option, pub max_volume: Option, pub show_percentage: Option, + pub playerctl_format: Option, } #[derive(Deserialize, Default, Debug)] diff --git a/src/global_utils.rs b/src/global_utils.rs index 9c0b87d..c8a7035 100644 --- a/src/global_utils.rs +++ b/src/global_utils.rs @@ -95,6 +95,19 @@ pub(crate) fn handle_application_args( } } } + "playerctl" => { + let value = child.value().str().unwrap_or(""); + match value { + "play-pause" | "play" | "pause" | "next" | "prev" | "previous" | "shuffle" + | "stop" => (), + x => { + eprintln!("Unknown Playerctl command: \"{}\"!...", x); + return (HandleLocalStatus::FAILURE, actions); + } + } + + (ArgTypes::Playerctl, Some(value.to_string())) + } "device" => { let value = match child.value().str() { Some(v) => v.to_string(), @@ -125,6 +138,16 @@ pub(crate) fn handle_application_args( }; (ArgTypes::CustomIcon, Some(value)) } + "player" => { + let value = match child.value().str() { + Some(v) => v.to_string(), + None => { + eprintln!("--player found but no name given"); + return (HandleLocalStatus::FAILURE, actions); + } + }; + (ArgTypes::Player, Some(value)) + } "top-margin" => { let value = child.value().str().unwrap_or("").trim(); match value.parse::() { diff --git a/src/mpris-backend/mod.rs b/src/mpris-backend/mod.rs new file mode 100644 index 0000000..35c3ce1 --- /dev/null +++ b/src/mpris-backend/mod.rs @@ -0,0 +1,232 @@ +use mpris::{Metadata, PlaybackStatus, Player, PlayerFinder}; + +use super::config::user::ServerConfig; +use crate::utils::get_player; +use std::{error::Error, sync::Arc, thread::sleep, time::Duration}; +use PlaybackStatus::*; +use PlayerctlAction::*; + +pub enum PlayerctlAction { + PlayPause, + Play, + Pause, + Stop, + Next, + Prev, + Shuffle, +} + +#[derive(Clone, Debug)] +pub enum PlayerctlDeviceRaw { + None, + All, + Some(String), +} + +pub enum PlayerctlDevice { + All(Vec), + Some(Player), +} + +pub struct Playerctl { + player: PlayerctlDevice, + action: PlayerctlAction, + pub icon: Option, + pub label: Option, + fmt_str: Option, +} + +impl Playerctl { + pub fn new( + action: PlayerctlAction, + config: Arc, + ) -> Result> { + let playerfinder = PlayerFinder::new()?; + let player = get_player(); + let player = match player { + PlayerctlDeviceRaw::None => PlayerctlDevice::Some(playerfinder.find_active()?), + PlayerctlDeviceRaw::Some(name) => { + PlayerctlDevice::Some(playerfinder.find_by_name(name.as_str())?) + } + PlayerctlDeviceRaw::All => PlayerctlDevice::All(playerfinder.find_all()?), + }; + let fmt_str = config.playerctl_format.clone(); + Ok(Self { + player, + action, + icon: None, + label: None, + fmt_str, + }) + } + pub fn run(&mut self) -> Result<(), Box> { + let mut metadata = Err("some errro"); + let mut icon = Err("some errro"); + match &self.player { + PlayerctlDevice::Some(player) => { + icon = Ok(self.run_single(player)?); + metadata = self.get_metadata(player).or_else(|_| Err("")); + } + PlayerctlDevice::All(players) => { + for player in players { + let icon_new = self.run_single(player); + if let Ok(icon_new) = icon_new { + if icon.is_err() { + icon = Ok(icon_new); + } + }; + if let Err(_) = metadata { + metadata = self.get_metadata(player).or_else(|_| Err("")); + } + } + } + }; + + self.icon = Some(icon.unwrap_or("").to_string()); + let label = if let Ok(metadata) = metadata { + Some(self.fmt_string(metadata)) + } else { + None + }; + self.label = label; + Ok(()) + } + fn run_single(&self, player: &Player) -> Result<&str, Box> { + let out = match self.action { + PlayPause => match player.get_playback_status()? { + Playing => { + player.pause()?; + "pause-large-symbolic" + } + Paused | Stopped => { + player.play()?; + "play-large-symbolic" + } + }, + Shuffle => { + let shuffle = player.get_shuffle()?; + player.set_shuffle(!shuffle)?; + if shuffle { + "playlist-consecutive-symbolic" + } else { + "playlist-shuffle-symbolic" + } + } + Play => { + player.play()?; + "play-large-symbolic" + } + Pause => { + player.pause()?; + "pause-large-symbolic" + } + Stop => { + player.stop()?; + "stop-large-symbolic" + } + Next => { + player.next()?; + "media-seek-forward-symbolic" + } + Prev => { + player.previous()?; + "media-seek-backward-symbolic" + } + }; + Ok(out) + } + fn get_metadata(&self, player: &Player) -> Result { + match self.action { + Next | Prev => { + if let Ok(track_list) = player.get_track_list() { + if let Some(track) = track_list.get(0) { + return player.get_track_metadata(track); + } + } + let metadata = player.get_metadata()?; + let name1 = metadata.url().unwrap(); + let mut counter = 0; + while counter < 20 { + std::thread::sleep(std::time::Duration::from_millis(5)); + counter += 1; + let metadata = player.get_metadata()?; + let name2 = metadata.url().unwrap(); + if name1 != name2 { + return Ok(metadata); + } + } + Ok(metadata) + } + _ => player.get_metadata(), + } + } + fn fmt_string(&self, metadata: mpris::Metadata) -> String { + use std::collections::HashMap; + use strfmt::Format; + + let mut vars = HashMap::new(); + let artists = metadata.artists().unwrap_or(vec![""]); + let artists_album = metadata.album_artists().unwrap_or(vec![""]); + let artist = artists.get(0).map_or("", |v| v); + let artist_album = artists_album.get(0).map_or("", |v| v); + + let title = metadata.title().unwrap_or(""); + let album = metadata.album_name().unwrap_or(""); + let track_num = metadata + .track_number() + .and_then(|x| Some(x.to_string())) + .unwrap_or(String::new()); + let disc_num = metadata + .disc_number() + .and_then(|x| Some(x.to_string())) + .unwrap_or(String::new()); + let autorating = metadata + .auto_rating() + .and_then(|x| Some(x.to_string())) + .unwrap_or(String::new()); + + vars.insert("artist".to_string(), artist); + vars.insert("albumArtist".to_string(), artist_album); + vars.insert("title".to_string(), title); + vars.insert("album".to_string(), album); + vars.insert("trackNumber".to_string(), &track_num); + vars.insert("discNumber".to_string(), &disc_num); + vars.insert("autoRating".to_string(), &autorating); + + self.fmt_str + .clone() + .unwrap_or("{artist} - {title}".into()) + .format(&vars) + .unwrap_or_else(|e| { + eprintln!("error: {}. using default string", e); + "{artist} - {title}".format(&vars).unwrap() + }) + } +} + +impl PlayerctlAction { + pub fn from(action: &str) -> Result { + use PlayerctlAction::*; + match action { + "play-pause" => Ok(PlayPause), + "play" => Ok(Play), + "pause" => Ok(Pause), + "stop" => Ok(Stop), + "next" => Ok(Next), + "prev" | "previous" => Ok(Prev), + "shuffle" => Ok(Shuffle), + x => Err(x.to_string()), + } + } +} + +impl PlayerctlDeviceRaw { + pub fn from(player: String) -> Result { + use PlayerctlDeviceRaw::*; + match player.as_str() { + "auto" | "" => Ok(None), + "all" => Ok(All), + _ => Ok(Some(player)), + } + } +} diff --git a/src/server/application.rs b/src/server/application.rs index e7c08ca..b6dbfda 100644 --- a/src/server/application.rs +++ b/src/server/application.rs @@ -31,7 +31,10 @@ pub struct SwayOSDApplication { } impl SwayOSDApplication { - pub fn new(server_config: ServerConfig, action_receiver: Receiver<(ArgTypes, String)>) -> Self { + pub fn new( + server_config: Arc, + action_receiver: Receiver<(ArgTypes, String)>, + ) -> Self { let app = Application::new(Some(APPLICATION_NAME), ApplicationFlags::FLAGS_NONE); let hold = Rc::new(app.hold()); @@ -84,6 +87,8 @@ impl SwayOSDApplication { set_show_percentage(show); } + let server_config_shared = server_config.clone(); + // Parse args app.connect_handle_local_options(clone!( #[strong] @@ -113,7 +118,12 @@ impl SwayOSDApplication { set_default_max_volume(max); } } - (arg_type, data) => Self::action_activated(&osd_app, arg_type, data), + (arg_type, data) => Self::action_activated( + &osd_app, + server_config_shared.clone(), + arg_type, + data, + ), } } @@ -121,18 +131,26 @@ impl SwayOSDApplication { } )); - // Listen to any Client actions + let server_config_shared = server_config.clone(); + MainContext::default().spawn_local(clone!( #[strong] osd_app, async move { while let Ok((arg_type, data)) = action_receiver.recv().await { - Self::action_activated(&osd_app, arg_type, (!data.is_empty()).then_some(data)); + Self::action_activated( + &osd_app, + server_config_shared.clone(), + arg_type, + (!data.is_empty()).then_some(data), + ); } Break } )); + let server_config_shared = server_config.clone(); + // Listen to the LibInput Backend and activate the Application action let (sender, receiver) = async_channel::bounded::<(u16, i32)>(1); MainContext::default().spawn_local(clone!( @@ -153,7 +171,7 @@ impl SwayOSDApplication { } _ => continue, }; - Self::action_activated(&osd_app, arg_type, data); + Self::action_activated(&osd_app, server_config_shared.clone(), arg_type, data); } Break } @@ -244,7 +262,12 @@ impl SwayOSDApplication { self.app.run().into() } - fn action_activated(osd_app: &SwayOSDApplication, arg_type: ArgTypes, value: Option) { + fn action_activated( + osd_app: &SwayOSDApplication, + server_config: Arc, + arg_type: ArgTypes, + value: Option, + ) { match (arg_type, value) { (ArgTypes::SinkVolumeRaise, step) => { let mut device_type = VolumeDeviceType::Sink(SinkController::create().unwrap()); @@ -386,6 +409,30 @@ impl SwayOSDApplication { }; set_max_volume(volume) } + (ArgTypes::Player, name) => set_player(name.unwrap_or("".to_string())), + (ArgTypes::Playerctl, value) => { + use crate::playerctl::*; + let value = &value.unwrap_or("".to_string()); + + let action = PlayerctlAction::from(value).unwrap(); + if let Ok(mut player) = Playerctl::new(action, server_config) { + match player.run() { + Ok(_) => { + let (icon, label) = (player.icon.unwrap(), player.label.unwrap()); + for window in osd_app.windows.borrow().to_owned() { + window.changed_player(&icon, &label) + } + } + Err(x) => { + eprintln!("couldn't run player change: \"{:?}\"!", x) + } + } + } else { + eprintln!("Unable to get players! are any opened?") + } + + reset_player(); + } (ArgTypes::DeviceName, name) => { set_device_name(name.unwrap_or(DEVICE_NAME_DEFAULT.to_string())) } diff --git a/src/server/main.rs b/src/server/main.rs index 83ef208..8e58f29 100644 --- a/src/server/main.rs +++ b/src/server/main.rs @@ -12,6 +12,9 @@ mod global_utils; #[path = "../brightness_backend/mod.rs"] mod brightness_backend; +#[path = "../mpris-backend/mod.rs"] +mod playerctl; + #[macro_use] extern crate shrinkwraprs; @@ -28,10 +31,7 @@ use gtk::{ glib::Bytes, CssProvider, IconTheme, }; -use std::env::args_os; -use std::future::pending; -use std::path::PathBuf; -use std::str::FromStr; +use std::{env::args_os, future::pending, path::PathBuf, str::FromStr, sync::Arc}; use utils::{get_system_css_path, user_style_path}; use zbus::{connection, interface}; @@ -128,9 +128,11 @@ fn main() { } // Parse Config - let server_config = config::user::read_user_config(config_path.as_deref()) - .expect("Failed to parse config file") - .server; + let server_config = Arc::new( + config::user::read_user_config(config_path.as_deref()) + .expect("Failed to parse config file") + .server, + ); // Load style path from config if none is given on CLI if custom_user_css.is_none() { diff --git a/src/server/osd_window.rs b/src/server/osd_window.rs index 5635890..27240a2 100644 --- a/src/server/osd_window.rs +++ b/src/server/osd_window.rs @@ -166,6 +166,18 @@ impl SwayosdWindow { self.run_timeout(); } + pub fn changed_player(&self, icon: &str, label: &str) { + self.clear_osd(); + + let icon = self.build_icon_widget(&icon); + let label = self.build_text_widget(Some(&label)); + + self.container.append(&icon); + self.container.append(&label); + + self.run_timeout(); + } + pub fn changed_keylock(&self, key: KeysLocks, state: bool) { self.clear_osd(); diff --git a/src/server/utils.rs b/src/server/utils.rs index 93cd914..8c0ed0c 100644 --- a/src/server/utils.rs +++ b/src/server/utils.rs @@ -13,6 +13,7 @@ use pulse::volume::Volume; use pulsectl::controllers::{types::DeviceInfo, DeviceControl, SinkController, SourceController}; use crate::brightness_backend; +use crate::playerctl::PlayerctlDeviceRaw; static PRIV_MAX_VOLUME_DEFAULT: u8 = 100_u8; @@ -23,6 +24,7 @@ lazy_static! { static ref DEVICE_NAME: Mutex> = Mutex::new(None); pub static ref ICON_NAME_DEFAULT: &'static str = "text-x-generic"; static ref ICON_NAME: Mutex> = Mutex::new(None); + static ref PLAYER_NAME: Mutex = Mutex::new(PlayerctlDeviceRaw::None); pub static ref TOP_MARGIN_DEFAULT: f32 = 0.85_f32; static ref TOP_MARGIN: Mutex = Mutex::new(*TOP_MARGIN_DEFAULT); pub static ref SHOW_PERCENTAGE: Mutex = Mutex::new(false); @@ -103,6 +105,21 @@ pub fn reset_icon_name() { *icon_name = None; } +pub fn set_player(name: String) { + let mut global_player = PLAYER_NAME.lock().unwrap(); + *global_player = PlayerctlDeviceRaw::from(name).unwrap_or(PlayerctlDeviceRaw::None); +} + +pub fn reset_player() { + let mut global_name = PLAYER_NAME.lock().unwrap(); + *global_name = PlayerctlDeviceRaw::None; +} + +pub fn get_player() -> PlayerctlDeviceRaw { + let player = PLAYER_NAME.lock().unwrap(); + player.clone() +} + pub fn get_key_lock_state(key: KeysLocks, led: Option) -> bool { const BASE_PATH: &str = "/sys/class/leds"; match fs::read_dir(BASE_PATH) {