auto up 01:11:50 up 4:43, 2 users, load average: 1.05, 0.88, 0.89

This commit is contained in:
2025-11-21 01:11:51 +01:00
parent 350b29c22d
commit d407f6e68d
4 changed files with 75 additions and 216 deletions

View File

@@ -31,7 +31,7 @@ exec-once = hyprsunset -t 3000
exec-once = wl-clip-persist --clipboard regular
exec-once = hyprpaper
exec-once = nm-applet
exec-once = kmonad ~/dotfiles/home/dot-kmonad/default.kbd &
exec-once = ~/projects/scripts/shell/start_kmonad.sh
exec-once = sleep 5 && nextcloud
# Prevent speaker damage

View File

@@ -23,7 +23,7 @@
(defalias
caps (tap-hold-next 200 esc lctl)
symbols_default (tap-hold 100 ; (layer-toggle symbols))
symbols (layer-toggle symbols)
neo (layer-switch neo)
specials (layer-toggle specials)
@@ -31,30 +31,30 @@
)
(deflayer default
@neo f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 XX XX XX
XX 1 2 3 4 5 6 7 8 9 0 XX XX bspc XX XX XX XX XX XX XX
tab q w e r t y u i o p XX XX ret XX XX XX XX XX XX XX
@caps a s d f g h j k l @symbols_default XX XX XX XX XX
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 XX XX XX
grv 1 2 3 4 5 6 7 8 9 0 - = bspc XX XX XX XX XX XX XX
tab q w e r t y u i o p [ ] ret XX XX XX XX XX XX XX
@caps a s d f g h j k l ; @symbols @symbols XX XX XX
rsft @specials z x c v b n m , . / rsft up XX XX XX XX
XX XX lmet spc ralt XX XX XX left down rght XX XX
@neo XX lmet spc ralt XX XX XX left down rght XX XX
)
;; Inspired from neo, graphite and enthium
(deflayer neo
@default f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 XX XX XX
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 XX XX XX
XX 1 2 3 4 5 6 7 8 9 0 XX XX bspc XX XX XX XX XX XX XX
tab b l d w z _ f o u j XX XX ret XX XX XX XX XX XX XX
@caps n r t s g y h a e i XX XX XX XX XX
@caps n r t s g y h a e i @symbols @symbols XX XX XX
lsft @specials q x m c v k p _ _ _ rsft up XX XX XX XX
XX XX lmet spc ralt XX XX XX left down rght XX XX
@default XX lmet spc ralt XX XX XX left down rght XX XX
)
(deflayer symbols
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ \ / [ ] ^ ! < > ' _ _ _ _ _ _ _ _ _ _ _
= : ; { } * ? \( \) @ _ _ _ _ _ _
" - # $ | ~ ` + % _ _ _ _ _ _ _ _ _
- \ / [ ] ^ ! < > @ _ _ _ _ _ _ _ _ _ _ _
= ' " { } * _ \( \) _ _ _ _ _ _ _
? _ # $ | ~ ` + % _ _ _ _ _ _ _ _ _
_ _ & \_ _ _ _ _ _ _ _ _ _
)

View File

@@ -1,203 +0,0 @@
(defcfg
;; For Linux
input (device-file "/dev/input/by-id/usb-HyperX_Alloy_Elite_RGB_HyperX_Alloy_Elite_RGB-event-kbd")
output (uinput-sink "My KMonad output"
;; To understand the importance of the following line, see the section on
;; Compose-key sequences at the near-bottom of this file.
"sleep 1 && setxkbmap -option compose:ralt")
cmp-seq ralt ;; Set the compose key to `RightAlt'
cmp-seq-delay 5 ;; 5ms delay between each compose-key sequence press
key-seq-delay 5 ;; 5ms delay between each outputted key event
;; For Windows
;; input (low-level-hook)
;; output (send-event-sink)
;; For MacOS
;; input (iokit-name "my-keyboard-product-string")
;; output (kext)
;; Comment this if you want unhandled events not to be emitted
fallthrough true
;; Set this to false to disable any command-execution in KMonad
allow-cmd true
;; Set the implicit around to `around`
implicit-around around
)
#| --------------------------------------------------------------------------
Necessary: at least 1 `defsrc` block
It is difficult to explain the `defsrc` block without immediately going into
`deflayer` blocks as well. Essentially, KMonad maps input-events to various
internal actions, many of which generate output events. The `defsrc` block
explains the layout on which we specify our `deflayer`s down the line.
It is important to realize that the `defsrc` block doesn't *necessarily* have
to coincide with your actual input keyboard. You can specify a full 100%
`defsrc` block, but only use a 40% keyboard. This will mean that every
`deflayer` you specify will also have to match your 100% `defsrc`, and that
your actual keyboard would be physically unable to trigger about 60% of your
keymap, but it would be perfectly valid syntax.
The dual of this (and more useful) is that it is also perfectly valid to only
specify that part of your keyboard in `defsrc` that you want to remap. If you
use a 100% keyboard, but don't want to remap the numpad at all you can simply
leave the numpad out of your `defsrc`, and it should work just fine. In that
particular case you probably want to set `fallthrough` to `true` in your
`defcfg` block though.
There is also support for named `defsrc` blocks. They contain `:name <my-source>`
as the first argument in their definition.
The layouting in the `defsrc` block is completely free, whitespace simply gets
ignored. We strive to provide a name for every keycode that is no longer than
4 characters, so we find that laying out your keymap in columns of 5 works out
quite nicely (although wider columns will allow for more informative aliases,
see below).
You can also insert a placeholder button using `XX`. This is almost the same
as extra white space but you still need to bind a button to it. Said button is
never used. This is occasionally useful if you have buttons which don't emit a
keycode or have the same keycode multiple times on the same keyboard. In such
cases large chunks of whitespace may be more confusing then a placeholder
button. If you further want to specify which button this placeholder refers
to, you can use an alias (see below).
Instead of keycodes directly you can also use an alias (see `defalias`).
The syntax for aliases is the same as described in `deflayer`. Keep in mind
that buttons, which won't work if you place them in `defsrc` directly, will
also not work if you use them via an alias.
Most keycodes should be obvious. If you are unsure, check
'./src/KMonad/Keyboard/Keycode.hs'. Every Keycode has a name corresponding to
its Keycode name, but all lower-case and with the 'Key' prefix removed. There
are also various aliases for Keycodes starting around line 350. If you are
trying to bind a key and there is not a 4-letter alias, please file an issue,
or better yet, a pull-request, and it will be added promptly.
Also, you can consult './keymap/template/' for various input templates to use
directly or to look up keycodes by position. Here we use the input-template
for 'us_ansi_60.kbd'
-------------------------------------------------------------------------- |#
(defsrc
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet cmp rctl
)
(deflayer capsasa
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
lctrl a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet cmp rctl
)
(defsrc :name numpad
nlck kp/ kp* kp-
kp7 kp8 kp9 kp+
kp4 kp5 kp6
kp1 kp2 kp3 kprt
kp0 kp.
)
(defsrc :name with-aliases @foo @power)
(defalias
num (layer-toggle numbers) ;; Bind num to a button that switches to a layer
kil C-A-del ;; Bind kil to a button that Ctrl-Alt-deletes
power XX ;; Placeholder for power button of keyboard
foo @bar ;; An alias with a forward reference to another alias
bar a
)
#| NOTE: The above code could just as easily have been written as:
(defalias num (layer-toggle numbers))
(defalias kil C-A-del)
(deflayer qwerty
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl @num lalt spc ralt rmet @sym @tst
)
(deflayer phone :source numpad
:implicit-around disabled
nlck kp/ kp* kp-
kp1 kp2 kp3 kp+
kp4 kp5 kp6
kp7 kp8 kp9 kprt
kp0 kp.
)
(deflayer numbers
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ XX / 7 8 9 - _ _ _
_ _ _ _ _ XX * 4 5 6 + _ _
_ _ \( \) . XX 0 1 2 3 _ _
_ _ _ _ _ _ _ _
)
(defalias
;; Something useful
cpy C-c
pst C-v
cut C-x
;; Something silly
md1 (around a (around b c)) ;; abc
md2 (around a (around-only lsft b)) ;; aB
md3 C-A-M-S-l
md4 (around % b) ;; BEWARE: %B, not %b, do you see why?
md5 (around-when-alone lctl c)
)
(defalias
ctl-lck (stepped (press-only lctl) (release-only lctl)))
(deflayer modded-test
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ @md4 _ _ _ _ _ _ _ _ _ _ _
_ _ @md1 @md2 @md3 _ _ _ _ _ _ _ _
_ _ @cut @cpy @pst _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
)
(defalias
mc1 #(K M o n a d)
mc2 #(C-c P50 A-tab P50 C-v) ;; Careful, this might do something
mc3 #(P200 h P150 4 P100 > < P50 > < P20 0 r z 1 ! 1 ! !)
mc4 (tap-macro a (pause 50) @md2 (pause 50) c)
mc5 (tap-macro-release esc esc esc)
mc6 #(@mc3 spc @mc3 spc @mc3)
)
(deflayer macro-test
_ @mc1 @mc2 @mc3 @mc4 @mc5 @mc6 _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
)

View File

@@ -0,0 +1,62 @@
(defcfg
input (device-file "/dev/input/by-id/<keyboard>")
output (uinput-sink "Jonas kmonad modified output")
cmp-seq ralt
cmp-seq-delay 5
key-seq-delay 5
fallthrough true
allow-cmd true
implicit-around around
)
(defsrc
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] ret
caps a s d f g h j k l ; ' \
lsft lsgt z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet cmp rctl
)
(defalias
caps (tap-hold-next 200 esc lctl)
symbols (layer-toggle symbols)
neo (layer-switch neo)
specials (layer-toggle specials)
default (layer-switch default)
)
(deflayer default
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] ret
@caps a s d f g h j k l ; @symbols @symbols
lsft @specials z x c v b n m , . / rsft
@neo XX lmet spc ralt XX XX XX
)
(deflayer neo
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] ret
caps a s d f g h j k l ; ' \
lsft lsgt z x c v b n m , . / rsft
@default lmet lalt spc ralt rmet cmp rctl
)
(deflayer symbols
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
)
(deflayer specials
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
)