about summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-04-05T19·26-0400
committerGriffin Smith <root@gws.fyi>2020-04-05T19·26-0400
commita566e0208f2134e69e4550d1c05fc49d2b3c6efd (patch)
treefb94ff16e6a9d7b902e929c517686ec60288cb23 /home
parent07d4cf66eb1ae4972764debfeb824c50fbdc6e21 (diff)
Swap caps+escape and alt+super
only on chupacabra laptop keyboard
Diffstat (limited to 'home')
-rw-r--r--home/machines/chupacabra.nix28
1 files changed, 26 insertions, 2 deletions
diff --git a/home/machines/chupacabra.nix b/home/machines/chupacabra.nix
index 714348e3f174..c0d1fce431fb 100644
--- a/home/machines/chupacabra.nix
+++ b/home/machines/chupacabra.nix
@@ -1,7 +1,31 @@
-{ ... }:
-{
+{ pkgs, ... }:
+let
+  laptopKeyboardId = "25";
+in {
   system.machine = {
     wirelessInterface = "wlp59s0";
     i3FontSize = 9;
   };
+
+  systemd.user.services.laptop-keyboard = {
+    Unit = {
+      Description = "Swap caps+escape and alt+super, but only on the built-in laptop keyboard";
+      After = [ "graphical-session-pre.target" ];
+      PartOf = [ "graphical-session.target" ];
+    };
+
+    Install = { WantedBy = [ "graphical-session.target" ]; };
+
+    Service = {
+      Type = "oneshot";
+      RemainAfterExit = true;
+      ExecStart = (
+        "${pkgs.xorg.setxkbmap}/bin/setxkbmap "
+          + "-device ${laptopKeyboardId} "
+          + "-option caps:swapescape "
+          + "-option compose:ralt "
+          + "-option altwin:swap_alt_win"
+      );
+    };
+  };
 }