sway-launchpad

A small rust script to switch sway workspaces using a Launchpad S
git clone git://archive.git.mtrnord.blog/MTRNord/sway-launchpad.git
Log | Files | Refs | LICENSE

commit 60a5031d0df541f4f781f41bbe5a5777991cdfa3
parent 7381e34f95b46976a2630c036bac10c14d3b87ab
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sat,  5 Dec 2020 18:18:24 +0100

fix: on reset also disable LEDs again

Took 2 minutes

Diffstat:
M.idea/workspace.xml | 23++++++++++++-----------
Mlaunchpad_sway_controler/src/main.rs | 5+++--
2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/.idea/workspace.xml b/.idea/workspace.xml @@ -6,15 +6,8 @@ </component> <component name="ChangeListManager"> <list default="true" id="cfc5721f-cc06-4df2-8555-3745919e4c56" name="Default Changelist" comment=""> - <change afterPath="$PROJECT_DIR$/launchpad_sway_controler/src/plugin_actions/mod.rs" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/lsc_example_plugin/Cargo.toml" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/lsc_example_plugin/src/main.rs" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/.idea/LaunchpadSwayControler.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/LaunchpadSwayControler.iml" 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$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/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/sway/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/launchpad_sway_controler/src/sway/mod.rs" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -22,7 +15,7 @@ <option name="LAST_RESOLUTION" value="IGNORE" /> </component> <component name="DarkyenusTimeTracker"> - <option name="totalTimeSeconds" value="4158" /> + <option name="totalTimeSeconds" value="4209" /> <option name="idleThresholdMs" value="60000" /> <option name="autoCountIdleSeconds" value="0" /> <option name="stopWhenIdleRatherThanPausing" value="true" /> @@ -104,7 +97,7 @@ <option name="presentableId" value="Default" /> <updated>1607182424184</updated> <workItem from="1607182426972" duration="523000" /> - <workItem from="1607182962786" duration="5115000" /> + <workItem from="1607182962786" duration="5460000" /> </task> <task id="LOCAL-00001" summary="refactor: Use Workspace setup"> <created>1607182699156</created> @@ -113,12 +106,20 @@ <option name="project" value="LOCAL" /> <updated>1607182699156</updated> </task> - <option name="localTasksCounter" value="2" /> + <task id="LOCAL-00002" summary="feat: Add ability to have multiple actions beyond workspace managment"> + <created>1607188349376</created> + <option name="number" value="00002" /> + <option name="presentableId" value="LOCAL-00002" /> + <option name="project" value="LOCAL" /> + <updated>1607188349376</updated> + </task> + <option name="localTasksCounter" value="3" /> <servers /> </component> <component name="VcsManagerConfiguration"> <MESSAGE value="refactor: Use Workspace setup" /> - <option name="LAST_COMMIT_MESSAGE" value="refactor: Use Workspace setup" /> + <MESSAGE value="feat: Add ability to have multiple actions beyond workspace managment" /> + <option name="LAST_COMMIT_MESSAGE" value="feat: Add ability to have multiple actions beyond workspace managment" /> </component> <component name="XSLT-Support.FileAssociations.UIState"> <expand /> diff --git a/launchpad_sway_controler/src/main.rs b/launchpad_sway_controler/src/main.rs @@ -25,7 +25,7 @@ pub enum LaunchpadMapping { Steam = 115, Games = 114, Youtube = 113, - Test = 112, + Test = 0, } impl Into<PluginActions<'_>> for LaunchpadMapping { @@ -55,13 +55,14 @@ impl TryFrom<i32> for LaunchpadMapping { 115 => Ok(LaunchpadMapping::Steam), 114 => Ok(LaunchpadMapping::Games), 113 => Ok(LaunchpadMapping::Youtube), - 112 => Ok(LaunchpadMapping::Test), + 0 => Ok(LaunchpadMapping::Test), _ => Err(()), } } } fn reset_colors(conn_out: &mut MidiOutputConnection) { + conn_out.send(&[176, 0, 0]).unwrap(); for value in LaunchpadMapping::iter() { conn_out .send(&[144, (value as i32).try_into().unwrap(), 15])