Browse Source

Merge branch 'release/0.9.1'

master 0.9.1
Harald Albrecht 5 years ago
parent
commit
fd38798030
  1. 28
      README.md
  2. 9
      sdcard/keys.lua
  3. 2
      sdcard/layouts/keymap-template.lua
  4. 72
      sdcard/layouts/media-player.lua

28
README.md

@ -45,6 +45,7 @@ follows:
```lua
require "layouts/shift" -- for cycling between layouts.
require "layouts/media-player" -- indispensable media player controls.
require "layouts/vsc-golang" -- debugging Go programs in VisualStudio Code.
require "layouts/kdenlive" -- editing video using Kdenlive.
require "layouts/empty" -- empty, do-nothing layout.
@ -61,6 +62,27 @@ The default setup activates the following macro keyboard layouts shown below.
> (top-left key in landscape), then tapping key #5 (immediately right to #11),
> and finally releasing both keys.
### Media Player Controls
We start with the probably indispensable media player controls keyboard layout.
'nuff said.
```text
┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐
┊ 11 ┊ ┊ 8 ┊ ┊ 5 ┊ ┊ 2 ┊
└╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘
🔇 🔈/🔉 🔊
┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐
┊ 10 ┊ ┊ 7 ┊ ┊ 4 ┊ ┊ 1 ┊
└╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘
⏹️️
┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐
┊ 9 ┊ ┊ 6 ┊ ┊ 3 ┊ ┊ 0 ┊
└╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘
◀️◀️ ▮▶ ▶▶
```
### Debug Go in VisualStudio Code
Debug Go programs and packages in VisualStudio Code with its Go extension.
@ -163,7 +185,7 @@ You may want to start from our template in `layouts/keymap-template.lua`.
3. add key definitions for colors and handlers as necessary, see next for examples.
* you can specify key handlers either "inline", as you can see from the
- you can specify key handlers either "inline", as you can see from the
example mapping for key #0:
```lua
@ -176,7 +198,7 @@ You may want to start from our template in `layouts/keymap-template.lua`.
This sets the key #0's LED color to white, and emits an "a" press everytime
you tap key #0.
* for more complex handling, you may want to use a dedicated function instead:
- for more complex handling, you may want to use a dedicated function instead:
```lua
function km.mypress(keyno)
@ -188,7 +210,7 @@ You may want to start from our template in `layouts/keymap-template.lua`.
[1] = { c={r=1, g=1, b=1}, press=km.mypress}
}
* you can also do things on key releases:
- you can also do things on key releases:
```lua
km.keymap = {

9
sdcard/keys.lua

@ -1,5 +1,6 @@
require "keybow"
require "layouts/shift"
require "layouts/vsc-golang"
require "layouts/kdenlive"
require "layouts/empty"
require "layouts/shift" -- for cycling between layouts.
require "layouts/media-player" -- indispensable media player controls.
require "layouts/vsc-golang" -- debugging Go programs in VisualStudio Code.
require "layouts/kdenlive" -- editing video using Kdenlive.
require "layouts/empty" -- empty, do-nothing layout.

2
sdcard/layouts/keymap-template.lua

@ -32,7 +32,7 @@ cable going off "northwards":
11 8 7 6
11 8 5 2
10 7 4 1

72
sdcard/layouts/media-player.lua

@ -0,0 +1,72 @@
-- A Multibow simple media player keyboard layout.
--[[
Copyright 2019 Harald Albrecht
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]--
local mplay = _G.mplay or {} -- module
local mb = require("snippets/multibow")
--[[
The Keybow layout is as follows when in landscape orientation, with the USB
cable going off "northwards":
11 8 5 2
🔇 🔈/🔉 🔊
10 7 4 1
9 6 3 0
]]--
mplay.KEY_STOP = mplay.KEY_STOP or 4
mplay.KEY_PLAYPAUSE = mplay.KEY_PLAYPAUSE or 3
mplay.KEY_PREV = mplay.KEY_PREV or 6
mplay.KEY_NEXT = mplay.KEY_NEXT or 0
mplay.KEY_VOLUP = mplay.KEY_VOLUP or 2
mplay.KEY_VOLDN = mplay.KEY_VOLDN or 5
mplay.KEY_MUTE = mplay.KEY_MUTE or 8
mplay.keymap = {
name="mediaplayer",
[mplay.KEY_STOP] = { c={r=1, g=0, b=0}, press=function() mb.tap(keybow.MEDIA_STOPCD) end},
[mplay.KEY_PLAYPAUSE] = { c={r=0, g=1, b=0}, press=function() mb.tap(keybow.MEDIA_PLAYPAUSE) end},
[mplay.KEY_PREV] = { c={r=0.5, g=0.5, b=1}, press=function() mb.tap(keybow.MEDIA_PREVIOUSSONG) end},
[mplay.KEY_NEXT] = { c={r=0, g=1, b=1}, press=function() mb.tap(keybow.MEDIA_NEXTSONG) end},
[mplay.KEY_MUTE] = { c={r=0.5, g=0.1, b=0.1}, press=function() mb.tap(keybow.MEDIA_MUTE) end},
[mplay.KEY_VOLDN] = { c={r=0.5, g=0.5, b=0.5}, press=function() mb.tap(keybow.MEDIA_VOLUMEDOWN) end},
[mplay.KEY_VOLUP] = { c={r=1, g=1, b=1}, press=function() mb.tap(keybow.MEDIA_VOLUMEUP) end},
}
mb.register_keymap(mplay.keymap)
return mplay -- module
Loading…
Cancel
Save