diff --git a/home/fuji/home.nix b/home/fuji/home.nix index b14c2c3..63390d3 100644 --- a/home/fuji/home.nix +++ b/home/fuji/home.nix @@ -9,6 +9,10 @@ let qutebrowser_firejail = pkgs.writeShellScriptBin "qutebrowser" '' firejail -- ${lib.getExe pkgs.qutebrowser} "$@" ''; + + auto_rotate = + pkgs.writeShellScriptBin "auto-rotate" + (builtins.readFile ./auto-rotate.sh); in { imports = [ @@ -352,6 +356,30 @@ in Install.WantedBy = [ "graphical-session.target" ]; }; + auto-rotate = { + Unit = { + Description = "Rotate eDP-1 from iio-sensor-proxy orientation events"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + Environment = [ + "PATH=${lib.makeBinPath [ + pkgs.iio-sensor-proxy # monitor-sensor + pkgs.wlr-randr + pkgs.coreutils # stdbuf, kill + pkgs.gawk + pkgs.bash # hooks run via bash -c + ]}" + ]; + ExecStart = "${auto_rotate}/bin/auto-rotate"; + ExecReload = "${pkgs.coreutils}/bin/kill -USR2 $MAINPID"; + Restart = "on-failure"; + RestartSec = 5; + }; + Install.WantedBy = [ "graphical-session.target" ]; + }; + lisgd = { Unit = { Description = "Libinput gesture daemon";