{"id":4689,"date":"2023-10-30T14:52:05","date_gmt":"2023-10-30T13:52:05","guid":{"rendered":"https:\/\/pmortensen.eu\/world2\/?p=4689"},"modified":"2024-05-15T20:50:00","modified_gmt":"2024-05-15T19:50:00","slug":"mouse-actions-in-via-macros-qmk","status":"publish","type":"post","link":"https:\/\/pmortensen.eu\/world2\/2023\/10\/30\/mouse-actions-in-via-macros-qmk\/","title":{"rendered":"Mouse actions in Via macros (QMK)"},"content":{"rendered":"<p>The short version: Mouse actions are not supported when recording macros, and they <strong><em>can&#8217;t<\/em><\/strong> be added after recording by inserting the appropriate keycodes in the JSON source (directly in Via, not in a file). Though there is <a href=\"https:\/\/pmortensen.eu\/world2\/2024\/02\/26\/a-hack-to-use-mouse-actions-in-via-macros\/\">a solution<\/a>!<\/p>\n<h2>Introduction<\/h2>\n<p>Via has <a href=\"https:\/\/pmortensen.eu\/world2\/2023\/07\/10\/via-macros-on-mechanical-keyboards-with-qmk-are-less-crippled-than-expected\/#crippledVia\">a lot of limitations<\/a>, at least at first glance. Some of them can be overcome, e.g., <a href=\"https:\/\/pmortensen.eu\/world2\/2023\/07\/10\/via-macros-on-mechanical-keyboards-with-qmk-are-less-crippled-than-expected\/#crippledVia\">changing the total number of key actions macros<\/a> (default 150). Another is support of mouse actions. <\/p>\n<p><!--\nThere doesn't ... But there is.\nThough it does require some fiddling with text.\n--><\/p>\n<h2>The attempt<\/h2>\n<p>After recording, <strong><em>save first<\/em><\/strong> to transfer the recorded macro to the keyboard (if not, the recorded macro will be wiped out). Switch to the source view (this will read the information from the keyboard, hence why saving first is crucial). At the appropriate place, add this text to the macro source, using the appropriate <a href=\"https:\/\/pmortensen.eu\/world2\/2023\/09\/18\/raw-qmk-keycodes-not-symboli#Mouse_keycodes\">keycode for mouse right click<\/a>:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\n{KC_MS_BTN2}{100}\r\n<\/pre>\n<p>100 is a 100 ms separation between click down and click up. Its value isn&#8217;t critical.<\/p>\n<p>When saving, this will result in:<\/p>\n<p><em>&#8220;Whoops! Invalid keycodes detected inside{}: KC_MS_BTN2&#8221;<\/em><\/p>\n<p>The same is using explicit press and release:<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\n{+KC_MS_BTN2}{100}{-KC_MS_BTN2}{100}\r\n<\/pre>\n<h2>Is there an escape?<\/h2>\n<p>For example, is it possible to use a numeric code instead of the symbolic key codes? A number enclosed in &#8220;{}&#8221; means a delay (the unit is milliseconds).<\/p>\n<p><!--\nFor instance, during recording press a placeholder key, say X.\n\nMouse actions in Via macros (QMK)\n\n--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The short version: Mouse actions are not supported when recording macros, and they can&#8217;t be added after recording by inserting the appropriate keycodes in the JSON source (directly in Via, not in a file). Though there is a solution! Introduction &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/pmortensen.eu\/world2\/2023\/10\/30\/mouse-actions-in-via-macros-qmk\/\"> <span class=\"screen-reader-text\">Mouse actions in Via macros (QMK)<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,26,35,38],"tags":[],"_links":{"self":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/4689"}],"collection":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/comments?post=4689"}],"version-history":[{"count":17,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/4689\/revisions"}],"predecessor-version":[{"id":5245,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/posts\/4689\/revisions\/5245"}],"wp:attachment":[{"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/media?parent=4689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/categories?post=4689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pmortensen.eu\/world2\/wp-json\/wp\/v2\/tags?post=4689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}