/r/Kmonad

Photograph via snooOG

More information to come.

Kmonad The Onion of Keyboard Management Tools, available on GNU/Linux, Windows, and MacOS!

Kmonad-Contrib is the current repository for shared configs. We only want to help onboard users and provide more resources to Kmonad.

More information to come.

Kmonad The Onion of Keyboard Management Tools, available on GNU/Linux, Windows, and MacOS!

Kmonad-Contrib is the current repository for shared configs. We only want to help onboard users and provide more resources to Kmonad.

/r/Kmonad

134 Subscribers

1

Unable to run kmonad (MacOS)

For the life of me I can't figure out how to run kmonad for the first time. Every time I do I get this error:
```shell
~/.local/bin/kmonad configs/learning.kbd

libc++abi: terminating due to uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in posix_stat: failed to determine attributes for the specified path: Permission denied ["/Library/Application Support/org.pqrs/tmp/rootonly/vhidd_server"]

[1] 3483 abort ~/.local/bin/kmonad configs/learning.kbd
```

I'm using MacOS Sequoia 15.1.1, M-series chip. I used to use Karabiner-Elements, but have since removed it, hoping kmonad would work.

I installed using these instructions including the steps to manually build and sign the dext.

Has anyone seen this before? What am I missing here?

1 Comment
2024/12/04
00:37 UTC

2

Tray icon

I created a tray icon for kmonad that I use on my windows an Linux machines. Maybe it is of interest to any of you guys. Check the demo here:

0 Comments
2024/11/17
16:37 UTC

4

hi! I made this, feedback?

0 Comments
2024/10/26
04:12 UTC

1

Need some help with configuring

Hi, after hunting for an option to rebind my capslock key to esc when tapping and caps when holding, I ended up with kmonad. I'm also not very experienced with linux in general, as i installed Fedora 40 + KDE just about a week ago, so please bear with me.

I tried to configure kmonad's defsrc with the example provided in the docs but didnt manage to get it working together with the deflayer base, as i got an error with different amounts of keys in both of them.
so i deleted most of the keys in the defsrc, as i technically dont need them to be remapped. Is this wrong?
I can now execute the config.kbd file without errors but it doesnt work.

Any help would be much appreachiated.

my config file:

(defcfg

input (device-file "/dev/input/by-path/pci-0000:00:14.0-usb-0:5.2.2:1.1-event-kbd")

output (uinput-sink "kmonad-output")

fallthrough true ;; Allows unhandled keys to pass through

allow-cmd false

)

(defsrc

esc

caps

)

(deflayer base

;; Tap for Escape, Hold for Caps Lock

caps (tap-hold 200 esc caps)

)

If this is of any relevance, I'm using a german qwertz keyboard layout called neoqwertz, where the capslock key works as a modifier key. As the keyboad layout does the remapping itself it just need to bind the caps key to "caps lock", so this shouldnt cause trouble.

0 Comments
2024/10/20
12:56 UTC

1

Is there a way to clear all layers on button release?

Hi everyone! I have this setup on my Keychron K8 pro which I have achieved using QMK:

I have 3 layers:

  • a base layer with regular qwerty and home row mods (I could easily create the home row mods on kmonad)
  • an extra layer where I have bound hjkl to arrow keys, semicolon to enter, p to backspace and a few other bindings
  • a numbers and symbols layer where the top row are the numbers, the second row are the symbols (shifted numbers)

The way I access the second layer is to hold the spacebar, while the spacebar is held if I tap z it switches to the third layer while still holding the space bar, if I tap z again it switches back to the second layer. If at any point while on the second or the third layer I let go the space bar I go back to the qwerty base layer.

Like it or not this is what I've been using it for a while and I find it very comfortable to use all the keys I need while only using the letter keys and the space bar.

I tried to recreate this on kmonad and this is the .kbd file I came up with:

(defcfg
  input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
  output (uinput-sink "My KMonad output")
)

(defsrc
  esc  f1   f2   f3   f4   f5   f6   f7   f8   f9   f10  f11  f12        ssrq slck pause
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc  ins  home pgup  nlck kp/  kp*  kp-
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \     del  end  pgdn  kp7  kp8  kp9  kp+
  caps a    s    d    f    g    h    j    k    l    ;    '    ret                        kp4  kp5  kp6
  lsft z    x    c    v    b    n    m    ,    .    /    rsft                 up         kp1  kp2  kp3  kprt
  lctl lmet lalt           spc            ralt rmet cmp  rctl            left down rght  kp0  kp.
)

(defalias
    alt_a (tap-hold-next-release 250 a lalt)
    met_s (tap-hold-next-release 250 s lmet)
    ctl_d (tap-hold-next-release 250 d lctl)
    sft_f (tap-hold-next-release 250 f lsft)

    sft_j (tap-hold-next-release 250 j rsft)
    ctl_k (tap-hold-next-release 250 k rctl)
    met_l (tap-hold-next-release 250 l rmet)
    alt_; (tap-hold-next-release 250 ; lalt)

    space_layer (tap-hold-next-release 250 spc (layer-toggle extra))
    t_z1 (layer-add numbers)
    t_z2 (layer-rem numbers)
    clear (around (layer-rem extra) (layer-rem numbers))
    tilda (around lsft grv)
    btab (around lsft tab)
    pip (around lsft \ )
)

(deflayer qwerty
  esc  f1        f2        f3        f4        f5   f6   f7        f8        f9        f10       f11  f12        ssrq slck pause
  grv  1         2         3         4         5    6    7         8         9         0         -    =    bspc  ins  home pgup  nlck kp/  kp*  kp-
  tab  q         w         e         r         t    y    u         i         o         p         [    ]    \     del  end  pgdn  kp7  kp8  kp9  kp+
  caps @alt_a    @met_s    @ctl_d    @sft_f    g    h    @sft_j    @ctl_k    @met_l    @alt_;    '    ret                        kp4  kp5  kp6
  lsft z         x         c         v         b    n    m         ,         .         /         rsft                 up         kp1  kp2  kp3  kprt
  lctl lmet lalt                     @space_layer                  ralt      rmet      cmp       rctl            left down rght  kp0  kp.
)

(deflayer extra
  esc  f1    f2   f3      f4   f5       f6    f7    f8      f9       f10   f11  f12        ssrq slck pause
  grv  1     2    3       4    5        6     7     8       9        0     -    =    bspc  ins  home pgup  nlck kp/  kp*  kp-
  tab  esc   grv  @tilda  tab  @btab    y     u     @pip    \        bspc  [    ]    \     del  end  pgdn  kp7  kp8  kp9  kp+
  caps lalt  lmet lctl    lsft g        left  down  up      right    ret   '    ret                        kp4  kp5  kp6
  lsft @t_z1 x    c       v    b        n     m     ,       .        /    rsft                 up         kp1  kp2  kp3  kprt
  lctl lmet  lalt           (layer-rem extra)       ralt    rmet     cmp  rctl            left down rght  kp0  kp.
)

(deflayer numbers
  esc  f1    f2   f3   f4   f5   f6   f7   f8   f9   f10  f11  f12        ssrq slck pause
  grv  1     2    3    4    5    6    7    8    9    0    -    =    bspc  ins  home pgup  nlck kp/  kp*  kp-
  tab  1     2    3    4    5    6    7    8    9    0    [    ]    \     del  end  pgdn  kp7  kp8  kp9  kp+
  caps !     @    #    $    %    ^    &    *    \(   \)   '    ret                        kp4  kp5  kp6
  lsft @t_z2 x    c    v    b    n    m    ,    .    /    rsft                 up         kp1  kp2  kp3  kprt
  lctl lmet  lalt         @clear           ralt rmet cmp  rctl            left down rght  kp0  kp.
)

The layers are just as I want them, the issue is that the release of the space bar doesn't work when on the numbers layer, if I release it I stay on the numbers layer, only when I press it I can go back to the base layer. If I release the spacebar while on the second layer it does go back to the qwerty base layer, just as needed.

I could achieve this behaviour on QMK by creating a custom key for the spacebar on the extra and numbers layer which triggers on release and clears all layers and modifiers. But it seems to me that this is not possible in kmonad, is there another way to achieve the same result?

2 Comments
2024/07/17
08:19 UTC

1

Is there a way to bind multiple buttons (e.g. ctrl+shift) onto a single button that can be *held*

In my mouse layer, I'd like to use one button to press control & shift together while dragging my mouse.

around, sticky keys, and tap macros don't work. C-S- works only for a subsequent keypress, but not for holding ctrl+shift during mouse movement.

1 Comment
2024/07/01
17:30 UTC

1

QWERTY modifiers on alternative layouts help

Hi, I just started configuring and trying out KMonad, I daily an alternative layout (Halmak) but whenever I hold down modifiers such as Ctrl, Alt, or Win-Key, the layout detects Qwerty

Ex: If i want to copy something, I press the usual Ctrl+C combination key, even though in Halmak that is Ctrl+V

Halmak Layout

I'm wondering how to do this kind of configuration in KMonad, can anyone help? TIA

3 Comments
2024/05/28
09:05 UTC

2

Split config into multiple files?

Is there a way to organise a kmonad configuration into separate files which are included in a main configuration file?

3 Comments
2024/05/15
14:53 UTC

1

Does anyone have a template for 'Shift on hold', e.g. so that holding a letter for X miliseconds sends Shift+letter?

As said. Really appreciate it!

2 Comments
2024/04/30
10:56 UTC

2

[Help]Is there a way to bind different behavior to a single button?

So my usecase is I want to assign two keyboard shortcuts to single key, because both starts with f. That way it is easy for me to bind them to the key f.

For example : I dont want to achieve ctrl+a on a single button, I want to achieve ctrl+a when single tap on a button and then same button when tapped twice does ctrl+x.

Now I accept that may be there is a way to do it, it might be the case that I just dont know how to implement it to get my desired outcome.

So, community people, can you please suggest me how to bind two different shortcut combination to a single key.

4 Comments
2024/04/25
12:41 UTC

1

Can kmonad modify my keyboard layout before bootup (at login manager)?

basically title. I want my colemak dh to work while im signing and first starting the laptop for the day. Can kmonad do this? Thank you

(im on debian 12 if that changes anything)

4 Comments
2024/04/09
09:21 UTC

2

So...how do I run it? (macOS)

I installed Kmonad. I'm on macOS on an M-series chip. I see the the Kmonad folder I installed in my home directory.

I looked around everywhere and tried a bunch of stuff, but literally how to I just run the program just using /keymap/tutorial.kbd?? The files in Kmonad/startup are some Linux Ini files or something and don't seem to be related to macOS.

Any help is appreciated.

5 Comments
2024/03/20
03:02 UTC

1

Home row mod under Linux, with hotplug support from udev and systemd

I've been using kmonad these last 6 months already. I can't live without it for home row mods on my 60% mechanical keyboard (where I cannot modify the firmware). Thank you!

My main pain point was when switching from wired to bluetooth or the other way round. I finally found a way to have something reliable, but it's convoluted.

It might help you if you want have hotplug under Linux and kmonad always activated:

https://www.drakoland.fr/home-row-mod/

0 Comments
2024/03/08
20:53 UTC

2

Dead Keys

There is any way to get a key working as dead key with Kmonad?

Like I tap "dead_grave" key than I tap "e" key and I get "è"?

2 Comments
2024/02/26
15:42 UTC

1

Remapping mouse keys on my razer tartarus

Hello,

Can i use Kmonad to remap the mouse scroll wheel on my Razer Tartarus? Its a keybad that includes a mouse-scroll wheel.

Thank you.

0 Comments
2024/02/25
23:44 UTC

1

Split ctrl and command

I use Mac for office and Linux for personal use. And I want to use kmonad to remap my Linux keyboard to function like a Mac.

I am relatively new to kmonad. And am able to remap the ctrl key. But wanted some help mapping the other functions like SIGINT (command + c).

1 Comment
2024/02/17
19:02 UTC

3

Layer on "a" instead of CapsLock

First: Thank you for Kmonad. I used input-remapper in the past, but kmonad is more flexible.

I thought I am smart, and I use the CapsLock key for a new layer.

I am mostly interested in navigation like (pos1, end, del, up/down, pageUp/Down).

Now I realized that I need to move my pinkie finger to the side if I use CapsLock.

... why not create a new layer by pressing (and holding) "a"?

Then my pinkie finger does not need to move.

Of course, just pressing "a" should still be possible.

Which config is needed to create an "on hold layer"?

Example: holding A and pressing J should be like backspace. But of course, just pressing A should emit "a".

I don't need the default of keyboards: If I hold "a" then it gets emitted again and again. If I want to write "a" ten times, I can press "a" ten times. A new layer would give me much more features.

2 Comments
2024/02/03
10:17 UTC

1

Kmonad creating issues with display locker

I just set up Kmonad and everything behaves as I would expect except the screen locker. When I lock my screen with slock and Kmonad running I am unable to enter my password. I use the colemak layout and have tried to enter the password as if I am on qwerty, but neither works. I also experienced the exact same issue with i3lock. Is this a common issue and how would I solve it?

P.S. I am on Void Linux btw.

1 Comment
2024/02/01
14:44 UTC

2

From input-remapper to kmonad

I switched from input-remapper to Kmonad.

Thank you for this great tool!

I published my config here:

https://github.com/guettli/ten-flying-fingers

Feedback is welcome.

0 Comments
2024/01/28
21:03 UTC

2

Trouble working with XF86/extra media keys

I'm just starting with kmonad on linux (opensuse), and I've gotten through the basics OK: settings the input device, scr, default layer and so on.

One thing I can't seem to do is grab inputs from any additional media keys, like volume controls, search, calculator etc.

These are detected by xev as eg XF86AudioRaiseVolume, XF86Search, XF86Calculator, but they aren't grabbed by evtest, and entering the codes that seem relevant such as KeyVolumeUp or volu from https://github.com/kmonad/kmonad/blob/master/src/KMonad/Keyboard/Keycode.hs doesn't fly.

Do these keys occur at different level that kmonad can't see, or have i missed something obvious?

0 Comments
2024/01/25
04:33 UTC

6

Repeat key on second tap and hold

When I use home row mods using QMK, holding the key down when pressed the second time starts repeating the key. How can I achieve the same with kmonad. Current behaviour only lacks the repeat part. Rest works as expected.

3 Comments
2024/01/06
04:50 UTC

2

Input Merger Program - Linux

I was having issues with my keyboard while using kmonad. My keyboard has a rotary dial on it which I want to use in macros and layers, however under /dev/input/by-id it is listed as a seperate "mouse" device rather than being attached to the keyboard event. I found a program on github (mergeinputs) which fixes this issue. It takes multiple input device events and combine it into a single one which can then be used in kmonad. One problem I saw with the program is that although it created the new event, it gave it a dynamic id (eventX) which made it unintuitive for kmonad which reads from a input file that is static. I forked the program so that it will create a symlink to a user defined path so that you can simply run the program and the kmonad configuration should work every time. This program can combine any input device together so you can technically combine separate keyboards for kmonad macros as well. You can find my fork here.

To use, simple clone, run make install, and run mergeinputs /path/to/store/symlink /dev/input/by-id/usb-KEYBOARD_NAME-* & from either a start-up script or implement the systemd service.

You can use a wildcard or name inputs individually or you can even use /dev/input/by-id/* to use all keyboards.

Thought I would share this to potentially help anyone who might run into the same issue.

Using two keyboards kmonad linux, using multiple keyboards, combine multiple inputs, combine input devices, separate keyboards

Edit: Add tags for SEO

2 Comments
2023/12/30
09:10 UTC

3

Help with config - for run/ raise app launcher

Hi, I've been using kmonad for about 2 months and absolutely love it. The FINAL thing I'm looking to achieve with it is being able to create a layer that will run/ raises specific apps depending on whether they are open or not. After a bit of research, I found jumpapp, which does exactly what I want it to. I.e. I can type "jumpapp firefox-developer-edition" in the terminal and it will open a new instance if there is none already open, and jump to that window if one already going ( if there are multiple instances then you can jump between them too).

HOWEVER, as soon as I try to invoke it it is part of my kmonad config, I get a message in the terminal stating that it's running - but nothing happens. I'm wondering whether there is a permissions issue that I'm not aware of or something similar. Does anyone have any ideas?

An example of a line used to run an app in my kmonad config is:

brow (cmd-button "jumpapp firefox-developer-edition")

I then call the brow alias in a layer with the standard \@brow

If relevant, I'm on Arch linux. Please let me know if there is anything else I can share. Any help massively appreciated!

0 Comments
2023/12/18
10:44 UTC

2

Help with quick appreciation of KMonad's features via modifying Grave key?

I'm using a 60% US keyboard layout in a UK environment and it outputs the ¬ on Shift-Grave Accent, ie the first key on the top row and I want to switch that to |.

KeyCurrentNew
```
Shift¬\
Left-Altintercepted by EXWM/Emacsleave alone would like vertical slash though
Ctrlnothingvertical slash

Currently Right Alt - produces the \ slash key. If it is to remain that way then Shift-Alt - should produce |

Any quick KMonad configuration for this?

This my first foray into KMonad.

0 Comments
2023/12/10
14:39 UTC

1

Entering numpad Alt ASCII code keys in Windows

I'm trying to create defaliases for entering ASCII Alt key combos in Windows, can't figure out how.

For instance, holding Alt and pressing 0176 on the numpad, inputs the "degree" character ° - to get an alias for this, so I can remap it to a key - I thought of:

(around lalt (around nlck (tap-macro 0 1 7 6)))

However, that doesn't work. This seems to me because it should be without the nlck - as that only toggles and untoggles numlock - and instead using something like KeyNumpad0 KeyNumpad1 etc - but there are no such keys.

There should be numpad key definitions though, right - as these are different from regular numbers?

Is this doable for Windows?

1 Comment
2023/12/09
13:47 UTC

3

Is there a way to read what keyboard inputs Kmonad is seeing? Having trouble remapping the Calc button and wondering about mouse buttons.

Is there a good way to read the inputs that Kmonad sees by typing. The first issue I'm having is that Kmonad doesn't seem to want to remap the Calc button on my separate numpad. All the other remappings work on that device. I've tried different variations of StartApp2, LaunchApplication2, Calc, etc. And none of them seem to work.

The second reason I'm wondering about this is because I was hoping to remap the buttons on my Logitech G604 mouse. But I have no idea what they are even mapped to by default.

Edit: I think I found a solution for the mouse by mapping the keys to the onboard mouse memory in Windows using Logitech software. Haven't tested it yet, but still looking for solutions for the Calc key on the numpad.

0 Comments
2023/12/06
21:20 UTC

4

How to manage multiple keyboard?

I started using Kmonad and I love it. I want to use it both at home and at the office. But the laptop I use at the office is different. How do I have my config shared between two keyboards without having to go edit the config file each time?
Note: the config itself isn't a problem, it's compatible for both, it's just the input device id that's different.

4 Comments
2023/12/02
21:59 UTC

1

Has anyone tested latency?

Searched around and couldn't find anything. Just wondering if anyone has actual numbers on added latency while using kmonad.

2 Comments
2023/10/23
09:15 UTC

Back To Top