kmonad instead of xmodmap
This commit is contained in:
parent
922a5a66e2
commit
d80ac3b5a0
8 changed files with 99 additions and 74 deletions
13
flake.nix
13
flake.nix
|
@ -137,6 +137,7 @@
|
||||||
sops.defaultSopsFile = lib.mkForce "${secrets}/secrets/${name}.yaml";
|
sops.defaultSopsFile = lib.mkForce "${secrets}/secrets/${name}.yaml";
|
||||||
imports = [
|
imports = [
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
|
kmonad.nixosModules.default
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -153,6 +154,8 @@
|
||||||
polygon-art = polygon-art.packages.${pkgs.system};
|
polygon-art = polygon-art.packages.${pkgs.system};
|
||||||
landingpage = landingpage.packages.${pkgs.system}.plain;
|
landingpage = landingpage.packages.${pkgs.system}.plain;
|
||||||
trilium-server = nixpkgs-unstable.legacyPackages.${pkgs.system}.trilium-server;
|
trilium-server = nixpkgs-unstable.legacyPackages.${pkgs.system}.trilium-server;
|
||||||
|
kmonad = kmonad.packages.${pkgs.system}.kmonad;
|
||||||
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -200,18 +203,8 @@
|
||||||
imports = [
|
imports = [
|
||||||
grocy-scanner.nixosModule
|
grocy-scanner.nixosModule
|
||||||
nixos-hardware.nixosModules.framework-12th-gen-intel
|
nixos-hardware.nixosModules.framework-12th-gen-intel
|
||||||
#retiolum.nixosModules.retiolum
|
|
||||||
#kmonad.nixosModules.default
|
|
||||||
private_assets.nixosModules.jobrad
|
private_assets.nixosModules.jobrad
|
||||||
];
|
];
|
||||||
# todo : check out => https://github.com/terlar/nix-config/blob/ad35fbfc20e58626eb9fbd5f67716bc07bb98fc9/home-manager/modules/profiles/user/terje/keyboards.nix
|
|
||||||
#services.kmonad = {
|
|
||||||
# enable = false;
|
|
||||||
# keyboards.laptop-keyboard = {
|
|
||||||
# name = "laptop-keyboard";
|
|
||||||
# device = "";
|
|
||||||
# };
|
|
||||||
#};
|
|
||||||
|
|
||||||
home-manager.users.mainUser = {
|
home-manager.users.mainUser = {
|
||||||
imports = [
|
imports = [
|
||||||
|
|
|
@ -13,6 +13,7 @@ with lib;
|
||||||
./suspend.nix
|
./suspend.nix
|
||||||
./pass.nix
|
./pass.nix
|
||||||
./audio.nix
|
./audio.nix
|
||||||
|
./kmonad.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = mkIf config.components.gui.enable {
|
config = mkIf config.components.gui.enable {
|
||||||
|
|
|
@ -1,32 +1,5 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
|
||||||
# todo : use kmonad
|
|
||||||
xmodmapConfig = pkgs.writeText "xmodmap" ''
|
|
||||||
!
|
|
||||||
! Swap Caps_Lock and Control_L
|
|
||||||
!
|
|
||||||
|
|
||||||
! replace capslock keys with Escape Keys
|
|
||||||
! remove Lock = Caps_Lock
|
|
||||||
clear Lock
|
|
||||||
add Lock = Scroll_Lock
|
|
||||||
|
|
||||||
keysym Caps_Lock = Escape
|
|
||||||
|
|
||||||
! Set Right function Key to Windows-key
|
|
||||||
keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R
|
|
||||||
|
|
||||||
! Map umlauts to RIGHT ALT + <key>
|
|
||||||
keycode 108 = Mode_switch
|
|
||||||
keysym e = e E EuroSign
|
|
||||||
keysym c = c C cent
|
|
||||||
keysym a = a A adiaeresis Adiaeresis
|
|
||||||
keysym o = o O odiaeresis Odiaeresis
|
|
||||||
keysym u = u U udiaeresis Udiaeresis
|
|
||||||
keysym s = s S ssharp
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -219,9 +192,6 @@ in
|
||||||
|
|
||||||
# todo : still needed?
|
# todo : still needed?
|
||||||
home.file.".xprofile".text = ''
|
home.file.".xprofile".text = ''
|
||||||
# load keyboard mappings
|
|
||||||
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
|
|
||||||
|
|
||||||
# to allow sudo commands to access X
|
# to allow sudo commands to access X
|
||||||
# todo : only allow the browsers and rambox access
|
# todo : only allow the browsers and rambox access
|
||||||
${pkgs.xorg.xhost}/bin/xhost +
|
${pkgs.xorg.xhost}/bin/xhost +
|
||||||
|
@ -281,11 +251,6 @@ in
|
||||||
|
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
let
|
let
|
||||||
fixKeyboard = pkgs.writeScriptBin "fix-Keyboard" # sh
|
|
||||||
''
|
|
||||||
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
|
|
||||||
'';
|
|
||||||
|
|
||||||
fixXhost = pkgs.writeScriptBin "fix-xhost" # sh
|
fixXhost = pkgs.writeScriptBin "fix-xhost" # sh
|
||||||
''
|
''
|
||||||
${pkgs.xorg.xhost}/bin/xhost + &> /dev/null
|
${pkgs.xorg.xhost}/bin/xhost + &> /dev/null
|
||||||
|
@ -294,8 +259,6 @@ in
|
||||||
fixX = pkgs.writeScriptBin "fix-X" # sh
|
fixX = pkgs.writeScriptBin "fix-X" # sh
|
||||||
''
|
''
|
||||||
|
|
||||||
${fixKeyboard}/bin/fix-Keyboard
|
|
||||||
|
|
||||||
for file in `ls ~/.screenlayout`
|
for file in `ls ~/.screenlayout`
|
||||||
do
|
do
|
||||||
echo $file
|
echo $file
|
||||||
|
@ -313,7 +276,6 @@ in
|
||||||
[
|
[
|
||||||
fixX
|
fixX
|
||||||
fixXhost
|
fixXhost
|
||||||
fixKeyboard
|
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -314,33 +314,8 @@ in
|
||||||
# autorandr --change # automatically detects the setup
|
# autorandr --change # automatically detects the setup
|
||||||
"${cfg.config.modifier}+BackSpace" =
|
"${cfg.config.modifier}+BackSpace" =
|
||||||
let
|
let
|
||||||
xmodmapConfig = pkgs.writeText "xmodmap" ''
|
|
||||||
!
|
|
||||||
! Swap Caps_Lock and Control_L
|
|
||||||
!
|
|
||||||
|
|
||||||
! replace capslock keys with Escape Keys
|
|
||||||
! remove Lock = Caps_Lock
|
|
||||||
clear Lock
|
|
||||||
add Lock = Scroll_Lock
|
|
||||||
|
|
||||||
keysym Caps_Lock = Escape
|
|
||||||
|
|
||||||
! Set Right function Key to Windows-key
|
|
||||||
keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R
|
|
||||||
|
|
||||||
! Map umlauts to RIGHT ALT + <key>
|
|
||||||
keycode 108 = Mode_switch
|
|
||||||
keysym e = e E EuroSign
|
|
||||||
keysym c = c C cent
|
|
||||||
keysym a = a A adiaeresis Adiaeresis
|
|
||||||
keysym o = o O odiaeresis Odiaeresis
|
|
||||||
keysym u = u U udiaeresis Udiaeresis
|
|
||||||
keysym s = s S ssharp
|
|
||||||
'';
|
|
||||||
script = pkgs.writers.writeBash "autorandr" ''
|
script = pkgs.writers.writeBash "autorandr" ''
|
||||||
${pkgs.autorandr}/bin/autorandr --change
|
${pkgs.autorandr}/bin/autorandr --change
|
||||||
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
|
|
||||||
${backgroundCommand}
|
${backgroundCommand}
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
|
|
44
nixos/components/gui/kmonad.nix
Normal file
44
nixos/components/gui/kmonad.nix
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
services.kmonad = {
|
||||||
|
enable = true;
|
||||||
|
keyboards.dasKeyboard = {
|
||||||
|
device = "/dev/input/by-id/usb-Metadot_-_Das_Keyboard_Das_Keyboard-event-kbd";
|
||||||
|
defcfg = {
|
||||||
|
enable = true;
|
||||||
|
fallthrough = true;
|
||||||
|
allowCommands = true;
|
||||||
|
};
|
||||||
|
config = ''
|
||||||
|
(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
|
||||||
|
)
|
||||||
|
|
||||||
|
(defalias sym (layer-toggle symbols))
|
||||||
|
|
||||||
|
(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 [ ] \
|
||||||
|
esc a s d f g h j k l ; ' ret
|
||||||
|
lsft z x c v b n m , . / rsft
|
||||||
|
lctl lmet lalt spc @sym rmet cmp rctrl
|
||||||
|
)
|
||||||
|
|
||||||
|
;; sz
|
||||||
|
;; cent
|
||||||
|
;; tm
|
||||||
|
;; ^2 ^3 ...
|
||||||
|
(deflayer symbols
|
||||||
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||||
|
_ _ _ € _ ™ _ ü _ ö _ _ _ _
|
||||||
|
caps ä ß _ _ _ _ _ _ _ _ _ _
|
||||||
|
_ _ _ ¢ _ _ _ _ _ _ _ _
|
||||||
|
_ _ _ _ _ _ _ _)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
|
@ -57,7 +57,6 @@ with lib;
|
||||||
xclip
|
xclip
|
||||||
xtrlock-pam
|
xtrlock-pam
|
||||||
xorg.xev
|
xorg.xev
|
||||||
xorg.xmodmap
|
|
||||||
|
|
||||||
dmenu
|
dmenu
|
||||||
arandr
|
arandr
|
||||||
|
|
|
@ -17,6 +17,8 @@ in
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
||||||
|
kmonad
|
||||||
|
|
||||||
((ganttproject-bin.override {
|
((ganttproject-bin.override {
|
||||||
jre = pkgs.openjdk11;
|
jre = pkgs.openjdk11;
|
||||||
}).overrideAttrs (old: {
|
}).overrideAttrs (old: {
|
||||||
|
|
49
scripts/kmonad.kbd
Normal file
49
scripts/kmonad.kbd
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
(defcfg
|
||||||
|
;; For Linux
|
||||||
|
input (device-file "/dev/input/by-id/usb-Metadot_-_Das_Keyboard_Das_Keyboard-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.
|
||||||
|
"/run/current-system/sw/bin/sleep 1 && /run/current-system/sw/bin/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
|
||||||
|
|
||||||
|
;; 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
|
||||||
|
)
|
||||||
|
|
||||||
|
(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
|
||||||
|
)
|
||||||
|
|
||||||
|
(defalias sym (layer-toggle symbols))
|
||||||
|
|
||||||
|
(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 [ ] \
|
||||||
|
esc a s d f g h j k l ; ' ret
|
||||||
|
lsft z x c v b n m , . / rsft
|
||||||
|
lctl lmet lalt spc @sym rmet cmp rctrl
|
||||||
|
)
|
||||||
|
|
||||||
|
;; sz
|
||||||
|
;; cent
|
||||||
|
;; tm
|
||||||
|
;; ^2 ^3 ...
|
||||||
|
(deflayer symbols
|
||||||
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||||
|
_ _ _ € _ _ _ ü _ ö _ _ _ _
|
||||||
|
caps ä _ _ _ _ _ _ _ _ _ _ _
|
||||||
|
_ _ _ _ _ _ _ _ _ _ _ _
|
||||||
|
_ _ _ _ _ _ _ _)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue