mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5367a3daae | |||
| 42c0170044 | |||
| cb56cb3a04 | |||
| 5a2418325d | |||
| a948ea2dcd | |||
| a156df346b | |||
| 7a13ae55a6 |
Generated
+204
-143
@@ -250,9 +250,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-signal"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c"
|
||||
checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"
|
||||
dependencies = [
|
||||
"async-io",
|
||||
"async-lock",
|
||||
@@ -309,7 +309,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash 2.1.1",
|
||||
"rustc-hash 2.1.2",
|
||||
"shlex",
|
||||
"syn",
|
||||
]
|
||||
@@ -341,6 +341,18 @@ version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
|
||||
dependencies = [
|
||||
"funty",
|
||||
"radium",
|
||||
"tap",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.5.1"
|
||||
@@ -474,9 +486,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.58"
|
||||
version = "1.2.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1"
|
||||
checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
@@ -712,9 +724,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coreaudio-rs"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d15c3c3cee7c087938f7ad1c3098840b3ef1f1bdc7f6e496336c3b1e7a6f3914"
|
||||
checksum = "16dd574a72a021b90c7656c474ea31d11a2f0366a8eff574186e761e0b9e3586"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"libc",
|
||||
@@ -1157,6 +1169,19 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "evdev"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25b686663ba7f08d92880ff6ba22170f1df4e83629341cba34cf82cd65ebea99"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"nix 0.29.0",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "5.4.1"
|
||||
@@ -1186,9 +1211,9 @@ checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||
checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
|
||||
|
||||
[[package]]
|
||||
name = "fax"
|
||||
@@ -1258,9 +1283,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||
|
||||
[[package]]
|
||||
name = "font-types"
|
||||
version = "0.11.1"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73829a7b5c91198af28a99159b7ae4afbb252fb906159ff7f189f3a2ceaa3df2"
|
||||
checksum = "2d9237c6d82152100c691fb77ea18037b402bcc7257d2c876a4ffac81bc22a1c"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
@@ -1301,6 +1326,12 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.32"
|
||||
@@ -1517,6 +1548,12 @@ dependencies = [
|
||||
"foldhash 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
@@ -1553,12 +1590,13 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||
|
||||
[[package]]
|
||||
name = "icu_collections"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
|
||||
checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"potential_utf",
|
||||
"utf8_iter",
|
||||
"yoke",
|
||||
"zerofrom",
|
||||
"zerovec",
|
||||
@@ -1566,9 +1604,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_locale_core"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
|
||||
checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"litemap",
|
||||
@@ -1579,9 +1617,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_normalizer"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"
|
||||
checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
|
||||
dependencies = [
|
||||
"icu_collections",
|
||||
"icu_normalizer_data",
|
||||
@@ -1593,15 +1631,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_normalizer_data"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
|
||||
checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
|
||||
|
||||
[[package]]
|
||||
name = "icu_properties"
|
||||
version = "2.1.2"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"
|
||||
checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
|
||||
dependencies = [
|
||||
"icu_collections",
|
||||
"icu_locale_core",
|
||||
@@ -1613,15 +1651,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_properties_data"
|
||||
version = "2.1.2"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"
|
||||
checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
|
||||
|
||||
[[package]]
|
||||
name = "icu_provider"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
|
||||
checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"icu_locale_core",
|
||||
@@ -1708,12 +1746,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.13.0"
|
||||
version = "2.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
||||
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.16.1",
|
||||
"hashbrown 0.17.0",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
@@ -1828,10 +1866,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.91"
|
||||
version = "0.3.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c"
|
||||
checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@@ -1867,9 +1907,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.183"
|
||||
version = "0.2.184"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
|
||||
checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
|
||||
|
||||
[[package]]
|
||||
name = "libflate"
|
||||
@@ -1913,14 +1953,14 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.15"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08"
|
||||
checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"libc",
|
||||
"plain",
|
||||
"redox_syscall 0.7.3",
|
||||
"redox_syscall 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1935,7 +1975,7 @@ dependencies = [
|
||||
"cookie-factory",
|
||||
"libc",
|
||||
"libspa-sys",
|
||||
"nix",
|
||||
"nix 0.30.1",
|
||||
"nom 8.0.0",
|
||||
"system-deps",
|
||||
]
|
||||
@@ -1971,9 +2011,9 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
|
||||
checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
|
||||
|
||||
[[package]]
|
||||
name = "litrs"
|
||||
@@ -2047,9 +2087,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
|
||||
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
@@ -2121,6 +2161,18 @@ dependencies = [
|
||||
"jni-sys 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.30.1"
|
||||
@@ -2717,7 +2769,7 @@ dependencies = [
|
||||
"libc",
|
||||
"libspa",
|
||||
"libspa-sys",
|
||||
"nix",
|
||||
"nix 0.30.1",
|
||||
"once_cell",
|
||||
"pipewire-sys",
|
||||
"thiserror 2.0.18",
|
||||
@@ -2736,9 +2788,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.32"
|
||||
version = "0.3.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
@@ -2796,9 +2848,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "potential_utf"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
|
||||
checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
|
||||
dependencies = [
|
||||
"zerovec",
|
||||
]
|
||||
@@ -2861,7 +2913,7 @@ checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
|
||||
|
||||
[[package]]
|
||||
name = "pwsp"
|
||||
version = "1.6.3"
|
||||
version = "1.7.1"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"clap",
|
||||
@@ -2870,6 +2922,7 @@ dependencies = [
|
||||
"egui",
|
||||
"egui_dnd",
|
||||
"egui_material_icons",
|
||||
"evdev",
|
||||
"itertools 0.14.0",
|
||||
"opener",
|
||||
"pipewire",
|
||||
@@ -2922,6 +2975,12 @@ version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.6.2"
|
||||
@@ -2978,9 +3037,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16"
|
||||
checksum = "f450ad9c3b1da563fb6948a8e0fb0fb9269711c9c73d9ea1de5058c79c8d643a"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
]
|
||||
@@ -3082,9 +3141,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
@@ -3156,9 +3215,9 @@ checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.27"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
||||
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
@@ -3216,9 +3275,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "876ac351060d4f882bb1032b6369eb0aef79ad9df1ea8bc404874d8cc3d0cd98"
|
||||
checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
@@ -3617,9 +3676,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "7.0.7"
|
||||
version = "7.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c8f33736f986f16d69b6cb8b03f55ddcad5c41acc4ccc39dd88e84aa805e7f"
|
||||
checksum = "396a35feb67335377e0251fcbc1092fc85c484bd4e3a7a54319399da127796e7"
|
||||
dependencies = [
|
||||
"cfg-expr",
|
||||
"heck",
|
||||
@@ -3628,6 +3687,12 @@ dependencies = [
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.13.3"
|
||||
@@ -3703,9 +3768,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tinystr"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
|
||||
checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"zerovec",
|
||||
@@ -3713,9 +3778,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.50.0"
|
||||
version = "1.51.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d"
|
||||
checksum = "f66bf9585cda4b724d3e78ab34b73fb2bbaba9011b9bfdf69dc836382ea13b8c"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
@@ -3730,9 +3795,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.6.1"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c"
|
||||
checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3741,63 +3806,54 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.9.12+spec-1.1.0"
|
||||
version = "1.1.2+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"
|
||||
checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
"serde_spanned",
|
||||
"toml_datetime 0.7.5+spec-1.1.0",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow 0.7.15",
|
||||
"winnow 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.7.5+spec-1.1.0"
|
||||
version = "1.1.1+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "1.1.0+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97251a7c317e03ad83774a8752a7e81fb6067740609f75ea2b585b569a59198f"
|
||||
checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.25.8+spec-1.1.0"
|
||||
version = "0.25.11+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16bff38f1d86c47f9ff0647e6838d7bb362522bdf44006c7068c2b1e606f1f3c"
|
||||
checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"toml_datetime 1.1.0+spec-1.1.0",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"winnow 1.0.0",
|
||||
"winnow 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.1.0+spec-1.1.0"
|
||||
version = "1.1.2+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2334f11ee363607eb04df9b8fc8a13ca1715a72ba8662a26ac285c98aabb4011"
|
||||
checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
|
||||
dependencies = [
|
||||
"winnow 1.0.0",
|
||||
"winnow 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.1.0+spec-1.1.0"
|
||||
version = "1.1.1+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d282ade6016312faf3e41e57ebbba0c073e4056dab1232ab1cb624199648f8ed"
|
||||
checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
@@ -3837,7 +3893,7 @@ version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90"
|
||||
dependencies = [
|
||||
"rustc-hash 2.1.1",
|
||||
"rustc-hash 2.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3979,9 +4035,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.114"
|
||||
version = "0.2.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e"
|
||||
checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -3992,23 +4048,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.64"
|
||||
version = "0.4.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8"
|
||||
checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
"js-sys",
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.114"
|
||||
version = "0.2.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6"
|
||||
checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -4016,9 +4068,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.114"
|
||||
version = "0.2.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3"
|
||||
checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
@@ -4029,9 +4081,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.114"
|
||||
version = "0.2.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16"
|
||||
checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -4072,9 +4124,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
version = "0.3.14"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa75f400b7f719bcd68b3f47cd939ba654cedeef690f486db71331eec4c6a406"
|
||||
checksum = "2857dd20b54e916ec7253b3d6b4d5c4d7d4ca2c33c2e11c6c76a99bd8744755d"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"downcast-rs",
|
||||
@@ -4086,9 +4138,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.31.13"
|
||||
version = "0.31.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab51d9f7c071abeee76007e2b742499e535148035bb835f97aaed1338cf516c3"
|
||||
checksum = "645c7c96bb74690c3189b5c9cb4ca1627062bb23693a4fad9d8c3de958260144"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"rustix 1.1.4",
|
||||
@@ -4109,9 +4161,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-cursor"
|
||||
version = "0.31.13"
|
||||
version = "0.31.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b3298683470fbdc6ca40151dfc48c8f2fd4c41a26e13042f801f85002384091"
|
||||
checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d"
|
||||
dependencies = [
|
||||
"rustix 1.1.4",
|
||||
"wayland-client",
|
||||
@@ -4120,9 +4172,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols"
|
||||
version = "0.32.11"
|
||||
version = "0.32.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b23b5df31ceff1328f06ac607591d5ba360cf58f90c8fad4ac8d3a55a3c4aec7"
|
||||
checksum = "563a85523cade2429938e790815fd7319062103b9f4a2dc806e9b53b95982d8f"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"wayland-backend",
|
||||
@@ -4145,9 +4197,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-misc"
|
||||
version = "0.3.11"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "429b99200febaf95d4f4e46deff6fe4382bcff3280ee16a41cf887b3c3364984"
|
||||
checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"wayland-backend",
|
||||
@@ -4158,9 +4210,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-plasma"
|
||||
version = "0.3.11"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d392fc283a87774afc9beefcd6f931582bb97fe0e6ced0b306a62cb1d026527c"
|
||||
checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"wayland-backend",
|
||||
@@ -4171,9 +4223,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-wlr"
|
||||
version = "0.3.11"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78248e4cc0eff8163370ba5c158630dcae1f3497a586b826eca2ef5f348d6235"
|
||||
checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"wayland-backend",
|
||||
@@ -4184,9 +4236,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-scanner"
|
||||
version = "0.31.9"
|
||||
version = "0.31.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c86287151a309799b821ca709b7345a048a2956af05957c89cb824ab919fa4e3"
|
||||
checksum = "9c324a910fd86ebdc364a3e61ec1f11737d3b1d6c273c0239ee8ff4bc0d24b4a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quick-xml",
|
||||
@@ -4195,9 +4247,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wayland-sys"
|
||||
version = "0.31.10"
|
||||
version = "0.31.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "374f6b70e8e0d6bf9461a32988fd553b59ff630964924dad6e4a4eb6bd538d17"
|
||||
checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be"
|
||||
dependencies = [
|
||||
"dlib",
|
||||
"log",
|
||||
@@ -4207,9 +4259,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.91"
|
||||
version = "0.3.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9"
|
||||
checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -4772,9 +4824,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8"
|
||||
checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -4869,9 +4921,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "writeable"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
||||
checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
|
||||
dependencies = [
|
||||
"tap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
@@ -4938,9 +4999,9 @@ checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
|
||||
checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
|
||||
dependencies = [
|
||||
"stable_deref_trait",
|
||||
"yoke-derive",
|
||||
@@ -4949,9 +5010,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yoke-derive"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
||||
checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -5022,18 +5083,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.47"
|
||||
version = "0.8.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87"
|
||||
checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.47"
|
||||
version = "0.8.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89"
|
||||
checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -5042,18 +5103,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
|
||||
checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df"
|
||||
dependencies = [
|
||||
"zerofrom-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom-derive"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
||||
checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -5063,9 +5124,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerotrie"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
|
||||
checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"yoke",
|
||||
@@ -5074,9 +5135,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerovec"
|
||||
version = "0.11.5"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
|
||||
checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
|
||||
dependencies = [
|
||||
"yoke",
|
||||
"zerofrom",
|
||||
@@ -5085,9 +5146,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerovec-derive"
|
||||
version = "0.11.2"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
||||
checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "pwsp"
|
||||
version = "1.6.3"
|
||||
version = "1.7.1"
|
||||
edition = "2024"
|
||||
authors = ["arabian"]
|
||||
description = "PWSP lets you play audio files through your microphone. Has both CLI and GUI clients."
|
||||
@@ -12,7 +12,7 @@ keywords = ["soundpad", "pipewire", "linux", "cli", "gui"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1.50.0", features = ["full"] }
|
||||
tokio = { version = "1.51.1", features = ["full"] }
|
||||
async-trait = "0.1.89"
|
||||
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
@@ -34,6 +34,7 @@ rodio = { version = "0.22.2", default-features = false, features = [
|
||||
"playback",
|
||||
] }
|
||||
pipewire = "0.9.2"
|
||||
evdev = { version = "0.13.2", features = ["tokio"] }
|
||||
rfd = { version = "0.17.2", default-features = false, features = [
|
||||
"xdg-portal",
|
||||
] }
|
||||
|
||||
@@ -27,6 +27,8 @@ chats on platforms like **Discord, Zoom, or Teamspeak**.
|
||||
* **Collapsible Audio Tracks**: You can collapse every audio track to save space.
|
||||
* **Drag and Drop Directories**: Reorder your sound directories easily using drag and drop.
|
||||
* **Automatic Device Detection**: PWSP automatically detects when an input device is connected or disconnected and handles linking/unlinking.
|
||||
* **Global Hotkeys**: Assign custom keyboard shortcuts to any sound file (or action) to trigger playback instantly, even when the application is not in focus.
|
||||
|
||||
|
||||
# **⚙️ How It Works**
|
||||
|
||||
@@ -38,8 +40,8 @@ three main components:
|
||||
* Creating and managing virtual audio devices.
|
||||
* Linking these devices within the PipeWire graph.
|
||||
* Handling all audio playback.
|
||||
* **UnixSocket**. This is how you interact with your sound collection, control playback, and configure settings.
|
||||
* **pwsp-gui**: This is the graphical user interface. It acts as a client that communicates with pwsp-daemon via a
|
||||
**UnixSocket**. This is how you interact with your sound collection, control playback, and configure settings.
|
||||
* **pwsp-cli**: This is the command-line interface, also acting as a client. It provides a way to control the daemon
|
||||
without a GUI, allowing for scripting or quick command-based actions.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pkgbase = pwsp-bin
|
||||
pkgdesc = Lets you play audio files through your microphone (Pre-built binaries)
|
||||
pkgver = 1.6.3
|
||||
pkgver = 1.7.1
|
||||
pkgrel = 2
|
||||
url = https://github.com/arabianq/pipewire-soundpad
|
||||
arch = x86_64
|
||||
@@ -9,8 +9,8 @@ depends = pipewire
|
||||
depends = alsa-lib
|
||||
provides = pwsp
|
||||
conflicts = pwsp
|
||||
source = pwsp-bin-1.6.3.zip :: https://github.com/arabianq/pipewire-soundpad/releases/download/v1.6.3/pwsp-v1.6.3-linux-x64.zip
|
||||
source = pipewire-soundpad-1.6.3.tar.gz :: https://github.com/arabianq/pipewire-soundpad/archive/refs/tags/v1.6.3.tar.gz
|
||||
source = pwsp-bin-1.7.1.zip :: https://github.com/arabianq/pipewire-soundpad/releases/download/v1.7.1/pwsp-v1.7.1-linux-x64.zip
|
||||
source = pipewire-soundpad-1.7.1.tar.gz :: https://github.com/arabianq/pipewire-soundpad/archive/refs/tags/v1.7.1.tar.gz
|
||||
sha256sums = SKIP
|
||||
sha256sums = SKIP
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Maintainer: Alexander Tarasov <a.tevg@ya.ru>
|
||||
pkgname=pwsp-bin
|
||||
_pkgname=pipewire-soundpad
|
||||
pkgver=1.6.3
|
||||
pkgver=1.7.1
|
||||
pkgrel=2
|
||||
pkgdesc="Lets you play audio files through your microphone (Pre-built binaries)"
|
||||
arch=('x86_64')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pkgbase = pwsp
|
||||
pkgdesc = Lets you play audio files through your microphone
|
||||
pkgver = 1.6.3
|
||||
pkgver = 1.7.1
|
||||
pkgrel = 1
|
||||
url = https://github.com/arabianq/pipewire-soundpad
|
||||
arch = any
|
||||
@@ -10,7 +10,7 @@ pkgbase = pwsp
|
||||
makedepends = cargo
|
||||
makedepends = pipewire
|
||||
makedepends = alsa-lib
|
||||
source = https://github.com/arabianq/pipewire-soundpad/archive/refs/tags/v1.6.3.tar.gz
|
||||
source = https://github.com/arabianq/pipewire-soundpad/archive/refs/tags/v1.7.1.tar.gz
|
||||
sha256sums = SKIP
|
||||
|
||||
pkgname = pwsp
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Maintainer: Alexander Tarasov <a.tevg@ya.ru>
|
||||
pkgsubn=pwsp
|
||||
pkgname=pwsp
|
||||
pkgver=1.6.3
|
||||
pkgver=1.7.1
|
||||
pkgrel=1
|
||||
pkgdesc="Lets you play audio files through your microphone"
|
||||
arch=('any')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
%global cargo_install_lib 0
|
||||
|
||||
Name: pwsp
|
||||
Version: 1.6.3
|
||||
Version: 1.7.1
|
||||
Release: %autorelease
|
||||
Summary: Lets you play audio files through your microphone
|
||||
|
||||
|
||||
@@ -68,6 +68,12 @@ enum Actions {
|
||||
#[clap(short, long)]
|
||||
id: Option<u32>,
|
||||
},
|
||||
/// Play a sound by hotkey slot name
|
||||
PlayHotkey { slot: String },
|
||||
/// Remove the hotkey slot
|
||||
ClearHotkey { slot: String },
|
||||
/// Clear the key chord for a hotkey slot
|
||||
ClearHotkeyKey { slot: String },
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
@@ -101,6 +107,8 @@ enum GetCommands {
|
||||
DaemonVersion,
|
||||
/// Full player state
|
||||
FullState,
|
||||
/// All hotkey slots
|
||||
Hotkeys,
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
@@ -125,6 +133,16 @@ enum SetCommands {
|
||||
#[clap(short, long)]
|
||||
id: Option<u32>,
|
||||
},
|
||||
/// Assign a sound file to a hotkey slot
|
||||
Hotkey { slot: String, file_path: PathBuf },
|
||||
/// Set the key chord for a hotkey slot (e.g. "Ctrl+Alt+1")
|
||||
HotkeyKey { slot: String, key_chord: String },
|
||||
/// Atomically set the action and key chord for a hotkey slot
|
||||
HotkeyActionAndKey {
|
||||
slot: String,
|
||||
action: String,
|
||||
key_chord: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -146,6 +164,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
concurrent,
|
||||
} => Request::play(&file_path.to_string_lossy(), concurrent),
|
||||
Actions::ToggleLoop { id } => Request::toggle_loop(id),
|
||||
Actions::PlayHotkey { slot } => Request::play_hotkey(&slot),
|
||||
Actions::ClearHotkey { slot } => Request::clear_hotkey(&slot),
|
||||
Actions::ClearHotkeyKey { slot } => Request::clear_hotkey_key(&slot),
|
||||
},
|
||||
Commands::Get { parameter } => match parameter {
|
||||
GetCommands::IsPaused => Request::get_is_paused(),
|
||||
@@ -158,12 +179,28 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
GetCommands::Inputs => Request::get_inputs(),
|
||||
GetCommands::DaemonVersion => Request::get_daemon_version(),
|
||||
GetCommands::FullState => Request::get_full_state(),
|
||||
GetCommands::Hotkeys => Request::get_hotkeys(),
|
||||
},
|
||||
Commands::Set { parameter } => match parameter {
|
||||
SetCommands::Volume { volume, id } => Request::set_volume(volume, id),
|
||||
SetCommands::Position { position, id } => Request::seek(position, id),
|
||||
SetCommands::Input { name } => Request::set_input(&name),
|
||||
SetCommands::Loop { enabled, id } => Request::set_loop(&enabled, id),
|
||||
SetCommands::Hotkey { slot, file_path } => {
|
||||
Request::set_hotkey(&slot, &file_path.to_string_lossy())
|
||||
}
|
||||
SetCommands::HotkeyKey { slot, key_chord } => {
|
||||
Request::set_hotkey_key(&slot, &key_chord)
|
||||
}
|
||||
SetCommands::HotkeyActionAndKey {
|
||||
slot,
|
||||
action,
|
||||
key_chord,
|
||||
} => Request::set_hotkey_action_and_key(
|
||||
&slot,
|
||||
&serde_json::from_str::<Request>(&action)?,
|
||||
&key_chord,
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+24
-9
@@ -6,6 +6,7 @@ use pwsp::{
|
||||
create_runtime_dir, get_audio_player, get_daemon_config, get_runtime_dir,
|
||||
is_daemon_running, link_player_to_virtual_mic,
|
||||
},
|
||||
global_hotkeys::start_global_hotkey_listener,
|
||||
pipewire::create_virtual_mic,
|
||||
},
|
||||
};
|
||||
@@ -39,13 +40,21 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
println!("Successfully linked player to virtual mic.");
|
||||
break;
|
||||
}
|
||||
Err(e) => println!("{e}\t{i}/{max_retries}"),
|
||||
Err(e) => {
|
||||
if i == 0 || i == max_retries {
|
||||
eprintln!("{e} (attempt {i}/{max_retries})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sleep(Duration::from_millis(1000)).await;
|
||||
}
|
||||
});
|
||||
|
||||
tokio::spawn(async {
|
||||
start_global_hotkey_listener().await;
|
||||
});
|
||||
|
||||
let runtime_dir = get_runtime_dir();
|
||||
|
||||
let lock_file = fs::File::create(runtime_dir.join("daemon.lock"))?;
|
||||
@@ -169,19 +178,25 @@ async fn commands_loop(listener: UnixListener) -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
|
||||
async fn player_loop() {
|
||||
let mut device_check_counter: u32 = 0;
|
||||
loop {
|
||||
match get_audio_player().await {
|
||||
let is_idle = match get_audio_player().await {
|
||||
Ok(player_mutex) => {
|
||||
let mut audio_player = player_mutex.lock().await;
|
||||
audio_player.update().await;
|
||||
}
|
||||
Err(_err) => {
|
||||
// To avoid spamming logs every 100ms when audio player fails to init
|
||||
// we can just sleep, or you might prefer to print the error.
|
||||
// Assuming it failed to initialize, no player update is possible.
|
||||
}
|
||||
let check_devices = device_check_counter == 0;
|
||||
audio_player.update(check_devices).await;
|
||||
audio_player.tracks.is_empty()
|
||||
}
|
||||
Err(_err) => true,
|
||||
};
|
||||
|
||||
if is_idle {
|
||||
device_check_counter = 0;
|
||||
sleep(Duration::from_secs(2)).await;
|
||||
} else {
|
||||
// Check devices every ~5 seconds (50 * 100ms) while playing
|
||||
device_check_counter = (device_check_counter + 1) % 50;
|
||||
sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+361
-14
@@ -1,13 +1,17 @@
|
||||
use crate::gui::SoundpadGui;
|
||||
use egui::{
|
||||
Align, AtomExt, Button, CollapsingHeader, Color32, ComboBox, CursorIcon, FontFamily, Label,
|
||||
Layout, RichText, ScrollArea, Sense, Slider, TextEdit, Ui, Vec2,
|
||||
Align, AtomExt, Button, CollapsingHeader, Color32, ComboBox, CursorIcon, FontFamily, Grid,
|
||||
Label, Layout, RichText, ScrollArea, Sense, Slider, TextEdit, Ui, Vec2,
|
||||
};
|
||||
use egui_dnd::dnd;
|
||||
use egui_material_icons::icons::*;
|
||||
use pwsp::types::socket::Request;
|
||||
use pwsp::types::{audio_player::TrackInfo, gui::AppState};
|
||||
use pwsp::utils::gui::format_time_pair;
|
||||
use std::{error::Error, time::Instant};
|
||||
use pwsp::utils::gui::{format_time_pair, make_request_async};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
enum TrackAction {
|
||||
Pause(u32),
|
||||
@@ -16,6 +20,13 @@ enum TrackAction {
|
||||
Stop(u32),
|
||||
}
|
||||
|
||||
enum HotkeyAction {
|
||||
Remove(String),
|
||||
Capture(String),
|
||||
ClearChord(String),
|
||||
Play(String),
|
||||
}
|
||||
|
||||
impl SoundpadGui {
|
||||
fn get_volume_icon(volume: f32) -> &'static str {
|
||||
if volume > 0.7 {
|
||||
@@ -29,6 +40,13 @@ impl SoundpadGui {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw(&mut self, ui: &mut Ui) {
|
||||
self.draw_header(ui);
|
||||
self.draw_body(ui);
|
||||
ui.separator();
|
||||
self.draw_footer(ui);
|
||||
}
|
||||
|
||||
pub fn draw_waiting_for_daemon(&mut self, ui: &mut Ui) {
|
||||
ui.centered_and_justified(|ui| {
|
||||
ui.label(
|
||||
@@ -39,6 +57,32 @@ impl SoundpadGui {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn draw_hotkey_capture(&mut self, ui: &mut Ui) {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.add_space(ui.available_height() / 3.0);
|
||||
ui.label(
|
||||
RichText::new("Press a key combination (e.g. Ctrl+Alt+1)")
|
||||
.size(18.0)
|
||||
.color(Color32::YELLOW)
|
||||
.monospace(),
|
||||
);
|
||||
ui.add_space(10.0);
|
||||
let target = if let Some(slot) = &self.app_state.assigning_hotkey_slot {
|
||||
format!("for slot '{}'", slot)
|
||||
} else if let Some(path) = &self.app_state.assigning_hotkey_for_file {
|
||||
format!(
|
||||
"for '{}'",
|
||||
path.file_name().unwrap_or_default().to_string_lossy()
|
||||
)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
ui.label(RichText::new(target).size(16.0));
|
||||
ui.add_space(10.0);
|
||||
ui.label("Press Escape to cancel");
|
||||
});
|
||||
}
|
||||
|
||||
pub fn draw_settings(&mut self, ui: &mut Ui) {
|
||||
ui.vertical(|ui| {
|
||||
ui.spacing_mut().item_spacing.y = 5.0;
|
||||
@@ -88,12 +132,256 @@ impl SoundpadGui {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn draw(&mut self, ui: &mut Ui) -> Result<(), Box<dyn Error>> {
|
||||
self.draw_header(ui);
|
||||
self.draw_body(ui);
|
||||
pub fn draw_hotkeys(&mut self, ui: &mut Ui) {
|
||||
let area_size = ui.available_size();
|
||||
ui.vertical(|ui| {
|
||||
ui.set_min_width(area_size.x);
|
||||
ui.set_min_height(area_size.y);
|
||||
ui.spacing_mut().item_spacing.y = 5.0;
|
||||
|
||||
// Header
|
||||
ui.horizontal_top(|ui| {
|
||||
let back_button = Button::new(ICON_ARROW_BACK).frame(false);
|
||||
if ui.add(back_button).clicked() {
|
||||
self.app_state.show_hotkeys = false;
|
||||
}
|
||||
|
||||
ui.add_space(ui.available_width() / 2.0 - 40.0);
|
||||
ui.label(RichText::new("Hotkeys").color(Color32::WHITE).monospace());
|
||||
});
|
||||
|
||||
ui.separator();
|
||||
self.draw_footer(ui);
|
||||
Ok(())
|
||||
|
||||
// Search and Add Command
|
||||
ui.horizontal(|ui| {
|
||||
ui.menu_button(format!("{} Add Command", ICON_ADD.codepoint), |ui| {
|
||||
let mut selected_cmd = None;
|
||||
if ui.button("Toggle Pause").clicked() {
|
||||
selected_cmd = Some(("cmd_toggle_pause", Request::toggle_pause(None)));
|
||||
}
|
||||
if ui.button("Stop Playback").clicked() {
|
||||
selected_cmd = Some(("cmd_stop", Request::stop(None)));
|
||||
}
|
||||
if ui.button("Pause Playback").clicked() {
|
||||
selected_cmd = Some(("cmd_pause", Request::pause(None)));
|
||||
}
|
||||
if ui.button("Resume Playback").clicked() {
|
||||
selected_cmd = Some(("cmd_resume", Request::resume(None)));
|
||||
}
|
||||
if ui.button("Toggle Loop").clicked() {
|
||||
selected_cmd = Some(("cmd_toggle_loop", Request::toggle_loop(None)));
|
||||
}
|
||||
|
||||
if let Some((slot_name, req)) = selected_cmd {
|
||||
make_request_async(Request::set_hotkey_action(slot_name, &req));
|
||||
self.app_state
|
||||
.hotkey_config
|
||||
.set_slot(slot_name.to_string(), req);
|
||||
self.app_state.assigning_hotkey_slot = Some(slot_name.to_string());
|
||||
self.app_state.hotkey_capture_active = true;
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
|
||||
ui.add_space(10.0);
|
||||
|
||||
ui.add_sized(
|
||||
[ui.available_width(), 22.0],
|
||||
TextEdit::singleline(&mut self.app_state.hotkey_search_query)
|
||||
.hint_text("Search hotkeys..."),
|
||||
);
|
||||
});
|
||||
|
||||
ui.separator();
|
||||
ui.add_space(5.0);
|
||||
|
||||
let conflicts = self.app_state.hotkey_config.find_conflicts();
|
||||
let conflict_slots: std::collections::HashSet<String> = conflicts
|
||||
.iter()
|
||||
.flat_map(|(a, b)| vec![a.clone(), b.clone()])
|
||||
.collect();
|
||||
|
||||
let search = self.app_state.hotkey_search_query.to_lowercase();
|
||||
|
||||
// Slots table
|
||||
let mut action: Option<HotkeyAction> = None;
|
||||
let area_size = ui.available_size();
|
||||
|
||||
ScrollArea::vertical().show(ui, |ui| {
|
||||
ui.set_min_width(area_size.x);
|
||||
Grid::new("hotkeys_grid")
|
||||
.striped(true)
|
||||
.num_columns(4)
|
||||
.max_col_width(area_size.x)
|
||||
.min_col_width(area_size.x / 4.0)
|
||||
.spacing([40.0, 10.0])
|
||||
.show(ui, |ui| {
|
||||
// Table header
|
||||
ui.label(
|
||||
RichText::new("Slot")
|
||||
.strong()
|
||||
.monospace()
|
||||
.color(Color32::LIGHT_GRAY),
|
||||
);
|
||||
ui.label(
|
||||
RichText::new("Sound")
|
||||
.strong()
|
||||
.monospace()
|
||||
.color(Color32::LIGHT_GRAY),
|
||||
);
|
||||
ui.label(
|
||||
RichText::new("Key Chord")
|
||||
.strong()
|
||||
.monospace()
|
||||
.color(Color32::LIGHT_GRAY),
|
||||
);
|
||||
ui.label(
|
||||
RichText::new("Actions")
|
||||
.strong()
|
||||
.monospace()
|
||||
.color(Color32::LIGHT_GRAY),
|
||||
);
|
||||
ui.end_row();
|
||||
|
||||
let slots: Vec<_> = self
|
||||
.app_state
|
||||
.hotkey_config
|
||||
.slots
|
||||
.iter()
|
||||
.filter(|s| {
|
||||
if search.is_empty() {
|
||||
return true;
|
||||
}
|
||||
s.slot.to_lowercase().contains(&search)
|
||||
|| format!("{:?}", s.action).to_lowercase().contains(&search)
|
||||
|| s.key_chord
|
||||
.as_deref()
|
||||
.unwrap_or("")
|
||||
.to_lowercase()
|
||||
.contains(&search)
|
||||
})
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
for slot in &slots {
|
||||
ui.horizontal(|ui| {
|
||||
// Conflict badge
|
||||
if conflict_slots.contains(&slot.slot) {
|
||||
ui.label(
|
||||
RichText::new(ICON_WARNING.codepoint)
|
||||
.color(Color32::from_rgb(255, 165, 0)),
|
||||
)
|
||||
.on_hover_text("Key chord conflict");
|
||||
}
|
||||
|
||||
// Slot name
|
||||
let slot_text = RichText::new(&slot.slot).monospace();
|
||||
ui.label(slot_text);
|
||||
});
|
||||
|
||||
// Action description
|
||||
let action_name = match slot.action.name.as_str() {
|
||||
"play" => {
|
||||
if let Some(file_path_str) = slot.action.args.get("file_path") {
|
||||
Path::new(file_path_str)
|
||||
.file_name()
|
||||
.unwrap_or_default()
|
||||
.to_string_lossy()
|
||||
.to_string()
|
||||
} else {
|
||||
"Play".to_string()
|
||||
}
|
||||
}
|
||||
"toggle_pause" => "Toggle Pause".to_string(),
|
||||
"pause" => "Pause Playback".to_string(),
|
||||
"resume" => "Resume Playback".to_string(),
|
||||
"stop" => "Stop Playback".to_string(),
|
||||
"toggle_loop" => "Toggle Loop".to_string(),
|
||||
other => other.to_string(),
|
||||
};
|
||||
ui.add(Label::new(RichText::new(action_name).monospace()).truncate());
|
||||
|
||||
// Key chord
|
||||
let chord_text = slot.key_chord.as_deref().unwrap_or("(none)");
|
||||
ui.label(RichText::new(chord_text).monospace().color(
|
||||
if slot.key_chord.is_some() {
|
||||
Color32::from_rgb(100, 200, 100)
|
||||
} else {
|
||||
Color32::GRAY
|
||||
},
|
||||
));
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
// Delete button
|
||||
if ui
|
||||
.add(Button::new(ICON_DELETE).frame(false))
|
||||
.on_hover_text("Remove slot")
|
||||
.clicked()
|
||||
{
|
||||
action = Some(HotkeyAction::Remove(slot.slot.clone()));
|
||||
}
|
||||
|
||||
// Set key chord button
|
||||
if ui
|
||||
.add(Button::new(ICON_KEYBOARD).frame(false))
|
||||
.on_hover_text("Set key chord")
|
||||
.clicked()
|
||||
{
|
||||
action = Some(HotkeyAction::Capture(slot.slot.clone()));
|
||||
}
|
||||
|
||||
// Clear key chord
|
||||
if slot.key_chord.is_some()
|
||||
&& ui
|
||||
.add(Button::new(ICON_BACKSPACE).frame(false))
|
||||
.on_hover_text("Clear key chord")
|
||||
.clicked()
|
||||
{
|
||||
action = Some(HotkeyAction::ClearChord(slot.slot.clone()));
|
||||
}
|
||||
|
||||
// Play button
|
||||
if ui
|
||||
.add(Button::new(ICON_PLAY_ARROW).frame(false))
|
||||
.on_hover_text("Play")
|
||||
.clicked()
|
||||
{
|
||||
action = Some(HotkeyAction::Play(slot.slot.clone()));
|
||||
}
|
||||
});
|
||||
ui.end_row();
|
||||
}
|
||||
|
||||
if slots.is_empty() {
|
||||
ui.label("No hotkey slots configured.");
|
||||
ui.label("");
|
||||
ui.label("");
|
||||
ui.label("");
|
||||
ui.end_row();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if let Some(action) = action {
|
||||
match action {
|
||||
HotkeyAction::Remove(slot) => {
|
||||
make_request_async(Request::clear_hotkey(&slot));
|
||||
self.app_state.hotkey_config.remove_slot(&slot);
|
||||
}
|
||||
HotkeyAction::Capture(slot) => {
|
||||
self.app_state.assigning_hotkey_slot = Some(slot);
|
||||
self.app_state.hotkey_capture_active = true;
|
||||
}
|
||||
HotkeyAction::ClearChord(slot) => {
|
||||
make_request_async(Request::clear_hotkey_key(&slot));
|
||||
self.app_state.hotkey_config.set_key_chord(&slot, None);
|
||||
}
|
||||
HotkeyAction::Play(slot) => {
|
||||
self.play_hotkey_slot(&slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn draw_header(&mut self, ui: &mut Ui) {
|
||||
@@ -423,11 +711,23 @@ impl SoundpadGui {
|
||||
for entry_path in files {
|
||||
let file_name = entry_path
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.unwrap_or_default()
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
let mut file_button_text = RichText::new(file_name);
|
||||
ui.horizontal(|ui| {
|
||||
// Hotkey badge
|
||||
let hotkey_badge = self.get_hotkey_badge(&entry_path);
|
||||
if let Some(badge) = &hotkey_badge {
|
||||
ui.label(
|
||||
RichText::new(badge)
|
||||
.small()
|
||||
.monospace()
|
||||
.color(Color32::from_rgb(100, 200, 100)),
|
||||
);
|
||||
}
|
||||
|
||||
let mut file_button_text = RichText::new(&file_name);
|
||||
if let Some(current_file) = &self.app_state.selected_file {
|
||||
if current_file.eq(&entry_path) {
|
||||
file_button_text = file_button_text.color(Color32::WHITE);
|
||||
@@ -441,7 +741,8 @@ impl SoundpadGui {
|
||||
if i.modifiers.ctrl {
|
||||
self.play_file(&entry_path, true);
|
||||
} else if i.modifiers.shift
|
||||
&& let Some(last_track) = self.audio_player_state.tracks.last()
|
||||
&& let Some(last_track) =
|
||||
self.audio_player_state.tracks.last()
|
||||
{
|
||||
self.stop(Some(last_track.id));
|
||||
self.play_file(&entry_path, true);
|
||||
@@ -471,7 +772,10 @@ impl SoundpadGui {
|
||||
}
|
||||
|
||||
if ui
|
||||
.button(format!("{} {}", ICON_SWAP_HORIZ.codepoint, "Replace Last"))
|
||||
.button(format!(
|
||||
"{} {}",
|
||||
ICON_SWAP_HORIZ.codepoint, "Replace Last"
|
||||
))
|
||||
.clicked()
|
||||
&& let Some(last_track) = self.audio_player_state.tracks.last()
|
||||
{
|
||||
@@ -493,6 +797,22 @@ impl SoundpadGui {
|
||||
eprintln!("Failed to open file manager: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
ui.separator();
|
||||
|
||||
if ui
|
||||
.button(format!(
|
||||
"{} {}",
|
||||
ICON_KEYBOARD.codepoint, "Assign Hotkey"
|
||||
))
|
||||
.clicked()
|
||||
{
|
||||
self.app_state.assigning_hotkey_for_file =
|
||||
Some(entry_path.clone());
|
||||
self.app_state.hotkey_capture_active = true;
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -500,6 +820,23 @@ impl SoundpadGui {
|
||||
});
|
||||
}
|
||||
|
||||
fn get_hotkey_badge(&self, path: &PathBuf) -> Option<String> {
|
||||
for slot in &self.app_state.hotkey_config.slots {
|
||||
if slot.action.name == "play" {
|
||||
if let Some(file_path_str) = slot.action.args.get("file_path") {
|
||||
if Path::new(file_path_str) == path.as_path() {
|
||||
if let Some(chord) = &slot.key_chord {
|
||||
return Some(format!("[{}]", chord));
|
||||
} else {
|
||||
return Some(format!("[{}]", slot.slot));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn draw_footer(&mut self, ui: &mut Ui) {
|
||||
ui.add_space(5.0);
|
||||
ui.horizontal(|ui| {
|
||||
@@ -556,7 +893,17 @@ impl SoundpadGui {
|
||||
}
|
||||
// ------------------------------------------
|
||||
|
||||
ui.add_space(ui.available_width() - 18.0 - ui.spacing().item_spacing.x);
|
||||
ui.add_space(ui.available_width() - 18.0 * 2.0 - ui.spacing().item_spacing.x * 2.0);
|
||||
|
||||
// ---------- Hotkeys button ----------
|
||||
let hotkeys_button =
|
||||
Button::new(ICON_KEYBOARD.atom_size(Vec2::new(18.0, 18.0))).frame(false);
|
||||
let hotkeys_button_response = ui.add_sized([18.0, 18.0], hotkeys_button);
|
||||
if hotkeys_button_response.clicked() {
|
||||
self.app_state.show_hotkeys = true;
|
||||
}
|
||||
hotkeys_button_response.on_hover_text("Hotkeys (H)");
|
||||
// --------------------------------
|
||||
|
||||
// ---------- Settings button ----------
|
||||
let settings_button =
|
||||
|
||||
+236
-1
@@ -1,8 +1,160 @@
|
||||
use crate::gui::SoundpadGui;
|
||||
use egui::{Context, Id, Key, Modifiers};
|
||||
use pwsp::types::socket::Request;
|
||||
use pwsp::utils::gui::make_request_async;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Convert an egui Key + Modifiers to a normalized chord string like "Ctrl+Shift+A".
|
||||
fn chord_from_event(modifiers: &Modifiers, key: &Key) -> Option<String> {
|
||||
let key_name = match key {
|
||||
Key::A => "A",
|
||||
Key::B => "B",
|
||||
Key::C => "C",
|
||||
Key::D => "D",
|
||||
Key::E => "E",
|
||||
Key::F => "F",
|
||||
Key::G => "G",
|
||||
Key::H => "H",
|
||||
Key::I => "I",
|
||||
Key::J => "J",
|
||||
Key::K => "K",
|
||||
Key::L => "L",
|
||||
Key::M => "M",
|
||||
Key::N => "N",
|
||||
Key::O => "O",
|
||||
Key::P => "P",
|
||||
Key::Q => "Q",
|
||||
Key::R => "R",
|
||||
Key::S => "S",
|
||||
Key::T => "T",
|
||||
Key::U => "U",
|
||||
Key::V => "V",
|
||||
Key::W => "W",
|
||||
Key::X => "X",
|
||||
Key::Y => "Y",
|
||||
Key::Z => "Z",
|
||||
Key::Num0 => "0",
|
||||
Key::Num1 => "1",
|
||||
Key::Num2 => "2",
|
||||
Key::Num3 => "3",
|
||||
Key::Num4 => "4",
|
||||
Key::Num5 => "5",
|
||||
Key::Num6 => "6",
|
||||
Key::Num7 => "7",
|
||||
Key::Num8 => "8",
|
||||
Key::Num9 => "9",
|
||||
Key::F1 => "F1",
|
||||
Key::F2 => "F2",
|
||||
Key::F3 => "F3",
|
||||
Key::F4 => "F4",
|
||||
Key::F5 => "F5",
|
||||
Key::F6 => "F6",
|
||||
Key::F7 => "F7",
|
||||
Key::F8 => "F8",
|
||||
Key::F9 => "F9",
|
||||
Key::F10 => "F10",
|
||||
Key::F11 => "F11",
|
||||
Key::F12 => "F12",
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
// Require at least one modifier for hotkey chords (ignoring command/Super due to Wayland/Niri bug)
|
||||
if !modifiers.ctrl && !modifiers.alt && !modifiers.shift {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut parts = vec![];
|
||||
if modifiers.ctrl {
|
||||
parts.push("Ctrl");
|
||||
}
|
||||
if modifiers.alt {
|
||||
parts.push("Alt");
|
||||
}
|
||||
if modifiers.shift {
|
||||
parts.push("Shift");
|
||||
}
|
||||
// We intentionally ignore modifiers.command (Super) here to bypass a Wayland/Niri bug
|
||||
// where the Super key modifier is constantly active.
|
||||
|
||||
parts.push(key_name);
|
||||
|
||||
Some(parts.join("+"))
|
||||
}
|
||||
|
||||
/// Parse a chord string back to (Modifiers, Key) for matching.
|
||||
pub fn parse_chord(chord: &str) -> Option<(Modifiers, Key)> {
|
||||
let parts: Vec<&str> = chord.split('+').collect();
|
||||
if parts.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut modifiers = Modifiers::NONE;
|
||||
for &part in &parts[..parts.len() - 1] {
|
||||
match part {
|
||||
"Ctrl" => modifiers.ctrl = true,
|
||||
"Alt" => modifiers.alt = true,
|
||||
"Shift" => modifiers.shift = true,
|
||||
"Super" => modifiers.command = true,
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
|
||||
let key = match parts[parts.len() - 1] {
|
||||
"A" => Key::A,
|
||||
"B" => Key::B,
|
||||
"C" => Key::C,
|
||||
"D" => Key::D,
|
||||
"E" => Key::E,
|
||||
"F" => Key::F,
|
||||
"G" => Key::G,
|
||||
"H" => Key::H,
|
||||
"I" => Key::I,
|
||||
"J" => Key::J,
|
||||
"K" => Key::K,
|
||||
"L" => Key::L,
|
||||
"M" => Key::M,
|
||||
"N" => Key::N,
|
||||
"O" => Key::O,
|
||||
"P" => Key::P,
|
||||
"Q" => Key::Q,
|
||||
"R" => Key::R,
|
||||
"S" => Key::S,
|
||||
"T" => Key::T,
|
||||
"U" => Key::U,
|
||||
"V" => Key::V,
|
||||
"W" => Key::W,
|
||||
"X" => Key::X,
|
||||
"Y" => Key::Y,
|
||||
"Z" => Key::Z,
|
||||
"0" => Key::Num0,
|
||||
"1" => Key::Num1,
|
||||
"2" => Key::Num2,
|
||||
"3" => Key::Num3,
|
||||
"4" => Key::Num4,
|
||||
"5" => Key::Num5,
|
||||
"6" => Key::Num6,
|
||||
"7" => Key::Num7,
|
||||
"8" => Key::Num8,
|
||||
"9" => Key::Num9,
|
||||
"F1" => Key::F1,
|
||||
"F2" => Key::F2,
|
||||
"F3" => Key::F3,
|
||||
"F4" => Key::F4,
|
||||
"F5" => Key::F5,
|
||||
"F6" => Key::F6,
|
||||
"F7" => Key::F7,
|
||||
"F8" => Key::F8,
|
||||
"F9" => Key::F9,
|
||||
"F10" => Key::F10,
|
||||
"F11" => Key::F11,
|
||||
"F12" => Key::F12,
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
Some((modifiers, key))
|
||||
}
|
||||
|
||||
impl SoundpadGui {
|
||||
fn key_pressed(&self, ctx: &Context, key: Key) -> bool {
|
||||
ctx.input(|i| i.key_pressed(key))
|
||||
@@ -29,12 +181,76 @@ impl SoundpadGui {
|
||||
}
|
||||
};
|
||||
|
||||
// Handle hotkey capture mode: listen for a key chord to assign
|
||||
if self.app_state.hotkey_capture_active {
|
||||
if self.key_pressed(ctx, Key::Escape) {
|
||||
self.app_state.hotkey_capture_active = false;
|
||||
self.app_state.assigning_hotkey_slot = None;
|
||||
self.app_state.assigning_hotkey_for_file = None;
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to capture a chord from any key press
|
||||
let captured = ctx.input(|i| {
|
||||
for event in &i.events {
|
||||
if let egui::Event::Key {
|
||||
key,
|
||||
pressed: true,
|
||||
modifiers: mods,
|
||||
..
|
||||
} = event
|
||||
&& let Some(chord) = chord_from_event(mods, key)
|
||||
{
|
||||
return Some(chord);
|
||||
}
|
||||
}
|
||||
None
|
||||
});
|
||||
|
||||
if let Some(chord) = captured {
|
||||
if let Some(slot) = self.app_state.assigning_hotkey_slot.take() {
|
||||
make_request_async(Request::set_hotkey_key(&slot, &chord));
|
||||
self.app_state
|
||||
.hotkey_config
|
||||
.set_key_chord(&slot, Some(chord));
|
||||
} else if let Some(file_path) = self.app_state.assigning_hotkey_for_file.take() {
|
||||
// Auto-create a slot from the file name
|
||||
let slot_name = file_path
|
||||
.file_stem()
|
||||
.unwrap_or_default()
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
let action = Request::play(&file_path.to_string_lossy(), false);
|
||||
|
||||
make_request_async(Request::set_hotkey_action_and_key(
|
||||
&slot_name, &action, &chord,
|
||||
));
|
||||
|
||||
self.app_state
|
||||
.hotkey_config
|
||||
.set_slot(slot_name.clone(), action);
|
||||
self.app_state
|
||||
.hotkey_config
|
||||
.set_key_chord(&slot_name, Some(chord.clone()));
|
||||
}
|
||||
self.app_state.hotkey_capture_active = false;
|
||||
self.app_state.assigning_hotkey_slot = None;
|
||||
self.app_state.assigning_hotkey_for_file = None;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Open/close settings
|
||||
if !search_focused && self.key_pressed(ctx, Key::I) {
|
||||
self.app_state.show_settings = !self.app_state.show_settings;
|
||||
}
|
||||
|
||||
if !self.app_state.show_settings {
|
||||
// Toggle hotkeys view
|
||||
if !search_focused && self.key_pressed(ctx, Key::H) {
|
||||
self.app_state.show_hotkeys = !self.app_state.show_hotkeys;
|
||||
}
|
||||
|
||||
if !self.app_state.show_settings && !self.app_state.show_hotkeys {
|
||||
// Pause / resume audio on space
|
||||
if !search_focused && self.key_pressed(ctx, Key::Space) {
|
||||
self.play_toggle();
|
||||
@@ -123,6 +339,25 @@ impl SoundpadGui {
|
||||
self.app_state.selected_file = Some(files[new_files_index].clone());
|
||||
}
|
||||
}
|
||||
|
||||
// Check for hotkey chord triggers
|
||||
let slots_to_play: Vec<String> = ctx.input(|i| {
|
||||
let mut result = vec![];
|
||||
for slot in &self.app_state.hotkey_config.slots {
|
||||
if let Some(chord) = &slot.key_chord
|
||||
&& let Some((mods, key)) = parse_chord(chord)
|
||||
&& i.modifiers == mods
|
||||
&& i.key_pressed(key)
|
||||
{
|
||||
result.push(slot.slot.clone());
|
||||
}
|
||||
}
|
||||
result
|
||||
});
|
||||
|
||||
for slot in slots_to_play {
|
||||
self.play_hotkey_slot(&slot);
|
||||
}
|
||||
}
|
||||
// });
|
||||
}
|
||||
|
||||
+8
-2
@@ -9,6 +9,7 @@ use pwsp::{
|
||||
types::{
|
||||
audio_player::PlayerState,
|
||||
config::GuiConfig,
|
||||
config::HotkeyConfig,
|
||||
gui::{AppState, AudioPlayerState},
|
||||
socket::Request,
|
||||
},
|
||||
@@ -24,8 +25,8 @@ use std::{
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
const SUPPORTED_EXTENSIONS: [&str; 11] = [
|
||||
"mp3", "wav", "ogg", "flac", "mp4", "m4a", "aac", "mov", "mkv", "webm", "avi",
|
||||
const SUPPORTED_EXTENSIONS: [&str; 12] = [
|
||||
"mp3", "wav", "ogg", "flac", "mp4", "m4a", "aac", "mov", "mkv", "mka", "webm", "avi",
|
||||
];
|
||||
|
||||
struct SoundpadGui {
|
||||
@@ -52,6 +53,7 @@ impl SoundpadGui {
|
||||
};
|
||||
|
||||
soundpad_gui.app_state.dirs = config.dirs;
|
||||
soundpad_gui.app_state.hotkey_config = HotkeyConfig::load().unwrap_or_default();
|
||||
|
||||
soundpad_gui
|
||||
}
|
||||
@@ -148,6 +150,10 @@ impl SoundpadGui {
|
||||
make_request_async(Request::stop(id));
|
||||
}
|
||||
|
||||
pub fn play_hotkey_slot(&mut self, slot: &str) {
|
||||
make_request_async(Request::play_hotkey(slot));
|
||||
}
|
||||
|
||||
pub fn get_filtered_files(&self) -> Vec<PathBuf> {
|
||||
let mut files: Vec<PathBuf> = self.app_state.files.iter().cloned().collect();
|
||||
files.sort();
|
||||
|
||||
+15
-2
@@ -77,10 +77,13 @@ impl App for SoundpadGui {
|
||||
|
||||
// Sync audio player state
|
||||
{
|
||||
let guard = self
|
||||
let mut guard = self
|
||||
.audio_player_state_shared
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
if let Some(config) = guard.hotkey_config.take() {
|
||||
self.app_state.hotkey_config = config;
|
||||
}
|
||||
self.audio_player_state = guard.clone();
|
||||
}
|
||||
|
||||
@@ -107,12 +110,22 @@ impl App for SoundpadGui {
|
||||
return;
|
||||
}
|
||||
|
||||
if self.app_state.hotkey_capture_active {
|
||||
self.draw_hotkey_capture(ui);
|
||||
return;
|
||||
}
|
||||
|
||||
if self.app_state.show_settings {
|
||||
self.draw_settings(ui);
|
||||
return;
|
||||
}
|
||||
|
||||
self.draw(ui).ok();
|
||||
if self.app_state.show_hotkeys {
|
||||
self.draw_hotkeys(ui);
|
||||
return;
|
||||
}
|
||||
|
||||
self.draw(ui);
|
||||
});
|
||||
|
||||
// Request repaint
|
||||
|
||||
@@ -53,7 +53,7 @@ pub struct PlayingSound {
|
||||
}
|
||||
|
||||
pub struct AudioPlayer {
|
||||
pub stream_handle: MixerDeviceSink,
|
||||
stream_handle: Option<MixerDeviceSink>,
|
||||
pub tracks: HashMap<u32, PlayingSound>,
|
||||
pub next_id: u32,
|
||||
|
||||
@@ -68,10 +68,8 @@ impl AudioPlayer {
|
||||
let daemon_config = get_daemon_config();
|
||||
let default_volume = daemon_config.default_volume.unwrap_or(1.0);
|
||||
|
||||
let stream_handle = DeviceSinkBuilder::open_default_sink()?;
|
||||
|
||||
let mut audio_player = AudioPlayer {
|
||||
stream_handle,
|
||||
stream_handle: None,
|
||||
tracks: HashMap::new(),
|
||||
next_id: 1,
|
||||
|
||||
@@ -88,6 +86,21 @@ impl AudioPlayer {
|
||||
Ok(audio_player)
|
||||
}
|
||||
|
||||
fn ensure_stream(&mut self) -> Result<&MixerDeviceSink, Box<dyn Error>> {
|
||||
if self.stream_handle.is_none() {
|
||||
let mut sink = DeviceSinkBuilder::open_default_sink()?;
|
||||
sink.log_on_drop(false);
|
||||
self.stream_handle = Some(sink);
|
||||
}
|
||||
Ok(self.stream_handle.as_ref().unwrap())
|
||||
}
|
||||
|
||||
fn drop_stream(&mut self) {
|
||||
if self.stream_handle.is_some() {
|
||||
self.stream_handle = None;
|
||||
}
|
||||
}
|
||||
|
||||
fn abort_link_thread(&mut self) {
|
||||
if let Some(sender) = &self.input_link_sender {
|
||||
match sender.send(Terminate {}) {
|
||||
@@ -179,6 +192,9 @@ impl AudioPlayer {
|
||||
} else {
|
||||
self.tracks.clear();
|
||||
}
|
||||
if self.tracks.is_empty() {
|
||||
self.drop_stream();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_paused(&self) -> bool {
|
||||
@@ -299,12 +315,15 @@ impl AudioPlayer {
|
||||
self.tracks.clear();
|
||||
}
|
||||
|
||||
self.ensure_stream()?;
|
||||
|
||||
let id = self.next_id;
|
||||
self.next_id += 1;
|
||||
|
||||
let duration = source.total_duration().map(|d| d.as_secs_f32());
|
||||
|
||||
let sink = Player::connect_new(self.stream_handle.mixer());
|
||||
let mixer = self.stream_handle.as_ref().unwrap().mixer();
|
||||
let sink = Player::connect_new(mixer);
|
||||
sink.set_volume(self.volume); // Default volume is 1.0 * master
|
||||
sink.append(source);
|
||||
sink.play();
|
||||
@@ -358,11 +377,12 @@ impl AudioPlayer {
|
||||
tracks
|
||||
}
|
||||
|
||||
pub async fn update(&mut self) {
|
||||
pub async fn update(&mut self, check_devices: bool) {
|
||||
if check_devices {
|
||||
if let Some(input_device_name) = &self.input_device_name {
|
||||
// Unlink devices if selected input device was removed
|
||||
if self.input_link_sender.is_some() && get_device(input_device_name).await.is_err() {
|
||||
// Selected input device was removed
|
||||
if self.input_link_sender.is_some() && get_device(input_device_name).await.is_err()
|
||||
{
|
||||
eprintln!(
|
||||
"Selected input device {} was removed, unlinking devices",
|
||||
input_device_name
|
||||
@@ -374,6 +394,7 @@ impl AudioPlayer {
|
||||
self.link_devices().await.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle looped sounds
|
||||
let mut restarts = vec![];
|
||||
@@ -412,6 +433,10 @@ impl AudioPlayer {
|
||||
|
||||
self.tracks
|
||||
.retain(|_, sound| !sound.sink.empty() || sound.looped);
|
||||
|
||||
if self.tracks.is_empty() {
|
||||
self.drop_stream();
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn set_current_input_device(&mut self, name: &str) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
+243
-1
@@ -1,9 +1,11 @@
|
||||
use crate::{
|
||||
types::{
|
||||
audio_player::{FullState, PlayerState},
|
||||
socket::Response,
|
||||
config::HotkeyConfig,
|
||||
socket::{Request, Response},
|
||||
},
|
||||
utils::{
|
||||
commands::parse_command,
|
||||
daemon::get_audio_player,
|
||||
pipewire::{get_all_devices, get_device},
|
||||
},
|
||||
@@ -90,6 +92,41 @@ pub struct GetDaemonVersionCommand {}
|
||||
|
||||
pub struct GetFullStateCommand {}
|
||||
|
||||
pub struct GetHotkeysCommand {}
|
||||
|
||||
pub struct SetHotkeyCommand {
|
||||
pub slot: Option<String>,
|
||||
pub file_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub struct SetHotkeyActionCommand {
|
||||
pub slot: Option<String>,
|
||||
pub action: Option<Request>,
|
||||
}
|
||||
|
||||
pub struct SetHotkeyKeyCommand {
|
||||
pub slot: Option<String>,
|
||||
pub key_chord: Option<String>,
|
||||
}
|
||||
|
||||
pub struct SetHotkeyActionAndKeyCommand {
|
||||
pub slot: Option<String>,
|
||||
pub action: Option<Request>,
|
||||
pub key_chord: Option<String>,
|
||||
}
|
||||
|
||||
pub struct PlayHotkeyCommand {
|
||||
pub slot: Option<String>,
|
||||
}
|
||||
|
||||
pub struct ClearHotkeyCommand {
|
||||
pub slot: Option<String>,
|
||||
}
|
||||
|
||||
pub struct ClearHotkeyKeyCommand {
|
||||
pub slot: Option<String>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for PingCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
@@ -481,3 +518,208 @@ impl Executable for GetFullStateCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for GetHotkeysCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
match HotkeyConfig::load() {
|
||||
Ok(config) => match serde_json::to_string(&config) {
|
||||
Ok(json) => Response::new(true, json),
|
||||
Err(err) => Response::new(false, format!("Failed to serialize hotkeys: {}", err)),
|
||||
},
|
||||
Err(err) => Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for SetHotkeyCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
let Some(slot) = &self.slot else {
|
||||
return Response::new(false, "Missing slot name");
|
||||
};
|
||||
let Some(file_path) = &self.file_path else {
|
||||
return Response::new(false, "Missing file path");
|
||||
};
|
||||
|
||||
let mut config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(err) => return Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
};
|
||||
|
||||
config.set_slot(
|
||||
slot.clone(),
|
||||
Request::play(&file_path.to_string_lossy(), false),
|
||||
);
|
||||
|
||||
match config.save() {
|
||||
Ok(_) => Response::new(true, format!("Hotkey slot '{}' set", slot)),
|
||||
Err(err) => Response::new(false, format!("Failed to save hotkeys: {}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for SetHotkeyActionCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
let Some(slot) = &self.slot else {
|
||||
return Response::new(false, "Missing slot name");
|
||||
};
|
||||
let Some(action) = &self.action else {
|
||||
return Response::new(false, "Missing or invalid action");
|
||||
};
|
||||
|
||||
let mut config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(err) => return Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
};
|
||||
|
||||
config.set_slot(slot.clone(), action.clone());
|
||||
|
||||
match config.save() {
|
||||
Ok(_) => Response::new(true, format!("Hotkey slot '{}' set", slot)),
|
||||
Err(err) => Response::new(false, format!("Failed to save hotkeys: {}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for SetHotkeyKeyCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
let Some(slot) = &self.slot else {
|
||||
return Response::new(false, "Missing slot name");
|
||||
};
|
||||
let Some(key_chord) = &self.key_chord else {
|
||||
return Response::new(false, "Missing key chord");
|
||||
};
|
||||
|
||||
let mut config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(err) => return Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
};
|
||||
|
||||
if !config.set_key_chord(slot, Some(key_chord.clone())) {
|
||||
return Response::new(false, format!("Slot '{}' not found", slot));
|
||||
}
|
||||
|
||||
match config.save() {
|
||||
Ok(_) => Response::new(
|
||||
true,
|
||||
format!("Key chord for slot '{}' set to '{}'", slot, key_chord),
|
||||
),
|
||||
Err(err) => Response::new(false, format!("Failed to save hotkeys: {}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for SetHotkeyActionAndKeyCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
let Some(slot) = &self.slot else {
|
||||
return Response::new(false, "Missing slot name");
|
||||
};
|
||||
let Some(action) = &self.action else {
|
||||
return Response::new(false, "Missing or invalid action");
|
||||
};
|
||||
let Some(key_chord) = &self.key_chord else {
|
||||
return Response::new(false, "Missing key chord");
|
||||
};
|
||||
|
||||
let mut config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(err) => return Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
};
|
||||
|
||||
// Set the action and then the key chord
|
||||
config.set_slot(slot.clone(), action.clone());
|
||||
if !config.set_key_chord(slot, Some(key_chord.clone())) {
|
||||
return Response::new(
|
||||
false,
|
||||
format!("Slot '{}' not found after setting action", slot),
|
||||
);
|
||||
}
|
||||
|
||||
match config.save() {
|
||||
Ok(_) => Response::new(
|
||||
true,
|
||||
format!(
|
||||
"Hotkey slot '{}' set with action and key chord '{}'",
|
||||
slot, key_chord
|
||||
),
|
||||
),
|
||||
Err(err) => Response::new(false, format!("Failed to save hotkeys: {}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for PlayHotkeyCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
let Some(slot) = &self.slot else {
|
||||
return Response::new(false, "Missing slot name");
|
||||
};
|
||||
|
||||
let config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(err) => return Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
};
|
||||
|
||||
let Some(hotkey_slot) = config.find_slot(slot) else {
|
||||
return Response::new(false, format!("Slot '{}' not found", slot));
|
||||
};
|
||||
|
||||
let action = hotkey_slot.action.clone();
|
||||
|
||||
if let Some(cmd) = parse_command(&action) {
|
||||
cmd.execute().await
|
||||
} else {
|
||||
Response::new(false, "Unknown command in hotkey slot".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for ClearHotkeyCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
let Some(slot) = &self.slot else {
|
||||
return Response::new(false, "Missing slot name");
|
||||
};
|
||||
|
||||
let mut config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(err) => return Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
};
|
||||
|
||||
if config.remove_slot(slot) {
|
||||
match config.save() {
|
||||
Ok(_) => Response::new(true, format!("Hotkey slot '{}' cleared", slot)),
|
||||
Err(err) => Response::new(false, format!("Failed to save hotkeys: {}", err)),
|
||||
}
|
||||
} else {
|
||||
Response::new(false, format!("Slot '{}' not found", slot))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Executable for ClearHotkeyKeyCommand {
|
||||
async fn execute(&self) -> Response {
|
||||
let Some(slot) = &self.slot else {
|
||||
return Response::new(false, "Missing slot name");
|
||||
};
|
||||
|
||||
let mut config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(err) => return Response::new(false, format!("Failed to load hotkeys: {}", err)),
|
||||
};
|
||||
|
||||
if !config.set_key_chord(slot, None) {
|
||||
return Response::new(false, format!("Slot '{}' not found", slot));
|
||||
}
|
||||
|
||||
match config.save() {
|
||||
Ok(_) => Response::new(true, format!("Key chord for slot '{}' cleared", slot)),
|
||||
Err(err) => Response::new(false, format!("Failed to save hotkeys: {}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+112
-2
@@ -1,6 +1,6 @@
|
||||
use crate::utils::config::get_config_path;
|
||||
use crate::{types::socket::Request, utils::config::get_config_path};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{error::Error, fs, path::PathBuf};
|
||||
use std::{collections::HashMap, error::Error, fs, path::PathBuf};
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
@@ -93,3 +93,113 @@ impl GuiConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct HotkeySlot {
|
||||
pub slot: String,
|
||||
pub action: Request,
|
||||
pub key_chord: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct HotkeyConfig {
|
||||
#[serde(default)]
|
||||
pub slots: Vec<HotkeySlot>,
|
||||
}
|
||||
|
||||
impl HotkeyConfig {
|
||||
pub fn config_path() -> Result<PathBuf, Box<dyn Error>> {
|
||||
Ok(get_config_path()?.join("hotkeys.json"))
|
||||
}
|
||||
|
||||
pub fn load() -> Result<HotkeyConfig, Box<dyn Error>> {
|
||||
let path = Self::config_path()?;
|
||||
if !path.exists() {
|
||||
return Ok(HotkeyConfig::default());
|
||||
}
|
||||
let bytes = fs::read(&path)?;
|
||||
match serde_json::from_slice::<HotkeyConfig>(&bytes) {
|
||||
Ok(config) => Ok(config),
|
||||
Err(e) => Err(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn save(&self) -> Result<(), Box<dyn Error>> {
|
||||
let path = Self::config_path()?;
|
||||
if let Some(dir) = path.parent()
|
||||
&& !dir.exists()
|
||||
{
|
||||
fs::create_dir_all(dir)?;
|
||||
}
|
||||
let json = serde_json::to_string_pretty(self)?;
|
||||
fs::write(path, json.as_bytes())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn find_slot(&self, slot: &str) -> Option<&HotkeySlot> {
|
||||
self.slots.iter().find(|s| s.slot == slot)
|
||||
}
|
||||
|
||||
pub fn find_slot_mut(&mut self, slot: &str) -> Option<&mut HotkeySlot> {
|
||||
self.slots.iter_mut().find(|s| s.slot == slot)
|
||||
}
|
||||
|
||||
pub fn set_slot(&mut self, slot: String, action: Request) {
|
||||
if let Some(existing) = self.find_slot_mut(&slot) {
|
||||
existing.action = action;
|
||||
} else {
|
||||
self.slots.push(HotkeySlot {
|
||||
slot,
|
||||
action,
|
||||
key_chord: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_key_chord(&mut self, slot: &str, key_chord: Option<String>) -> bool {
|
||||
if let Some(existing) = self.find_slot_mut(slot) {
|
||||
existing.key_chord = key_chord;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_slot(&mut self, slot: &str) -> bool {
|
||||
let len = self.slots.len();
|
||||
self.slots.retain(|s| s.slot != slot);
|
||||
self.slots.len() != len
|
||||
}
|
||||
|
||||
/// Returns pairs of slot names that share the same key chord.
|
||||
pub fn find_conflicts(&self) -> Vec<(String, String)> {
|
||||
let mut conflicts = vec![];
|
||||
let mut chord_map: HashMap<&str, Vec<&str>> = HashMap::new();
|
||||
|
||||
for s in &self.slots {
|
||||
if let Some(chord) = &s.key_chord {
|
||||
chord_map.entry(chord.as_str()).or_default().push(&s.slot);
|
||||
}
|
||||
}
|
||||
|
||||
for slots in chord_map.values() {
|
||||
if slots.len() > 1 {
|
||||
for i in 0..slots.len() {
|
||||
for j in (i + 1)..slots.len() {
|
||||
conflicts.push((slots[i].to_string(), slots[j].to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conflicts
|
||||
}
|
||||
|
||||
/// Find which slot(s) have the given key chord.
|
||||
pub fn slots_for_chord(&self, chord: &str) -> Vec<&HotkeySlot> {
|
||||
self.slots
|
||||
.iter()
|
||||
.filter(|s| s.key_chord.as_deref() == Some(chord))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -1,4 +1,7 @@
|
||||
use crate::types::audio_player::{PlayerState, TrackInfo};
|
||||
use crate::types::{
|
||||
audio_player::{PlayerState, TrackInfo},
|
||||
config::HotkeyConfig,
|
||||
};
|
||||
|
||||
use egui::Id;
|
||||
|
||||
@@ -42,6 +45,13 @@ pub struct AppState {
|
||||
|
||||
pub selected_file: Option<PathBuf>,
|
||||
pub files: HashSet<PathBuf>,
|
||||
|
||||
pub show_hotkeys: bool,
|
||||
pub hotkey_config: HotkeyConfig,
|
||||
pub hotkey_search_query: String,
|
||||
pub assigning_hotkey_slot: Option<String>,
|
||||
pub assigning_hotkey_for_file: Option<PathBuf>,
|
||||
pub hotkey_capture_active: bool,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
@@ -58,4 +68,6 @@ pub struct AudioPlayerState {
|
||||
pub all_inputs_sorted: Vec<(String, String)>,
|
||||
|
||||
pub is_daemon_running: bool,
|
||||
|
||||
pub hotkey_config: Option<HotkeyConfig>,
|
||||
}
|
||||
|
||||
+48
-1
@@ -1,7 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Request {
|
||||
pub name: String,
|
||||
pub args: HashMap<String, String>,
|
||||
@@ -173,6 +173,53 @@ impl Request {
|
||||
pub fn get_full_state() -> Self {
|
||||
Request::new("get_full_state", vec![])
|
||||
}
|
||||
|
||||
pub fn get_hotkeys() -> Self {
|
||||
Request::new("get_hotkeys", vec![])
|
||||
}
|
||||
|
||||
pub fn set_hotkey(slot: &str, file_path: &str) -> Self {
|
||||
Request::new("set_hotkey", vec![("slot", slot), ("file_path", file_path)])
|
||||
}
|
||||
|
||||
pub fn set_hotkey_key(slot: &str, key_chord: &str) -> Self {
|
||||
Request::new(
|
||||
"set_hotkey_key",
|
||||
vec![("slot", slot), ("key_chord", key_chord)],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn clear_hotkey(slot: &str) -> Self {
|
||||
Request::new("clear_hotkey", vec![("slot", slot)])
|
||||
}
|
||||
|
||||
pub fn play_hotkey(slot: &str) -> Self {
|
||||
Request::new("play_hotkey", vec![("slot", slot)])
|
||||
}
|
||||
|
||||
pub fn set_hotkey_action(slot: &str, action: &Request) -> Self {
|
||||
let action_json = serde_json::to_string(action).unwrap_or_default();
|
||||
Request::new(
|
||||
"set_hotkey_action",
|
||||
vec![("slot", slot), ("action", &action_json)],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn clear_hotkey_key(slot: &str) -> Self {
|
||||
Request::new("clear_hotkey_key", vec![("slot", slot)])
|
||||
}
|
||||
|
||||
pub fn set_hotkey_action_and_key(slot: &str, action: &Request, key_chord: &str) -> Self {
|
||||
let action_json = serde_json::to_string(action).unwrap_or_default();
|
||||
Request::new(
|
||||
"set_hotkey_action_and_key",
|
||||
vec![
|
||||
("slot", slot),
|
||||
("action", &action_json),
|
||||
("key_chord", key_chord),
|
||||
],
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
@@ -72,6 +72,53 @@ pub fn parse_command(request: &Request) -> Option<Box<dyn Executable + Send>> {
|
||||
"toggle_loop" => Some(Box::new(ToggleLoopCommand { id })),
|
||||
"get_daemon_version" => Some(Box::new(GetDaemonVersionCommand {})),
|
||||
"get_full_state" => Some(Box::new(GetFullStateCommand {})),
|
||||
"get_hotkeys" => Some(Box::new(GetHotkeysCommand {})),
|
||||
"set_hotkey" => {
|
||||
let slot = request.args.get("slot").cloned();
|
||||
let file_path = request
|
||||
.args
|
||||
.get("file_path")
|
||||
.and_then(|s| s.parse::<PathBuf>().ok());
|
||||
Some(Box::new(SetHotkeyCommand { slot, file_path }))
|
||||
}
|
||||
"set_hotkey_key" => {
|
||||
let slot = request.args.get("slot").cloned();
|
||||
let key_chord = request.args.get("key_chord").cloned();
|
||||
Some(Box::new(SetHotkeyKeyCommand { slot, key_chord }))
|
||||
}
|
||||
"clear_hotkey" => {
|
||||
let slot = request.args.get("slot").cloned();
|
||||
Some(Box::new(ClearHotkeyCommand { slot }))
|
||||
}
|
||||
"play_hotkey" => {
|
||||
let slot = request.args.get("slot").cloned();
|
||||
Some(Box::new(PlayHotkeyCommand { slot }))
|
||||
}
|
||||
"set_hotkey_action" => {
|
||||
let slot = request.args.get("slot").cloned();
|
||||
let action = request
|
||||
.args
|
||||
.get("action")
|
||||
.and_then(|s| serde_json::from_str::<Request>(s).ok());
|
||||
Some(Box::new(SetHotkeyActionCommand { slot, action }))
|
||||
}
|
||||
"clear_hotkey_key" => {
|
||||
let slot = request.args.get("slot").cloned();
|
||||
Some(Box::new(ClearHotkeyKeyCommand { slot }))
|
||||
}
|
||||
"set_hotkey_action_and_key" => {
|
||||
let slot = request.args.get("slot").cloned();
|
||||
let action = request
|
||||
.args
|
||||
.get("action")
|
||||
.and_then(|s| serde_json::from_str::<Request>(s).ok());
|
||||
let key_chord = request.args.get("key_chord").cloned();
|
||||
Some(Box::new(SetHotkeyActionAndKeyCommand {
|
||||
slot,
|
||||
action,
|
||||
key_chord,
|
||||
}))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
use crate::{types::config::HotkeyConfig, utils::commands::parse_command};
|
||||
use evdev::{Device, EventStream, EventSummary, KeyCode};
|
||||
|
||||
struct ModifierState {
|
||||
ctrl: bool,
|
||||
alt: bool,
|
||||
shift: bool,
|
||||
meta: bool,
|
||||
}
|
||||
|
||||
impl ModifierState {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
ctrl: false,
|
||||
alt: false,
|
||||
shift: false,
|
||||
meta: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, key: KeyCode, pressed: bool) {
|
||||
match key {
|
||||
KeyCode::KEY_LEFTCTRL | KeyCode::KEY_RIGHTCTRL => self.ctrl = pressed,
|
||||
KeyCode::KEY_LEFTALT | KeyCode::KEY_RIGHTALT => self.alt = pressed,
|
||||
KeyCode::KEY_LEFTSHIFT | KeyCode::KEY_RIGHTSHIFT => self.shift = pressed,
|
||||
KeyCode::KEY_LEFTMETA | KeyCode::KEY_RIGHTMETA => self.meta = pressed,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn any_active(&self) -> bool {
|
||||
self.ctrl || self.alt || self.shift || self.meta
|
||||
}
|
||||
|
||||
fn is_modifier(key: KeyCode) -> bool {
|
||||
matches!(
|
||||
key,
|
||||
KeyCode::KEY_LEFTCTRL
|
||||
| KeyCode::KEY_RIGHTCTRL
|
||||
| KeyCode::KEY_LEFTALT
|
||||
| KeyCode::KEY_RIGHTALT
|
||||
| KeyCode::KEY_LEFTSHIFT
|
||||
| KeyCode::KEY_RIGHTSHIFT
|
||||
| KeyCode::KEY_LEFTMETA
|
||||
| KeyCode::KEY_RIGHTMETA
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn evdev_key_name(key: KeyCode) -> Option<&'static str> {
|
||||
match key {
|
||||
KeyCode::KEY_A => Some("A"),
|
||||
KeyCode::KEY_B => Some("B"),
|
||||
KeyCode::KEY_C => Some("C"),
|
||||
KeyCode::KEY_D => Some("D"),
|
||||
KeyCode::KEY_E => Some("E"),
|
||||
KeyCode::KEY_F => Some("F"),
|
||||
KeyCode::KEY_G => Some("G"),
|
||||
KeyCode::KEY_H => Some("H"),
|
||||
KeyCode::KEY_I => Some("I"),
|
||||
KeyCode::KEY_J => Some("J"),
|
||||
KeyCode::KEY_K => Some("K"),
|
||||
KeyCode::KEY_L => Some("L"),
|
||||
KeyCode::KEY_M => Some("M"),
|
||||
KeyCode::KEY_N => Some("N"),
|
||||
KeyCode::KEY_O => Some("O"),
|
||||
KeyCode::KEY_P => Some("P"),
|
||||
KeyCode::KEY_Q => Some("Q"),
|
||||
KeyCode::KEY_R => Some("R"),
|
||||
KeyCode::KEY_S => Some("S"),
|
||||
KeyCode::KEY_T => Some("T"),
|
||||
KeyCode::KEY_U => Some("U"),
|
||||
KeyCode::KEY_V => Some("V"),
|
||||
KeyCode::KEY_W => Some("W"),
|
||||
KeyCode::KEY_X => Some("X"),
|
||||
KeyCode::KEY_Y => Some("Y"),
|
||||
KeyCode::KEY_Z => Some("Z"),
|
||||
KeyCode::KEY_1 => Some("1"),
|
||||
KeyCode::KEY_2 => Some("2"),
|
||||
KeyCode::KEY_3 => Some("3"),
|
||||
KeyCode::KEY_4 => Some("4"),
|
||||
KeyCode::KEY_5 => Some("5"),
|
||||
KeyCode::KEY_6 => Some("6"),
|
||||
KeyCode::KEY_7 => Some("7"),
|
||||
KeyCode::KEY_8 => Some("8"),
|
||||
KeyCode::KEY_9 => Some("9"),
|
||||
KeyCode::KEY_0 => Some("0"),
|
||||
KeyCode::KEY_F1 => Some("F1"),
|
||||
KeyCode::KEY_F2 => Some("F2"),
|
||||
KeyCode::KEY_F3 => Some("F3"),
|
||||
KeyCode::KEY_F4 => Some("F4"),
|
||||
KeyCode::KEY_F5 => Some("F5"),
|
||||
KeyCode::KEY_F6 => Some("F6"),
|
||||
KeyCode::KEY_F7 => Some("F7"),
|
||||
KeyCode::KEY_F8 => Some("F8"),
|
||||
KeyCode::KEY_F9 => Some("F9"),
|
||||
KeyCode::KEY_F10 => Some("F10"),
|
||||
KeyCode::KEY_F11 => Some("F11"),
|
||||
KeyCode::KEY_F12 => Some("F12"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn build_chord(modifiers: &ModifierState, key_name: &str) -> String {
|
||||
let mut parts = Vec::with_capacity(5);
|
||||
if modifiers.ctrl {
|
||||
parts.push("Ctrl");
|
||||
}
|
||||
if modifiers.alt {
|
||||
parts.push("Alt");
|
||||
}
|
||||
if modifiers.shift {
|
||||
parts.push("Shift");
|
||||
}
|
||||
if modifiers.meta {
|
||||
parts.push("Super");
|
||||
}
|
||||
parts.push(key_name);
|
||||
parts.join("+")
|
||||
}
|
||||
|
||||
fn is_keyboard(device: &Device) -> bool {
|
||||
device
|
||||
.supported_keys()
|
||||
.is_some_and(|keys| keys.contains(KeyCode::KEY_A) && keys.contains(KeyCode::KEY_Z))
|
||||
}
|
||||
|
||||
async fn handle_device_events(mut stream: EventStream) {
|
||||
let mut modifiers = ModifierState::new();
|
||||
|
||||
loop {
|
||||
match stream.next_event().await {
|
||||
Ok(event) => {
|
||||
if let EventSummary::Key(_, key, value) = event.destructure() {
|
||||
// 0 = released, 1 = pressed, 2 = repeat
|
||||
if value == 0 || value == 1 {
|
||||
modifiers.update(key, value == 1);
|
||||
}
|
||||
|
||||
// Only trigger on press, skip modifiers and bare keys
|
||||
if value != 1 || ModifierState::is_modifier(key) || !modifiers.any_active() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let Some(key_name) = evdev_key_name(key) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let chord = build_chord(&modifiers, key_name);
|
||||
|
||||
let config = match HotkeyConfig::load() {
|
||||
Ok(c) => c,
|
||||
Err(_) => continue,
|
||||
};
|
||||
|
||||
let slots = config.slots_for_chord(&chord);
|
||||
for slot in slots {
|
||||
if let Some(cmd) = parse_command(&slot.action) {
|
||||
cmd.execute().await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Global hotkeys: device read error: {e}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn start_global_hotkey_listener() {
|
||||
let keyboards: Vec<_> = evdev::enumerate()
|
||||
.filter(|(_, dev)| is_keyboard(dev))
|
||||
.collect();
|
||||
|
||||
if keyboards.is_empty() {
|
||||
eprintln!(
|
||||
"Global hotkeys: no keyboard devices found. \
|
||||
Make sure your user is in the 'input' group."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
println!(
|
||||
"Global hotkeys: found {} keyboard device(s)",
|
||||
keyboards.len()
|
||||
);
|
||||
|
||||
for (path, device) in keyboards {
|
||||
match device.into_event_stream() {
|
||||
Ok(stream) => {
|
||||
println!("Global hotkeys: listening on {}", path.display());
|
||||
tokio::spawn(handle_device_events(stream));
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Global hotkeys: failed to open {}: {}", path.display(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-1
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
types::{
|
||||
audio_player::FullState,
|
||||
config::GuiConfig,
|
||||
config::{GuiConfig, HotkeyConfig},
|
||||
gui::AudioPlayerState,
|
||||
socket::{Request, Response},
|
||||
},
|
||||
@@ -10,6 +10,7 @@ use crate::{
|
||||
use std::{
|
||||
error::Error,
|
||||
sync::{Arc, Mutex},
|
||||
time::Instant,
|
||||
};
|
||||
use tokio::time::{Duration, sleep};
|
||||
|
||||
@@ -49,6 +50,7 @@ pub fn format_time_pair(position: f32, duration: f32) -> String {
|
||||
pub fn start_app_state_thread(audio_player_state_shared: Arc<Mutex<AudioPlayerState>>) {
|
||||
tokio::spawn(async move {
|
||||
let sleep_duration = Duration::from_secs_f32(1.0 / 60.0);
|
||||
let mut last_hotkey_poll = Instant::now();
|
||||
|
||||
loop {
|
||||
let is_running = is_daemon_running().unwrap_or(false);
|
||||
@@ -105,6 +107,22 @@ pub fn start_app_state_thread(audio_player_state_shared: Arc<Mutex<AudioPlayerSt
|
||||
guard.is_daemon_running = true;
|
||||
}
|
||||
|
||||
// Poll hotkey config at a lower frequency (~every 2 seconds)
|
||||
if last_hotkey_poll.elapsed() >= Duration::from_secs(2) {
|
||||
let hotkey_res = make_request(Request::get_hotkeys())
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
if hotkey_res.status {
|
||||
if let Ok(config) = serde_json::from_str::<HotkeyConfig>(&hotkey_res.message) {
|
||||
let mut guard = audio_player_state_shared
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
guard.hotkey_config = Some(config);
|
||||
}
|
||||
}
|
||||
last_hotkey_poll = Instant::now();
|
||||
}
|
||||
|
||||
sleep(sleep_duration).await;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod commands;
|
||||
pub mod config;
|
||||
pub mod daemon;
|
||||
pub mod global_hotkeys;
|
||||
pub mod gui;
|
||||
pub mod pipewire;
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
use rodio::{DeviceSinkBuilder, MixerDeviceSink};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
// A mock of AudioPlayer to isolate the play method's blocking behavior.
|
||||
// We only implement the relevant part of the logic that needs optimizing.
|
||||
pub struct AudioPlayerMock {
|
||||
pub tracks: std::collections::HashMap<u32, ()>,
|
||||
pub next_id: u32,
|
||||
pub volume: f32,
|
||||
}
|
||||
|
||||
impl AudioPlayerMock {
|
||||
pub fn new() -> Self {
|
||||
AudioPlayerMock {
|
||||
tracks: std::collections::HashMap::new(),
|
||||
next_id: 1,
|
||||
volume: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn play(
|
||||
&mut self,
|
||||
file_path: &Path,
|
||||
concurrent: bool,
|
||||
) -> Result<u32, Box<dyn std::error::Error + Send + Sync>> {
|
||||
if !file_path.exists() {
|
||||
return Err(format!("File does not exist: {}", file_path.display()).into());
|
||||
}
|
||||
|
||||
let path_buf = file_path.to_path_buf();
|
||||
let _file = tokio::task::spawn_blocking(move || {
|
||||
// Simulate some blocking work like Decoder::try_from which reads file headers
|
||||
let _f = fs::File::open(&path_buf).unwrap();
|
||||
|
||||
// Emulate the actual time spent reading file and decoding header (which is what Decoder::try_from does)
|
||||
std::thread::sleep(std::time::Duration::from_millis(100)); // Simulate slow disk/decode
|
||||
_f
|
||||
})
|
||||
.await?;
|
||||
|
||||
if !concurrent {
|
||||
self.tracks.clear();
|
||||
}
|
||||
|
||||
let id = self.next_id;
|
||||
self.next_id += 1;
|
||||
self.tracks.insert(id, ());
|
||||
|
||||
Ok(id)
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_performance_blocking() {
|
||||
println!("Setting up mock environment...");
|
||||
|
||||
// Create a dummy file to read
|
||||
let test_file = Path::new("test_dummy.wav");
|
||||
fs::write(test_file, "dummy content").unwrap();
|
||||
|
||||
let player = Arc::new(Mutex::new(AudioPlayerMock::new()));
|
||||
|
||||
println!("Starting benchmark for synchronous behavior in async fn...");
|
||||
|
||||
// We launch a background task that measures event loop latency.
|
||||
// If the main tasks block the executor, this task will suffer high latency.
|
||||
let latency_task = tokio::spawn(async {
|
||||
let mut max_latency = std::time::Duration::from_secs(0);
|
||||
for _ in 0..50 {
|
||||
let start = Instant::now();
|
||||
tokio::task::yield_now().await;
|
||||
let elapsed = start.elapsed();
|
||||
if elapsed > max_latency {
|
||||
max_latency = elapsed;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(5)).await;
|
||||
}
|
||||
max_latency
|
||||
});
|
||||
|
||||
// Launch multiple play operations
|
||||
let mut tasks = vec![];
|
||||
let start_time = Instant::now();
|
||||
for _ in 0..10 {
|
||||
let player_clone = Arc::clone(&player);
|
||||
let file_path = test_file.to_path_buf();
|
||||
tasks.push(tokio::spawn(async move {
|
||||
let mut p = player_clone.lock().await;
|
||||
let _ = p.play(&file_path, true).await;
|
||||
}));
|
||||
}
|
||||
|
||||
// Wait for all tasks to finish
|
||||
for t in tasks {
|
||||
let _ = t.await;
|
||||
}
|
||||
let total_time = start_time.elapsed();
|
||||
|
||||
let max_latency = latency_task.await.unwrap();
|
||||
|
||||
println!("Total execution time: {:?}", total_time);
|
||||
println!(
|
||||
"Max event loop latency (blocking indicator): {:?}",
|
||||
max_latency
|
||||
);
|
||||
|
||||
// Cleanup
|
||||
fs::remove_file(test_file).unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user