commit 5a14313d48ac80fb92b59bb0fbbc8b56cd674711
parent 7c810f815204b930dd6dc1e0512851e74edf2af8
Author: MTRNord <mtrnord1@gmail.com>
Date: Fri, 18 Dec 2020 17:19:49 +0100
feat: Add alphaish matrix integration
Took 1 hour 0 minutes
Diffstat:
11 files changed, 556 insertions(+), 99 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1 +1,3 @@
/target
+config.yml
+store
+\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
@@ -6,13 +6,17 @@
</component>
<component name="ChangeListManager">
<list default="true" id="cfc5721f-cc06-4df2-8555-3745919e4c56" name="Default Changelist" comment="">
+ <change afterPath="$PROJECT_DIR$/lsc_matrix_presets/src/config.rs" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/launchpad_sway_controler/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/launchpad_sway_controler/Cargo.toml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/launchpad_sway_controler/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/launchpad_sway_controler/src/main.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/launchpad_sway_controler/src/mappings/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/launchpad_sway_controler/src/mappings/mod.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/launchpad_sway_controler/src/plugin_actions/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/launchpad_sway_controler/src/plugin_actions/mod.rs" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/launchpad_sway_controler/src/sway/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/launchpad_sway_controler/src/sway/mod.rs" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/lsc_example_plugin/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/lsc_example_plugin/Cargo.toml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/lsc_example_plugin/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/lsc_example_plugin/src/main.rs" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/lsc_matrix_presets/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/lsc_matrix_presets/Cargo.toml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/lsc_matrix_presets/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/lsc_matrix_presets/src/main.rs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -20,7 +24,7 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DarkyenusTimeTracker">
- <option name="totalTimeSeconds" value="17813" />
+ <option name="totalTimeSeconds" value="21452" />
<option name="idleThresholdMs" value="60000" />
<option name="autoCountIdleSeconds" value="0" />
<option name="stopWhenIdleRatherThanPausing" value="true" />
@@ -50,7 +54,7 @@
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
- <property name="last_opened_file_path" value="$PROJECT_DIR$" />
+ <property name="last_opened_file_path" value="$PROJECT_DIR$/lsc_example_plugin/src" />
<property name="org.rust.cargo.project.model.PROJECT_DISCOVERY" value="true" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
@@ -59,9 +63,11 @@
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
+ <recent name="$PROJECT_DIR$/lsc_example_plugin/src" />
<recent name="$PROJECT_DIR$" />
</key>
<key name="MoveFile.RECENT_KEYS">
+ <recent name="$PROJECT_DIR$/lsc_matrix_presets/src" />
<recent name="$PROJECT_DIR$/launchpad_sway_controler/src/sway" />
<recent name="$PROJECT_DIR$/launchpad_sway_controler/src/utils" />
</key>
@@ -131,7 +137,7 @@
<workItem from="1607716945713" duration="4563000" />
<workItem from="1607936162789" duration="15000" />
<workItem from="1608061205255" duration="763000" />
- <workItem from="1608229569199" duration="14716000" />
+ <workItem from="1608229569199" duration="21320000" />
</task>
<task id="LOCAL-00001" summary="refactor: Use Workspace setup">
<created>1607182699156</created>
@@ -175,7 +181,14 @@
<option name="project" value="LOCAL" />
<updated>1608242637813</updated>
</task>
- <option name="localTasksCounter" value="7" />
+ <task id="LOCAL-00007" summary="feat: Implement layers fully">
+ <created>1608250883243</created>
+ <option name="number" value="00007" />
+ <option name="presentableId" value="LOCAL-00007" />
+ <option name="project" value="LOCAL" />
+ <updated>1608250883243</updated>
+ </task>
+ <option name="localTasksCounter" value="8" />
<servers />
</component>
<component name="VcsManagerConfiguration">
@@ -186,7 +199,8 @@
<MESSAGE value="fix: reset colors when moving away from known workspaces" />
<MESSAGE value="feat: Prepare Matrix and Layers" />
<MESSAGE value="refactor: Move layer action keys out of layer" />
- <option name="LAST_COMMIT_MESSAGE" value="refactor: Move layer action keys out of layer" />
+ <MESSAGE value="feat: Implement layers fully" />
+ <option name="LAST_COMMIT_MESSAGE" value="feat: Implement layers fully" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
diff --git a/Cargo.lock b/Cargo.lock
@@ -74,7 +74,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb213f6b3e4b1480a60931ca2035794aa67b73103d254715b1db7b70dcb3c934"
dependencies = [
"alsa-sys",
- "bitflags",
+ "bitflags 1.2.1",
"libc",
"nix",
]
@@ -99,6 +99,12 @@ dependencies = [
]
[[package]]
+name = "arrayref"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
+
+[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -186,8 +192,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -203,8 +209,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -262,6 +268,12 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "bitflags"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
+
+[[package]]
+name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
@@ -279,6 +291,23 @@ dependencies = [
]
[[package]]
+name = "blake2b_simd"
+version = "0.5.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
+dependencies = [
+ "arrayref",
+ "arrayvec",
+ "constant_time_eq",
+]
+
+[[package]]
+name = "block"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
+
+[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -468,6 +497,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
[[package]]
+name = "constant_time_eq"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
+
+[[package]]
name = "core-foundation"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -536,7 +571,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
dependencies = [
"cfg-if 0.1.10",
- "crossbeam-utils",
+ "crossbeam-utils 0.7.2",
"maybe-uninit",
]
@@ -552,6 +587,17 @@ dependencies = [
]
[[package]]
+name = "crossbeam-utils"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
+dependencies = [
+ "autocfg",
+ "cfg-if 1.0.0",
+ "lazy_static",
+]
+
+[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -588,6 +634,16 @@ dependencies = [
]
[[package]]
+name = "dbus"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5cd9e78c210146a1860f897db03412fd5091fd73100778e43ee255cca252cf32"
+dependencies = [
+ "libc",
+ "libdbus-sys",
+]
+
+[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -597,6 +653,17 @@ dependencies = [
]
[[package]]
+name = "dirs"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901"
+dependencies = [
+ "libc",
+ "redox_users",
+ "winapi 0.3.9",
+]
+
+[[package]]
name = "discard"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -609,8 +676,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adc2ab4d5a16117f9029e9a6b5e4e79f4c67f6519bc134210d4d4a04ba31f41b"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -620,6 +687,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]]
+name = "dtoa"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
+
+[[package]]
name = "encoding_rs"
version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -690,7 +763,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
dependencies = [
- "bitflags",
+ "bitflags 1.2.1",
"fuchsia-zircon-sys",
]
@@ -786,8 +859,8 @@ checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556"
dependencies = [
"proc-macro-hack",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -1127,12 +1200,14 @@ dependencies = [
"color-eyre",
"futures-util",
"midir",
+ "notify-rust",
"once_cell",
"swayipc-async",
"thirtyfour",
"tokio 0.2.24",
"tracing",
"tracing-subscriber",
+ "users",
]
[[package]]
@@ -1148,7 +1223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616"
dependencies = [
"arrayvec",
- "bitflags",
+ "bitflags 1.2.1",
"cfg-if 0.1.10",
"ryu",
"static_assertions",
@@ -1161,6 +1236,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]]
+name = "libdbus-sys"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc12a3bc971424edbbf7edaf6e5740483444db63aa8e23d3751ff12a30f306f0"
+dependencies = [
+ "pkg-config",
+]
+
+[[package]]
name = "libsqlite3-sys"
version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1172,6 +1256,12 @@ dependencies = [
]
[[package]]
+name = "linked-hash-map"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a"
+
+[[package]]
name = "lock_api"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1211,6 +1301,7 @@ dependencies = [
"tokio 0.3.5",
"tracing",
"tracing-subscriber",
+ "users",
]
[[package]]
@@ -1222,10 +1313,35 @@ dependencies = [
"futures-util",
"matrix-sdk",
"matrix-sdk-common-macros",
+ "once_cell",
+ "serde",
+ "serde_yaml",
"tokio 0.2.24",
"tracing",
"tracing-subscriber",
"url",
+ "users",
+]
+
+[[package]]
+name = "mac-notification-sys"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3dfb6b71a9a89cd38b395d994214297447e8e63b1ba5708a9a2b0b1048ceda76"
+dependencies = [
+ "cc",
+ "chrono",
+ "dirs",
+ "objc-foundation",
+]
+
+[[package]]
+name = "malloc_buf"
+version = "0.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
+dependencies = [
+ "libc",
]
[[package]]
@@ -1308,8 +1424,8 @@ name = "matrix-sdk-common-macros"
version = "0.1.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=8f99180c99ccd74803565fb36098389198091ded#8f99180c99ccd74803565fb36098389198091ded"
dependencies = [
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -1366,7 +1482,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25df1e7836ca65078a121efed77049084a434838562b9892d0401bdfb59244cc"
dependencies = [
"alsa",
- "bitflags",
+ "bitflags 1.2.1",
"coremidi",
"js-sys",
"libc",
@@ -1525,7 +1641,7 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
dependencies = [
- "bitflags",
+ "bitflags 1.2.1",
"cc",
"cfg-if 0.1.10",
"libc",
@@ -1545,6 +1661,17 @@ dependencies = [
]
[[package]]
+name = "notify-rust"
+version = "4.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "144acee6a0543dc74893e4b8a33936b5b0a94cc2d4ab024afd0c6daff7afc3c0"
+dependencies = [
+ "dbus",
+ "mac-notification-sys",
+ "winrt-notification",
+]
+
+[[package]]
name = "ntapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1583,6 +1710,35 @@ dependencies = [
]
[[package]]
+name = "objc"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
+dependencies = [
+ "malloc_buf",
+]
+
+[[package]]
+name = "objc-foundation"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
+dependencies = [
+ "block",
+ "objc",
+ "objc_id",
+]
+
+[[package]]
+name = "objc_id"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
+dependencies = [
+ "objc",
+]
+
+[[package]]
name = "object"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1628,7 +1784,7 @@ version = "0.10.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d008f51b1acffa0d3450a68606e6a51c123012edaacb0f4e1426bd978869187"
dependencies = [
- "bitflags",
+ "bitflags 1.2.1",
"cfg-if 1.0.0",
"foreign-types",
"lazy_static",
@@ -1732,8 +1888,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -1743,8 +1899,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -1817,11 +1973,17 @@ version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
dependencies = [
- "unicode-xid",
+ "unicode-xid 0.2.1",
]
[[package]]
name = "quote"
+version = "0.3.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
+
+[[package]]
+name = "quote"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
@@ -1883,6 +2045,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
+name = "redox_users"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
+dependencies = [
+ "getrandom 0.1.15",
+ "redox_syscall",
+ "rust-argon2",
+]
+
+[[package]]
name = "regex"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1986,7 +2159,7 @@ dependencies = [
"ruma-serde",
"serde",
"serde_json",
- "strum",
+ "strum 0.19.5",
"thiserror",
]
@@ -1997,8 +2170,8 @@ source = "git+https://github.com/ruma/ruma?rev=50eb700571480d1440e15a387d10f98be
dependencies = [
"proc-macro-crate",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2031,7 +2204,7 @@ dependencies = [
"ruma-serde",
"serde",
"serde_json",
- "strum",
+ "strum 0.19.5",
]
[[package]]
@@ -2045,7 +2218,7 @@ dependencies = [
"ruma-serde",
"serde",
"serde_json",
- "strum",
+ "strum 0.19.5",
]
[[package]]
@@ -2055,8 +2228,8 @@ source = "git+https://github.com/ruma/ruma?rev=50eb700571480d1440e15a387d10f98be
dependencies = [
"proc-macro-crate",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2071,7 +2244,7 @@ dependencies = [
"ruma-serde",
"serde",
"serde_json",
- "strum",
+ "strum 0.19.5",
]
[[package]]
@@ -2081,8 +2254,8 @@ source = "git+https://github.com/ruma/ruma?rev=50eb700571480d1440e15a387d10f98be
dependencies = [
"proc-macro-crate",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2108,7 +2281,7 @@ dependencies = [
"ruma-identifiers-macros",
"ruma-identifiers-validation",
"serde",
- "strum",
+ "strum 0.19.5",
]
[[package]]
@@ -2117,9 +2290,9 @@ version = "0.17.4"
source = "git+https://github.com/ruma/ruma?rev=50eb700571480d1440e15a387d10f98be8abab59#50eb700571480d1440e15a387d10f98be8abab59"
dependencies = [
"proc-macro2",
- "quote",
+ "quote 1.0.7",
"ruma-identifiers-validation",
- "syn",
+ "syn 1.0.53",
]
[[package]]
@@ -2128,7 +2301,7 @@ version = "0.1.1"
source = "git+https://github.com/ruma/ruma?rev=50eb700571480d1440e15a387d10f98be8abab59#50eb700571480d1440e15a387d10f98be8abab59"
dependencies = [
"serde",
- "strum",
+ "strum 0.19.5",
]
[[package]]
@@ -2144,6 +2317,18 @@ dependencies = [
]
[[package]]
+name = "rust-argon2"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb"
+dependencies = [
+ "base64 0.13.0",
+ "blake2b_simd",
+ "constant_time_eq",
+ "crossbeam-utils 0.8.1",
+]
+
+[[package]]
name = "rustc-demangle"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2192,7 +2377,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69"
dependencies = [
- "bitflags",
+ "bitflags 1.2.1",
"core-foundation 0.9.1",
"core-foundation-sys 0.8.2",
"libc",
@@ -2246,8 +2431,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2269,8 +2454,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dc6b7951b17b051f3210b063f12cc17320e2fe30ae05b0fe2a3abb068551c76"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2286,6 +2471,18 @@ dependencies = [
]
[[package]]
+name = "serde_yaml"
+version = "0.8.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7"
+dependencies = [
+ "dtoa",
+ "linked-hash-map",
+ "serde",
+ "yaml-rust",
+]
+
+[[package]]
name = "sha1"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2388,10 +2585,10 @@ checksum = "88ac5a436f941c42eac509471a730df5c3c58e1450e68cd39afedbd948206273"
dependencies = [
"async-native-tls",
"async-stream",
- "bitflags",
+ "bitflags 1.2.1",
"byteorder",
"crossbeam-queue",
- "crossbeam-utils",
+ "crossbeam-utils 0.7.2",
"futures-channel",
"futures-core",
"futures-util",
@@ -2417,9 +2614,9 @@ dependencies = [
"heck",
"lazy_static",
"proc-macro2",
- "quote",
+ "quote 1.0.7",
"sqlx-core",
- "syn",
+ "syn 1.0.53",
"tokio 0.2.24",
"url",
]
@@ -2460,10 +2657,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [
"proc-macro2",
- "quote",
+ "quote 1.0.7",
"serde",
"serde_derive",
- "syn",
+ "syn 1.0.53",
]
[[package]]
@@ -2474,12 +2671,12 @@ checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
dependencies = [
"base-x",
"proc-macro2",
- "quote",
+ "quote 1.0.7",
"serde",
"serde_derive",
"serde_json",
"sha1",
- "syn",
+ "syn 1.0.53",
]
[[package]]
@@ -2500,11 +2697,27 @@ dependencies = [
[[package]]
name = "strum"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ca6e4730f517e041e547ffe23d29daab8de6b73af4b6ae2a002108169f5e7da"
+
+[[package]]
+name = "strum"
version = "0.19.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b89a286a7e3b5720b9a477b23253bc50debac207c8d21505f8e70b36792f11b5"
dependencies = [
- "strum_macros",
+ "strum_macros 0.19.4",
+]
+
+[[package]]
+name = "strum_macros"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3384590878eb0cab3b128e844412e2d010821e7e091211b9d87324173ada7db8"
+dependencies = [
+ "quote 0.3.15",
+ "syn 0.11.11",
]
[[package]]
@@ -2515,8 +2728,8 @@ checksum = "e61bb0be289045cb80bfce000512e32d09f8337e54c186725da381377ad1f8d5"
dependencies = [
"heck",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2552,13 +2765,33 @@ dependencies = [
[[package]]
name = "syn"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
+dependencies = [
+ "quote 0.3.15",
+ "synom",
+ "unicode-xid 0.0.4",
+]
+
+[[package]]
+name = "syn"
version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8833e20724c24de12bbaba5ad230ea61c3eafb05b881c7c9d3cfe8638b187e68"
dependencies = [
"proc-macro2",
- "quote",
- "unicode-xid",
+ "quote 1.0.7",
+ "unicode-xid 0.2.1",
+]
+
+[[package]]
+name = "synom"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
+dependencies = [
+ "unicode-xid 0.0.4",
]
[[package]]
@@ -2568,9 +2801,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
- "unicode-xid",
+ "quote 1.0.7",
+ "syn 1.0.53",
+ "unicode-xid 0.2.1",
]
[[package]]
@@ -2630,8 +2863,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2687,9 +2920,9 @@ checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa"
dependencies = [
"proc-macro-hack",
"proc-macro2",
- "quote",
+ "quote 1.0.7",
"standback",
- "syn",
+ "syn 1.0.53",
]
[[package]]
@@ -2769,8 +3002,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2780,8 +3013,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21d30fdbb5dc2d8f91049691aa1a9d4d4ae422a21c334ce8936e5886d30c5c45"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2843,8 +3076,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
]
[[package]]
@@ -2966,6 +3199,12 @@ checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
[[package]]
name = "unicode-xid"
+version = "0.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
+
+[[package]]
+name = "unicode-xid"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
@@ -2995,6 +3234,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "110352d4e9076c67839003c7788d8604e24dcded13e0b375af3efaa8cf468517"
[[package]]
+name = "users"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
+dependencies = [
+ "libc",
+ "log",
+]
+
+[[package]]
name = "uuid"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3078,8 +3327,8 @@ dependencies = [
"lazy_static",
"log",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
"wasm-bindgen-shared",
]
@@ -3101,7 +3350,7 @@ version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084"
dependencies = [
- "quote",
+ "quote 1.0.7",
"wasm-bindgen-macro-support",
]
@@ -3112,8 +3361,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -3145,7 +3394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27e07b46b98024c2ba2f9e83a10c2ef0515f057f2da299c1762a2017de80438b"
dependencies = [
"proc-macro2",
- "quote",
+ "quote 1.0.7",
]
[[package]]
@@ -3211,6 +3460,28 @@ dependencies = [
]
[[package]]
+name = "winrt"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e30cba82e22b083dc5a422c2ee77e20dc7927271a0dc981360c57c1453cb48d"
+dependencies = [
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "winrt-notification"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c31a65da50d792c6f9bd2e3216249566c4fb1d2d34f9b7d2d66d2e93f62a242"
+dependencies = [
+ "strum 0.8.0",
+ "strum_macros 0.8.0",
+ "winapi 0.3.9",
+ "winrt",
+ "xml-rs",
+]
+
+[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3227,6 +3498,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
[[package]]
+name = "xml-rs"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1945e12e16b951721d7976520b0832496ef79c31602c7a29d950de79ba74621"
+dependencies = [
+ "bitflags 0.9.1",
+]
+
+[[package]]
+name = "yaml-rust"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d"
+dependencies = [
+ "linked-hash-map",
+]
+
+[[package]]
name = "zeroize"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3242,7 +3531,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.7",
+ "syn 1.0.53",
"synstructure",
]
diff --git a/launchpad_sway_controler/Cargo.toml b/launchpad_sway_controler/Cargo.toml
@@ -16,4 +16,6 @@ alsa = "0.4.3"
tracing = "0.1"
tracing-subscriber = "0.2"
thirtyfour = "0.21"
-once_cell = "1.4.1"
-\ No newline at end of file
+once_cell = "1.4.1"
+notify-rust = "4"
+users = "0.11.0"
+\ No newline at end of file
diff --git a/launchpad_sway_controler/src/mappings/mod.rs b/launchpad_sway_controler/src/mappings/mod.rs
@@ -12,9 +12,17 @@ pub static LAYERS: [&'static [(i64, PluginActions)]; 10] = [
(113, PluginActions::SwayWorkspace("13:\u{f167}")),
(112, PluginActions::SwayWorkspace("42:\u{f001}")),
],
+ &[(0, PluginActions::ExamplePlugin)],
&[
- (0, PluginActions::ExamplePlugin),
- (1, PluginActions::SelectMatrixRoomByID("")),
+ (
+ 0,
+ PluginActions::SelectMatrixRoomByID("!IFqsVhqzXtALgXIFig:bpulse.org"),
+ ),
+ (
+ 1,
+ PluginActions::SelectMatrixRoomByID("!FJymnHKxIlQeNDkaZW:ubports.chat"),
+ ),
+ (17, PluginActions::RunMatrixPreset("0")),
],
&[],
&[],
@@ -23,5 +31,4 @@ pub static LAYERS: [&'static [(i64, PluginActions)]; 10] = [
&[],
&[],
&[],
- &[],
];
diff --git a/launchpad_sway_controler/src/plugin_actions/mod.rs b/launchpad_sway_controler/src/plugin_actions/mod.rs
@@ -3,10 +3,12 @@ use crate::utils::globals::{LAYER_NUMBER, PRESELECTED_LAYER_NUMBER, SHOWING_NUMB
use crate::utils::show_number;
use color_eyre::Result;
use midir::MidiOutput;
+use notify_rust::{Notification, Timeout};
use std::sync::atomic::Ordering;
use swayipc_async::Connection;
use tokio::io::AsyncWriteExt;
use tokio::net::UnixStream;
+use users::get_current_uid;
pub enum PluginActions<'a> {
SwayWorkspace(&'a str),
@@ -26,6 +28,7 @@ impl PluginActions<'_> {
let mut conn_out = midi_out.connect(out_port, "midir-test").unwrap();
match self {
PluginActions::SwayWorkspace(workspace) => {
+ notification(format!("Changed to workspace: {}", workspace).as_str());
let mut connection = Connection::new().await?;
connection
.run_command(format!("workspace --no-auto-back-and-forth {}", workspace))
@@ -40,28 +43,43 @@ impl PluginActions<'_> {
.unwrap();
}
PluginActions::ExamplePlugin => {
- let mut socket = UnixStream::connect("/run/lsc_example_plugin.sock").await?;
+ let user_id = get_current_uid();
+ let path_string = format!("/run/user/{}/lsc_example_plugin.sock", user_id);
+
+ let mut socket = UnixStream::connect(&path_string).await?;
socket.write(b"test\n").await?;
}
PluginActions::SelectMatrixRoomByID(room_id) => {
- let mut socket = UnixStream::connect("/run/lsc_matrix_presets.sock").await?;
+ let user_id = get_current_uid();
+ let path_string = format!("/run/user/{}/lsc_matrix_presets.sock", user_id);
+ let mut socket = UnixStream::connect(&path_string).await?;
socket
.write(format!("select {}\n", room_id).as_bytes())
.await?;
}
PluginActions::RunMatrixPreset(preset_id) => {
- let mut socket = UnixStream::connect("/run/lsc_matrix_presets.sock").await?;
+ let user_id = get_current_uid();
+ let path_string = format!("/run/user/{}/lsc_matrix_presets.sock", user_id);
+ let mut socket = UnixStream::connect(&path_string).await?;
socket
.write(format!("do {}\n", preset_id).as_bytes())
.await?;
}
PluginActions::ShowNumber(number) => {
+ notification(format!("Number shown: {}", number).as_str());
show_number(&mut conn_out, *number);
}
PluginActions::SelectLayer => {
+ notification(
+ format!(
+ "Selected layer: {}",
+ PRESELECTED_LAYER_NUMBER.load(Ordering::SeqCst)
+ )
+ .as_str(),
+ );
LAYER_NUMBER.store(
PRESELECTED_LAYER_NUMBER.load(Ordering::SeqCst),
Ordering::SeqCst,
@@ -73,3 +91,13 @@ impl PluginActions<'_> {
Ok(())
}
}
+
+fn notification(text: &str) {
+ Notification::new()
+ .appname("Launchpad Macros")
+ .summary("Launchpad Macros")
+ .body(text)
+ .timeout(Timeout::Milliseconds(700)) //milliseconds
+ .show()
+ .unwrap();
+}
diff --git a/lsc_example_plugin/Cargo.toml b/lsc_example_plugin/Cargo.toml
@@ -11,4 +11,5 @@ tracing = "0.1"
tracing-subscriber = "0.2"
tokio = { version = "0.3.2", features = ["full"] }
futures-util = "0.3.7"
-color-eyre = "0.5"
-\ No newline at end of file
+color-eyre = "0.5"
+users = "0.11.0"
+\ No newline at end of file
diff --git a/lsc_example_plugin/src/main.rs b/lsc_example_plugin/src/main.rs
@@ -6,6 +6,7 @@ use std::{env, fs};
use tokio::io::{AsyncBufReadExt, BufStream};
use tokio::net::UnixListener;
use tracing::*;
+use users::get_current_uid;
#[tokio::main]
async fn main() -> Result<()> {
@@ -15,8 +16,9 @@ async fn main() -> Result<()> {
env::set_var("RUST_LOG", "INFO");
}
tracing_subscriber::fmt::init();
-
- let socket_path = Path::new("/run/lsc_example_plugin.sock");
+ let user_id = get_current_uid();
+ let path_string = format!("/run/user/{}/lsc_example_plugin.sock", user_id);
+ let socket_path = Path::new(&path_string);
if socket_path.exists() {
fs::remove_file(socket_path)?;
}
diff --git a/lsc_matrix_presets/Cargo.toml b/lsc_matrix_presets/Cargo.toml
@@ -15,4 +15,8 @@ tracing = "0.1"
tracing-subscriber = "0.2"
tokio = { version = "0.2", features = ["full"] }
futures-util = "0.3.7"
-color-eyre = "0.5"
-\ No newline at end of file
+color-eyre = "0.5"
+once_cell = "1.5.2"
+users = "0.11.0"
+serde = "1.0"
+serde_yaml = "0.8.13"
diff --git a/lsc_matrix_presets/src/config.rs b/lsc_matrix_presets/src/config.rs
@@ -0,0 +1,23 @@
+use color_eyre::eyre::Result;
+use serde::{Deserialize, Serialize};
+use std::borrow::Cow;
+use std::{fs, path::Path};
+use tracing::*;
+
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+pub struct Config<'a> {
+ pub homeserver_url: Cow<'a, str>,
+ pub mxid: Cow<'a, str>,
+ pub password: Cow<'a, str>,
+ pub store_path: Cow<'a, str>,
+}
+
+impl Config<'_> {
+ #[instrument]
+ pub fn load() -> Result<Self> {
+ let contents =
+ fs::read_to_string("./config.yml").expect("Something went wrong reading the file");
+ let config: Self = serde_yaml::from_str(&contents)?;
+ Ok(config)
+ }
+}
diff --git a/lsc_matrix_presets/src/main.rs b/lsc_matrix_presets/src/main.rs
@@ -1,11 +1,74 @@
+use crate::config::Config;
use color_eyre::Result;
use futures_util::StreamExt;
-//use std::os::unix::fs::PermissionsExt;
+use matrix_sdk::{
+ events::{
+ room::message::{MessageEventContent, NoticeMessageEventContent},
+ AnyMessageEventContent,
+ },
+ identifiers::RoomId,
+ SyncSettings,
+};
+use matrix_sdk::{Client, ClientConfig};
+use once_cell::sync::{Lazy, OnceCell};
+use std::convert::TryFrom;
use std::path::Path;
use std::{env, fs};
use tokio::io::{AsyncBufReadExt, BufStream};
use tokio::net::UnixListener;
+use tokio::sync::Mutex;
use tracing::*;
+use url::Url;
+use users::get_current_uid;
+
+mod config;
+
+static ROOM_ID: Lazy<Mutex<String>> = Lazy::new(|| Mutex::new(String::new()));
+static CLIENT: OnceCell<Mutex<Client>> = OnceCell::new();
+static PRESETS: Lazy<Vec<AnyMessageEventContent>> = Lazy::new(|| {
+ vec![AnyMessageEventContent::RoomMessage(
+ MessageEventContent::Notice(NoticeMessageEventContent {
+ body: String::from("This is the first macro message sent using a midi controller"),
+ formatted: None,
+ relates_to: None,
+ }),
+ )]
+});
+
+async fn setup_matrix() -> Result<()> {
+ info!("Beginning Matrix Setup");
+ let config = Config::load().unwrap();
+ let store_path_string = config.store_path.to_string();
+ let store_path = Path::new(&store_path_string);
+ if !store_path.exists() {
+ fs::create_dir_all(store_path)?;
+ }
+ let client_config = ClientConfig::new().store_path(fs::canonicalize(&store_path)?);
+
+ let homeserver_url =
+ Url::parse(&config.homeserver_url).expect("Couldn't parse the homeserver URL");
+
+ let client = Client::new_with_config(homeserver_url, client_config).unwrap();
+
+ client
+ .login(
+ &config.mxid,
+ &config.password,
+ None,
+ Some(&"macro-bot".to_string()),
+ )
+ .await?;
+ info!("logged in as {}", config.mxid);
+
+ let mutexed_client = Mutex::new(client.clone());
+ CLIENT.set(mutexed_client);
+
+ tokio::spawn(async move {
+ info!("Starting full Sync...");
+ client.sync(SyncSettings::default()).await;
+ });
+ Ok(())
+}
#[tokio::main]
async fn main() -> Result<()> {
@@ -15,8 +78,11 @@ async fn main() -> Result<()> {
env::set_var("RUST_LOG", "INFO");
}
tracing_subscriber::fmt::init();
+ setup_matrix().await?;
- let socket_path = Path::new("/run/user/lsc_matrix_presets.sock");
+ let user_id = get_current_uid();
+ let path_string = format!("/run/user/{}/lsc_matrix_presets.sock", user_id);
+ let socket_path = Path::new(&path_string);
if socket_path.exists() {
fs::remove_file(socket_path)?;
}
@@ -37,7 +103,26 @@ async fn main() -> Result<()> {
let mut lines = buffer.lines();
while let Ok(line) = lines.next_line().await {
if let Some(line) = line {
- println!("{}", line);
+ info!("{}", line);
+ let split: Vec<&str> = line.split_whitespace().collect();
+ if split[0] == "select" {
+ let mut state = ROOM_ID.lock().await;
+ *state = String::from(split[1]);
+ }
+ if split[0] == "do" {
+ let preset = PRESETS[split[1].parse::<usize>().unwrap()].clone();
+ info!("preset: {:?}", preset);
+ let room_id = ROOM_ID.lock().await;
+ let cloned_id = (*room_id).clone();
+ let client = CLIENT.get().unwrap().lock().await;
+ client
+ .room_send(&RoomId::try_from(cloned_id).unwrap(), preset, None)
+ .await
+ .unwrap();
+ info!("executed preset");
+ }
+ let room_id = ROOM_ID.lock().await;
+ info!("room_id: {}", room_id);
}
}
});