add on screen keyboard to lpt2

This commit is contained in:
müde 2026-08-30 20:38:31 +02:00
commit c5b6c7a809

View file

@ -2,10 +2,12 @@
pkgs, pkgs,
config, config,
lib, lib,
device,
... ...
}: }:
{ {
config = { config = lib.mkMerge [
{
home.sessionVariables.NIXOS_OZONE_WL = "1"; home.sessionVariables.NIXOS_OZONE_WL = "1";
home.packages = with pkgs; [ home.packages = with pkgs; [
xwayland-satellite xwayland-satellite
@ -433,5 +435,41 @@
}; };
}; };
}; };
}
# lpt2's keyboard is flaky, so give it an on-screen keyboard.
# squeekboard auto-shows on focused text fields via the input-method
# protocol, but that doesn't catch every app, so Mod+K force-toggles it
# over D-Bus (sm.puri.OSK0), which is squeekboard's own control interface.
(
let
squeekboard-toggle = pkgs.writeShellApplication {
name = "squeekboard-toggle";
runtimeInputs = [ pkgs.systemd ];
text = ''
dest=sm.puri.OSK0
path=/sm/puri/OSK0
iface=sm.puri.OSK0
current=$(busctl --user get-property "$dest" "$path" "$iface" Visible | cut -d' ' -f2)
if [ "$current" = "true" ]; then
busctl --user call "$dest" "$path" "$iface" SetVisible b false
else
busctl --user call "$dest" "$path" "$iface" SetVisible b true
fi
'';
};
in
lib.mkIf (device == "muede-lpt2") {
home.packages = [ pkgs.squeekboard ];
programs.niri.settings = {
spawn-at-startup = [
{ command = [ (lib.getExe' pkgs.squeekboard "squeekboard") ]; }
];
binds."Mod+K".action.spawn = lib.getExe squeekboard-toggle;
}; };
} }
)
];
}