Autorotate only in tablet mode

Added support for actions when entering/existing tablet mode for Home
Manager and fixed for NixOS
This commit is contained in:
Aleksandr Lebedev 2025-08-17 22:09:05 +02:00
parent 466cdb10b3
commit 1e9fc1d9d5
3 changed files with 112 additions and 59 deletions

View file

@ -290,7 +290,7 @@ in
Description = "Makes sure that you have touchscreen gestures.";
};
Install = {
WantedBy = ["default.target"];
WantedBy = ["graphical.target"];
};
Service = {
ExecStart = "${pkgs.writeShellScript "run-lisgd" ''
@ -305,7 +305,7 @@ in
Description = "Adds auto rotation to Niri.";
};
Install = {
WantedBy = ["default.target"];
WantedBy = ["graphical.target"];
};
Service = {
ExecStart = "${pkgs.writeShellScript "autorotate" ''
@ -342,4 +342,18 @@ in
RestartSec = 5;
};
};
custom.hardware.tablet = {
onTabletModeEnable = [
{
name = "autorotate";
command = "systemctl --user start autorotate-niri.service";
}
];
onTabletModeDisable = [
{
name = "autorotate";
command = "systemctl --user stop autorotate-niri.service";
}
];
};
}