Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from kmonad:master #17

Open
wants to merge 83 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
235b426
doc/installation/nix: Tell users to add the right groups
slotThe Jun 7, 2024
4d5eb6e
fix #layer link
sujaldev Jun 28, 2024
db8a4d0
Added key rollover to FAQ
jokesper Jun 29, 2024
52c5610
Merge pull request #855 from jokesper/faq-rollover
slotThe Jul 7, 2024
4e68ea5
Merge pull request #853 from sujaldev/master
slotThe Jul 7, 2024
2369bee
haskell-ci: Update workflow
slotThe Jul 7, 2024
79d4186
haskell-ci: Add GHC 9.8
slotThe Jul 7, 2024
6e4c5eb
haskell-ci: Drop GHC 8.8, 8.10, and 9.0
slotThe Jul 7, 2024
f3a7927
Fix broken compose sequences
jokesper Jun 29, 2024
d82b5cd
Disable compose sequence for grave as it is invalid and unreachable
jokesper Jun 29, 2024
57fbacf
More restrictive tests for compose sequences
jokesper Jul 5, 2024
0187cc7
Merge pull request #854 from jokesper/master
slotThe Jul 8, 2024
97a3dea
nix/flake: Bump
slotThe Jul 8, 2024
78d43c3
Fixed `around-next-single` not being parseable
jokesper Jul 7, 2024
7cdcffa
Added missing docs for special buttons in `quick-reference.md`
jokesper Jul 7, 2024
397ed3c
Added `keymap/tutorial.kbd` to button doc test
jokesper Jul 7, 2024
ee971e4
Added documentation for `press-only` and `release-only` buttons
jokesper Jul 7, 2024
5430fec
Added documentation for the missing buttons
jokesper Jul 7, 2024
272b46c
Added test to check that every button appears atleast once in `tutori…
jokesper Jul 7, 2024
bfbfa37
Added entries to changelog
jokesper Jul 8, 2024
398051e
Remove `init` option
jokesper Jul 11, 2024
e334d8f
Merge pull request #857 from jokesper/cleanup-documentation
slotThe Jul 18, 2024
d1d8944
Adding clarity to Mac install in installation.md
kieran-mace Jul 15, 2024
5de0e59
Merge pull request #862 from kieran-mace/master
slotThe Jul 18, 2024
f517d52
Forbid `defsrc` with duplicate keycodes.
jokesper Jul 10, 2024
e5e839b
Merge pull request #860 from jokesper/fix-dup-keys
slotThe Jul 18, 2024
31c591b
tutorial: Add fallthrough example
slotThe Jul 21, 2024
4fc6d0e
Added `around-only` and `around-when-alone`
jokesper Jul 8, 2024
71a92c4
Allow customization of implicit arounds
jokesper Jul 8, 2024
4494811
Added option to overwrite `implicit-around` per layer
jokesper Jul 9, 2024
20ae928
Changed default implicit around
jokesper Jul 9, 2024
52977e4
Added pr number to changelog
jokesper Jul 9, 2024
677db7f
Added `implicit-around` cmdline option
jokesper Jul 11, 2024
883a23a
Be more specific in documentation for `around-only` and `around-when-…
jokesper Jul 19, 2024
cade88f
Fixed a typo in quick-reference.md
ItsLiyua Jul 31, 2024
840af41
Merge pull request #866 from ItsLiyua/patch-1
slotThe Jul 31, 2024
ab09e7b
Add japanese keys aliases
abcdw Aug 1, 2024
6f1e726
Realign aliases
abcdw Aug 1, 2024
218bb6f
Merge pull request #868 from abcdw/japanese-keys
slotThe Aug 4, 2024
3ca703c
Fix broken compose sequences v2
jokesper Aug 4, 2024
34af6c3
Merge pull request #859 from jokesper/feat-around-only
slotThe Aug 11, 2024
2d11c63
Revert "Changed default implicit around"
slotThe Aug 12, 2024
f858f9b
Fixed CI
jokesper Aug 12, 2024
2291623
Merge pull request #869 from jokesper/fix-compose-seq-v2
slotThe Aug 13, 2024
5c94042
Merge pull request #874 from jokesper/fix-ci
slotThe Aug 13, 2024
5d12aea
K.A.Types: Derive Eq for ImplArnd and DefLayerSetting
slotThe Aug 13, 2024
07cd1cb
tests/ComposeSeq: Fix test
slotThe Aug 13, 2024
e73af2c
Fixed some parsing problems
jokesper Aug 13, 2024
4c324f1
Merge pull request #875 from jokesper/fix-parsing-v1
slotThe Aug 21, 2024
84c6ef3
Fixed typos
jokesper Aug 10, 2024
fc45bac
Fixed formatting in `doc/faq.md`
jokesper Jul 22, 2024
061696b
Update compiler and build setup in the dockerfile
lierdakil Sep 1, 2024
5908c0d
Merge pull request #880 from lierdakil/update-docker-compiler
slotThe Sep 3, 2024
906b4e9
Merge pull request #870 from jokesper/fix-typos
slotThe Sep 3, 2024
9ea8367
Allow custom tapping behaviour
jokesper Aug 12, 2024
10b9c2e
Fix most tapping behaviour inside sub buttons.
jokesper Aug 12, 2024
1c6931e
Added changelog entry for tapping fixes
jokesper Aug 12, 2024
fcf3af7
Merge pull request #873 from jokesper/fix-tapping-in-inner
slotThe Sep 11, 2024
a6ca5ca
cabal: Bump version to 0.4.3
slotThe Sep 11, 2024
d7e9a27
stack: Bump resolver to LTS 22.34
slotThe Sep 11, 2024
4e17fc4
cabal: Add bounds for base
slotThe Sep 11, 2024
58d844b
Minor fixes for tutorial.kbd
esuarezsantana Sep 25, 2024
53d5460
Fixed MacOS build
jokesper Sep 26, 2024
e37f949
Added an faq entry for the mini-language
jokesper Sep 27, 2024
b3e3c49
Added FAQ entry relating to os keymaps
jokesper Sep 27, 2024
3eb1cb2
Hold instead of tapping when `multi-tap` gets interrupted during hold
jokesper Sep 27, 2024
4a1cf78
Added changelog entry
jokesper Sep 27, 2024
53285a2
Fix tapping for `tap-hold-next-release`
jokesper Sep 27, 2024
040c4c2
Added names for rfkill and micmute
jokesper Sep 11, 2024
323ac09
Merge pull request #883 from jokesper/missing-keys
slotThe Sep 28, 2024
83353fd
Merge pull request #892 from esuarezsantana/patch-1
slotThe Sep 28, 2024
b3eb93c
Merge pull request #898 from jokesper/fix-tapping-in-inner-v2
slotThe Sep 28, 2024
f990eae
Fix tapping for `tapMacro` and `tapMacroRelease`
jokesper Oct 7, 2024
e85628b
Merge pull request #906 from jokesper/fix-tapping-in-inner-v3
slotThe Oct 10, 2024
751bad8
Merge pull request #895 from jokesper/fix-common-problems-in-issues
slotThe Oct 10, 2024
2455a6f
Added keycodes from windows table and merged tables
jokesper Sep 27, 2024
78b1a42
Merge pull request #894 from jokesper/fix-windows-keycode
slotThe Oct 19, 2024
335c50c
Merge pull request #897 from jokesper/fix-486
slotThe Oct 19, 2024
7fdccc4
Merge pull request #893 from jokesper/fix-macos-build-errors
slotThe Oct 19, 2024
58ad83f
KMonad is now in extra
jokesper Oct 20, 2024
dd58bd1
Merge pull request #909 from jokesper/packaged
slotThe Oct 21, 2024
d681571
nix: Disable nixpkgs kmonad module
slotThe Oct 27, 2024
606c488
flake: Update list of supported compilers
slotThe Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,13 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/cache@v2
with:
path: image.tar
key: ${{ runner.os }}-primes

- run: |
[ -r image.tar ] && docker load -i image.tar || true
rm image.tar || true

- run: docker build . -t kmonad-builder --cache-from=kmonad-builder:latest
- run: docker build . -t kmonad-builder

- run: docker run --rm -v ${PWD}:/host/ kmonad-builder bash -c 'cp -vp /root/.local/bin/kmonad /host/'

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: kmonad-binary
path: kmonad

- run: docker save kmonad-builder -o image.tar
22 changes: 10 additions & 12 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,25 @@ jobs:
# , windows-latest
]
resolver:
[ lts-16 # GHC 8.8
, lts-18 # GHC 8.10
, lts-19 # GHC 9.0
, lts-20 # GHC 9.2
[ lts-20 # GHC 9.2
, lts-21 # GHC 9.4
, nightly-2023-07-19 # GHC 9.6
, lts-22 # GHC 9.6
, nightly-2024-07-05 # GHC 9.8
]

steps:
- name: Clone project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Get ghc version for ${{ matrix.resolver }}
shell: bash
run: |
GHCVER=$(curl -L https://www.stackage.org/${{ matrix.resolver }}/ghc-major-version)
echo "Got $GHCVER"
echo "::set-output name=ghc::$GHCVER"
echo "ghc=$GHCVER" >> $GITHUB_OUTPUT
id: ghc-version

- uses: haskell/actions/setup@v1
- uses: haskell-actions/setup@v2
name: Setup GHC ${{ steps.ghc-version.outputs.ghc }}
id: hs-setup
with:
Expand All @@ -47,25 +45,25 @@ jobs:

- name: Refresh caches once a month
id: cache-date
# GHA writes caches on the first miss and then never updates them again;
# GHC writes caches on the first miss and then never updates them again;
# force updating the cache at least once a month
run: |
echo "::set-output name=date::$(date +%Y-%m)"
echo "date=$(date +%Y-%m)" >> $GITHUB_OUTPUT

- name: Ensure STACK_ROOT exists on Windows
if: runner.os == 'Windows'
run: New-Item -ItemType directory -Path ${{ steps.hs-setup.outputs.stack-root }}

- name: Cache Haskell package metadata
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.hs-setup.outputs.stack-root }}/pantry
key: stack-pantry-${{ runner.os }}-${{ steps.cache-date.outputs.date }}
restore-keys: |
stack-pantry-${{ runner.os }}-

- name: Cache Haskell dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
${{ steps.hs-setup.outputs.stack-root }}/*
Expand Down
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
FROM lierdakil/alpine-haskell:8.10.7
FROM lierdakil/alpine-haskell:9.4.8

WORKDIR /usr/src/kmonad/
RUN apk --no-cache add git
RUN stack update

COPY ./kmonad.cabal ./
COPY ./static/stack.yaml ./static/
COPY ./stack.yaml ./
RUN cat ./static/stack.yaml >> stack.yaml && \
stack --no-install-ghc --system-ghc --skip-ghc-check -j8 build --only-dependencies
COPY ./kmonad.cabal ./stack.yaml ./
RUN stack --no-install-ghc --system-ghc --skip-ghc-check -j8 build --only-dependencies --ghc-options="-fPIC"
COPY ./ ./
RUN cat ./static/stack.yaml >> stack.yaml && \
stack --no-install-ghc --system-ghc --skip-ghc-check install --ghc-options -j
RUN sed -i '/executable kmonad/ a\ ld-options: -static' kmonad.cabal && \
stack --no-install-ghc --system-ghc --skip-ghc-check install --ghc-options="-j -fPIC"
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ If you want to get started with the latest, stable binary release, please check
Additionally, if you need any help or just want to say hi,
you can join our [Matrix space](https://matrix.to/#/#Kmonad:matrix.org) or
jump into our [IRC channel](https://web.libera.chat/#kmonad).
There is also an unofficial [Discord server](https://discord.gg/3tFfWmnahN), and a [Kmonad Subreddit](https://www.reddit.com/r/Kmonad/).
There is also an unofficial [Discord server](https://discord.gg/3tFfWmnahN), and a [KMonad Subreddit](https://www.reddit.com/r/Kmonad/).

## Features


KMonad offers advanced customization features such as **layers**, **multi-tap**, **tap-hold**, and much more. These features are usually available at the hardware level on the QMK-firmware enabled keyboards. However, KMonad allows you to enjoy such features in virtually any keyboard by low-level system manipulations.

For a good introduction to KMonad, have a look at [this Youtube video](https://www.youtube.com/watch?v=Dhj1eauljwU).
For a good introduction to KMonad, have a look at [this YouTube video](https://www.youtube.com/watch?v=Dhj1eauljwU).



Expand Down Expand Up @@ -61,6 +61,7 @@ For more information on how to install KMonad, please refer to:

For information on how to configure KMonad, please refer you to:
- [the configuration tutorial](keymap/tutorial.kbd)
- [quick reference](doc/quick-reference.md)
- [user configurations](https://github.com/kmonad/kmonad-contrib)

Want to add your own keyboard configuration to [kmonad-contrib]? Just
Expand Down
2 changes: 1 addition & 1 deletion c_src/keyio.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int ioctl_keyboard(int fd, int grab) {
return ioctl(fd, EVIOCGRAB, grab);
}

// Acquire a filedescriptor as a uinput keyboard
// Acquire a file descriptor as a uinput keyboard
int acquire_uinput_keysink(int fd, char *name, int vendor, int product, int version) {

// Designate fd as a keyboard of all keys
Expand Down
2 changes: 1 addition & 1 deletion c_src/mac/kext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int exit_sink() {
int init_sink() {
kern_return_t kr;
connect = IO_OBJECT_NULL;
service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceNameMatching(pqrs::karabiner_virtual_hid_device::get_virtual_hid_root_name()));
service = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceNameMatching(pqrs::karabiner_virtual_hid_device::get_virtual_hid_root_name()));
if (!service) {
print_iokit_error("IOServiceGetMatchingService");
return 1;
Expand Down
5 changes: 3 additions & 2 deletions c_src/mac/keyio_mac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#include <AvailabilityMacros.h>

/* The name was changed from "Master" to "Main" in Apple SDK 12.0 (Monterey) */
#if !defined (MAC_OS_X_VERSION_12_0) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_12_0)
/* MAC_OS_X_VERSION_12_0 does not exist :( */
#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000
#define kIOMainPortDefault kIOMasterPortDefault
#endif

Expand Down Expand Up @@ -216,7 +217,7 @@ void monitor_kb(char *product) {
* and opens a pipe for this thread to send key event data to the main
* thread.
*
* Loads a the karabiner kernel extension that will send key events
* Loads a karabiner kernel extension that will send key events
* back to the OS.
*/
extern "C" int grab_kb(char *product) {
Expand Down
41 changes: 41 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,51 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0)

### Added

- Added names for the keys `rfkill` and `micmute` (#883).
If you previously used the buttons `missing247` and `missing248`, please update to the new names.

### Changed

- `multi-tap` now holds when interrupted by another key while held. (#897)

### Fixed

- Fixed `tapMacro` and `tapMacroRelease` behaviour which was slightly broken in #873 (#906)
- Fixed keycode translation problem on windows (#894)

## 0.4.3 – 2024-09-11

### Added

- Added `stepped`. It performs the next button from a circular sequence
whenever it is pressed.
- Implemented named source blocks.
To name a source block add `:name <name>` at the beginning of the
`defsrc` block. To use it add `:source <name>` after the layer name to the
`deflayer` block. (#831)
- Added `around-only`, which works like `around` but releases the outer button
when others are pressed. (#859)
- Added `around-when-alone`, which also represses the outer button when only
the inner button is pressed and all others have been released. (#859)
- Allow customization of implicit `around`s (#859)

### Changed

- Update Karabiner-DriverKit to 3.1.0 (#780)
- Added tests to check that every button has documentation (#857)
- `defsrc` with duplicate keycodes are now forbidden (#860)

### Fixed

- Fixed crash on non-US backslash under MacOS (#766)
- Fixed broken keyboard due to circular event handling under MacOS (#781)
- Fixed crash on unhandled buttons by ignoring them (#807)
- Fixed parse errors relating to whitespace (#796, #875)
- Fixed broken compose sequences (#823, #869)
- Fixed parse errors when using keys only available on Darwin OS (#828)
- Fixed `around-next` wasn't parsable (#857)
- Fixed most buttons which behave weird in nested tap situations (#873)

## 0.4.2 – 2023-10-07

### Added
Expand Down
64 changes: 56 additions & 8 deletions doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@
- [Q: How do I know which event-file corresponds to my keyboard?](#q-how-do-i-know-which-event-file-corresponds-to-my-keyboard)
- [Q: How do I emit Hyper_L?](#q-how-do-i-emit-hyper_l)
- [Q: How does Unicode entry work?](#q-how-does-unicode-entry-work)
- [Q: How do I use the same layout definition for different keyboards](#q-how-do-i-use-the-same-layout-definition-for-different-keyboards)
- [Q: How do I use the same layout definition for different keyboards?](#q-how-do-i-use-the-same-layout-definition-for-different-keyboards)
- [Windows](#windows)
- [How do I start KMonad?](#how-do-i-start-kmonad)
- [Q: How do I start KMonad?](#q-how-do-i-start-kmonad)
- [Using the command-line](#using-the-command-line)
- [Making a launcher](#making-a-launcher)
- [Mac](#mac)
- [Q: How to use the special features printed on Apple function keys?](#q-how-to-use-the-special-features-printed-on-apple-function-keys)
- [General](#general)
- [Q: Why can't I remap certain (non US) buttons?](#q-why-cant-i-remap-certain-non-us-buttons)
- [Q: What does `Ta`, `Pa` and `Ra` stand for?](#q-what-does-ta-pa-and-ra-stand-for)
- [Q: Why doesn't the 'Print' keycode work for my print screen button?](#q-why-doesnt-the-print-keycode-work-for-my-print-screen-button)
- [Q: Why can't I remap the Fn key on my laptop?](#q-why-cant-i-remap-the-fn-key-on-my-laptop)
- [Q: Why do some key combination not work?](#q-why-do-some-key-combination-not-work)
- [Q: When I run KMonad I get error `Not available under this OS`](#q-when-i-run-kmonad-i-get-error-not-available-under-this-os)
- [Q: Where can I find a list of keycodes which can be used in KMonad?](#q-where-can-i-find-a-list-of-keycodes-which-can-be-used-in-kmonad)

<!-- markdown-toc end -->

Expand Down Expand Up @@ -74,9 +78,9 @@ X11 lines up well with KMonad. See [this issue](https://github.com/kmonad/kmonad
### Q: How does Unicode entry work?

A: Unicode entry works via X11 compose-key sequences. For information on how to
configure kmonad to make use of this, please see [the tutorial](../keymap/tutorial.kbd).
configure KMonad to make use of this, please see [the tutorial](../keymap/tutorial.kbd).

### Q: How do I use the same layout definition for different keyboards
### Q: How do I use the same layout definition for different keyboards?

A:
Create a layout file with an environment variable instead of `device-file` option, i.e. `kmonad.kbd`.
Expand Down Expand Up @@ -106,7 +110,7 @@ kmonad <(echo "$KBDCFG")

## Windows

### How do I start KMonad?
### Q: How do I start KMonad?

A: This might be confusing if you are used to using a GUI and clicking on
things. Double clicking KMonad will look like it does nothing. KMonad is a
Expand Down Expand Up @@ -186,9 +190,9 @@ corresponding to F1; macOS then translates this keycode to a special feature
driver](https://github.com/pqrs-org/Karabiner-VirtualHIDDevice/issues/1). But
`kmonad` intercepts key presses before this translation can occur, and it emits
keypresses through a driver of its own. Therefore macOS does not translate any
keypresses emitted by kmonad, and the checkbox labeled "Use F1, F2, etc. keys as
keypresses emitted by KMonad, and the checkbox labeled "Use F1, F2, etc. keys as
standard function keys" in `System Preferences` will have no effect on keyboards
modified by kmonad.
modified by KMonad.

However, we can simulate the default behavior of Apple keyboards by emitting
keycodes that correspond to the special features printed on the function
Expand All @@ -197,9 +201,38 @@ example.

## General

### Q: Why can't I remap certain (non US) buttons?

KMonad works prior to your OS keymapping taking affect.
It also uses the names taken from the standard US qwerty layout.

If you were for example looking to remap an `ü` on a german qwertz keyboard
you would specify the letter that would be there in qwerty (`[`).

This is of course also true for buttons which are in a different place.
On the german layout the `+` is reached without shift, while on US qwerty it's
on `S-=`. This means it's also not a valid keycode to specify in your `defsrc`.

### Q: What does `Ta`, `Pa` and `Ra` stand for?

A: Those are part of a mini-language from the tutorial:

- `Px` signifies the press of the button (or keycode) `x`
- `Rx` signifies the release of `x`
- `Tx` signifies the sequential and near instantaneous press and release of `x`
- `100` signifies 100ms passing without any action

So for example when talking about buttons:

- `Tesc Ta` is a tap of `Esc` and a press of `a`
- `P@a Tb R@a` is the alias `@a` pressed around the button `b`

This language is useful since "tap" is normally a synonym for "press"
and this may lead to confusion in discussions and issues.

### Q: Why doesn't the 'Print' keycode work for my print screen button?

A: Because the Keycode for "print screen" is actually 'SysReq' ("ssrq" or "sys")
A: Because the keycode for "print screen" is actually 'SysReq' ("ssrq" or "sys")
for relatively interesting historical reasons. Have a look at [this
issue](https://github.com/kmonad/kmonad/issues/59) if you want more
information.
Expand All @@ -213,6 +246,21 @@ in the hardware, before any event is ever registered with the operating system,
therefore KMonad has no way to 'get' at any of those events. This means that we
cannot remap them in any way.

### Q: Why do some key combination not work?

A: Some keyboards have a low
[rollover](https://en.wikipedia.org/wiki/Key_rollover).
It is the lowest maximum number of keys which can be pressed together and
handled correctly. Most keyboards then have to resort to blocking.
So If you have buttons which work fine individually but some special
combination does not, check whether you are affected by it.
To do this you can use an
[online rollover test](https://www.mechanical-keyboard.org/key-rollover-test/).
For correct results it is recommended to turn off KMonad
(Also note that some keys cannot be captured by a website).
Another option is to try a different keyboard.
The only other fix is circumvention.

### Q: When I run KMonad I get error `Not available under this OS`

A: This error occurs when there are OS-specific options in the used configuration
Expand Down
Loading